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

software.amazon.awssdk.services.eventbridge.model.PutPartnerEventsRequestEntry 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;

/**
 * 

* The details about an event generated by an SaaS partner. *

*/ @Generated("software.amazon.awssdk:codegen") public final class PutPartnerEventsRequestEntry implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField TIME_FIELD = SdkField. builder(MarshallingType.INSTANT).memberName("Time") .getter(getter(PutPartnerEventsRequestEntry::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).memberName("Source") .getter(getter(PutPartnerEventsRequestEntry::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) .memberName("Resources") .getter(getter(PutPartnerEventsRequestEntry::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) .memberName("DetailType").getter(getter(PutPartnerEventsRequestEntry::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).memberName("Detail") .getter(getter(PutPartnerEventsRequestEntry::detail)).setter(setter(Builder::detail)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Detail").build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(TIME_FIELD, SOURCE_FIELD, RESOURCES_FIELD, DETAIL_TYPE_FIELD, DETAIL_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 PutPartnerEventsRequestEntry(BuilderImpl builder) { this.time = builder.time; this.source = builder.source; this.resources = builder.resources; this.detailType = builder.detailType; this.detail = builder.detail; } /** *

* The date and time of the event. *

* * @return The date and time of the event. */ public final Instant time() { return time; } /** *

* The event source that is generating the entry. *

* *

* Detail, DetailType, and Source are required for EventBridge to * successfully send an event to an event bus. If you include event entries in a request that do not include each of * those properties, EventBridge fails that entry. If you submit a request in which none of the entries have * each of these properties, EventBridge fails the entire request. *

*
* * @return The event source that is generating the entry.

*

* Detail, DetailType, and Source are required for EventBridge to * successfully send an event to an event bus. If you include event entries in a request that do not include * each of those properties, EventBridge fails that entry. If you submit a request in which none of * the entries have each of these properties, EventBridge fails the entire request. *

*/ public final String source() { return source; } /** * For responses, this returns true if the service returned a value for the Resources 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 hasResources() { return resources != null && !(resources instanceof SdkAutoConstructList); } /** *

* Amazon Web Services 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. *

*

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

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

* A free-form string, with a maximum of 128 characters, used to decide what fields to expect in the event detail. *

* *

* Detail, DetailType, and Source are required for EventBridge to * successfully send an event to an event bus. If you include event entries in a request that do not include each of * those properties, EventBridge fails that entry. If you submit a request in which none of the entries have * each of these properties, EventBridge fails the entire request. *

*
* * @return A free-form string, with a maximum of 128 characters, used to decide what fields to expect in the event * detail.

*

* Detail, DetailType, and Source are required for EventBridge to * successfully send an event to an event bus. If you include event entries in a request that do not include * each of those properties, EventBridge fails that entry. If you submit a request in which none of * the entries have each of these properties, EventBridge fails the entire request. *

*/ public final String detailType() { return detailType; } /** *

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

* *

* Detail, DetailType, and Source are required for EventBridge to * successfully send an event to an event bus. If you include event entries in a request that do not include each of * those properties, EventBridge fails that entry. If you submit a request in which none of the entries have * each of these properties, EventBridge fails the entire request. *

*
* * @return A valid JSON string. There is no other schema imposed. The JSON string may contain fields and nested * sub-objects.

*

* Detail, DetailType, and Source are required for EventBridge to * successfully send an event to an event bus. If you include event entries in a request that do not include * each of those properties, EventBridge fails that entry. If you submit a request in which none of * the entries have each of these properties, EventBridge fails the entire request. *

*/ public final String detail() { return detail; } @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(time()); hashCode = 31 * hashCode + Objects.hashCode(source()); hashCode = 31 * hashCode + Objects.hashCode(hasResources() ? resources() : null); hashCode = 31 * hashCode + Objects.hashCode(detailType()); hashCode = 31 * hashCode + Objects.hashCode(detail()); 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 PutPartnerEventsRequestEntry)) { return false; } PutPartnerEventsRequestEntry other = (PutPartnerEventsRequestEntry) obj; return Objects.equals(time(), other.time()) && Objects.equals(source(), other.source()) && hasResources() == other.hasResources() && Objects.equals(resources(), other.resources()) && Objects.equals(detailType(), other.detailType()) && Objects.equals(detail(), other.detail()); } /** * 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("PutPartnerEventsRequestEntry").add("Time", time()).add("Source", source()) .add("Resources", hasResources() ? resources() : null).add("DetailType", detailType()).add("Detail", detail()) .build(); } public final 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())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((PutPartnerEventsRequestEntry) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The date and time of the event. *

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

* The event source that is generating the entry. *

* *

* Detail, DetailType, and Source are required for EventBridge to * successfully send an event to an event bus. If you include event entries in a request that do not include * each of those properties, EventBridge fails that entry. If you submit a request in which none of the * entries have each of these properties, EventBridge fails the entire request. *

*
* * @param source * The event source that is generating the entry.

*

* Detail, DetailType, and Source are required for EventBridge to * successfully send an event to an event bus. If you include event entries in a request that do not * include each of those properties, EventBridge fails that entry. If you submit a request in which * none of the entries have each of these properties, EventBridge fails the entire request. *

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

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

* * @param resources * Amazon Web Services 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); /** *

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

* * @param resources * Amazon Web Services 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); /** *

* A free-form string, with a maximum of 128 characters, used to decide what fields to expect in the event * detail. *

* *

* Detail, DetailType, and Source are required for EventBridge to * successfully send an event to an event bus. If you include event entries in a request that do not include * each of those properties, EventBridge fails that entry. If you submit a request in which none of the * entries have each of these properties, EventBridge fails the entire request. *

*
* * @param detailType * A free-form string, with a maximum of 128 characters, used to decide what fields to expect in the * event detail.

*

* Detail, DetailType, and Source are required for EventBridge to * successfully send an event to an event bus. If you include event entries in a request that do not * include each of those properties, EventBridge fails that entry. If you submit a request in which * none of the entries have each of these properties, EventBridge fails the entire request. *

* @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 * sub-objects. *

* *

* Detail, DetailType, and Source are required for EventBridge to * successfully send an event to an event bus. If you include event entries in a request that do not include * each of those properties, EventBridge fails that entry. If you submit a request in which none of the * entries have each of these properties, EventBridge fails the entire request. *

*
* * @param detail * A valid JSON string. There is no other schema imposed. The JSON string may contain fields and nested * sub-objects.

*

* Detail, DetailType, and Source are required for EventBridge to * successfully send an event to an event bus. If you include event entries in a request that do not * include each of those properties, EventBridge fails that entry. If you submit a request in which * none of the entries have each of these properties, EventBridge fails the entire request. *

* @return Returns a reference to this object so that method calls can be chained together. */ Builder detail(String detail); } static final class BuilderImpl implements Builder { private Instant time; private String source; private List resources = DefaultSdkAutoConstructList.getInstance(); private String detailType; private String detail; private BuilderImpl() { } private BuilderImpl(PutPartnerEventsRequestEntry model) { time(model.time); source(model.source); resources(model.resources); detailType(model.detailType); detail(model.detail); } public final Instant getTime() { return time; } public final void setTime(Instant time) { this.time = time; } @Override public final Builder time(Instant time) { this.time = time; return this; } public final String getSource() { return source; } public final void setSource(String source) { this.source = source; } @Override public final Builder source(String source) { this.source = source; return this; } public final Collection getResources() { if (resources instanceof SdkAutoConstructList) { return null; } return resources; } public final void setResources(Collection resources) { this.resources = EventResourceListCopier.copy(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 String getDetailType() { return detailType; } public final void setDetailType(String detailType) { this.detailType = detailType; } @Override public final Builder detailType(String detailType) { this.detailType = detailType; return this; } public final String getDetail() { return detail; } public final void setDetail(String detail) { this.detail = detail; } @Override public final Builder detail(String detail) { this.detail = detail; return this; } @Override public PutPartnerEventsRequestEntry build() { return new PutPartnerEventsRequestEntry(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy