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

software.amazon.awssdk.services.redshift.model.EventSubscription Maven / Gradle / Ivy

/*
 * Copyright 2014-2019 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.redshift.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.Consumer;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;
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.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;

/**
 * 

* Describes event subscriptions. *

*/ @Generated("software.amazon.awssdk:codegen") public final class EventSubscription implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField CUSTOMER_AWS_ID_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(EventSubscription::customerAwsId)).setter(setter(Builder::customerAwsId)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CustomerAwsId").build()).build(); private static final SdkField CUST_SUBSCRIPTION_ID_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(EventSubscription::custSubscriptionId)).setter(setter(Builder::custSubscriptionId)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CustSubscriptionId").build()) .build(); private static final SdkField SNS_TOPIC_ARN_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(EventSubscription::snsTopicArn)).setter(setter(Builder::snsTopicArn)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SnsTopicArn").build()).build(); private static final SdkField STATUS_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(EventSubscription::status)).setter(setter(Builder::status)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Status").build()).build(); private static final SdkField SUBSCRIPTION_CREATION_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT) .getter(getter(EventSubscription::subscriptionCreationTime)).setter(setter(Builder::subscriptionCreationTime)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SubscriptionCreationTime").build()) .build(); private static final SdkField SOURCE_TYPE_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(EventSubscription::sourceType)).setter(setter(Builder::sourceType)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SourceType").build()).build(); private static final SdkField> SOURCE_IDS_LIST_FIELD = SdkField .> builder(MarshallingType.LIST) .getter(getter(EventSubscription::sourceIdsList)) .setter(setter(Builder::sourceIdsList)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SourceIdsList").build(), ListTrait .builder() .memberLocationName("SourceId") .memberFieldInfo( SdkField. builder(MarshallingType.STRING) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("SourceId").build()).build()).build()).build(); private static final SdkField> EVENT_CATEGORIES_LIST_FIELD = SdkField .> builder(MarshallingType.LIST) .getter(getter(EventSubscription::eventCategoriesList)) .setter(setter(Builder::eventCategoriesList)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EventCategoriesList").build(), ListTrait .builder() .memberLocationName("EventCategory") .memberFieldInfo( SdkField. builder(MarshallingType.STRING) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("EventCategory").build()).build()).build()).build(); private static final SdkField SEVERITY_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(EventSubscription::severity)).setter(setter(Builder::severity)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Severity").build()).build(); private static final SdkField ENABLED_FIELD = SdkField. builder(MarshallingType.BOOLEAN) .getter(getter(EventSubscription::enabled)).setter(setter(Builder::enabled)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Enabled").build()).build(); private static final SdkField> TAGS_FIELD = SdkField .> builder(MarshallingType.LIST) .getter(getter(EventSubscription::tags)) .setter(setter(Builder::tags)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Tags").build(), ListTrait .builder() .memberLocationName("Tag") .memberFieldInfo( SdkField. builder(MarshallingType.SDK_POJO) .constructor(Tag::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("Tag").build()).build()).build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(CUSTOMER_AWS_ID_FIELD, CUST_SUBSCRIPTION_ID_FIELD, SNS_TOPIC_ARN_FIELD, STATUS_FIELD, SUBSCRIPTION_CREATION_TIME_FIELD, SOURCE_TYPE_FIELD, SOURCE_IDS_LIST_FIELD, EVENT_CATEGORIES_LIST_FIELD, SEVERITY_FIELD, ENABLED_FIELD, TAGS_FIELD)); private static final long serialVersionUID = 1L; private final String customerAwsId; private final String custSubscriptionId; private final String snsTopicArn; private final String status; private final Instant subscriptionCreationTime; private final String sourceType; private final List sourceIdsList; private final List eventCategoriesList; private final String severity; private final Boolean enabled; private final List tags; private EventSubscription(BuilderImpl builder) { this.customerAwsId = builder.customerAwsId; this.custSubscriptionId = builder.custSubscriptionId; this.snsTopicArn = builder.snsTopicArn; this.status = builder.status; this.subscriptionCreationTime = builder.subscriptionCreationTime; this.sourceType = builder.sourceType; this.sourceIdsList = builder.sourceIdsList; this.eventCategoriesList = builder.eventCategoriesList; this.severity = builder.severity; this.enabled = builder.enabled; this.tags = builder.tags; } /** *

* The AWS customer account associated with the Amazon Redshift event notification subscription. *

* * @return The AWS customer account associated with the Amazon Redshift event notification subscription. */ public String customerAwsId() { return customerAwsId; } /** *

* The name of the Amazon Redshift event notification subscription. *

* * @return The name of the Amazon Redshift event notification subscription. */ public String custSubscriptionId() { return custSubscriptionId; } /** *

* The Amazon Resource Name (ARN) of the Amazon SNS topic used by the event notification subscription. *

* * @return The Amazon Resource Name (ARN) of the Amazon SNS topic used by the event notification subscription. */ public String snsTopicArn() { return snsTopicArn; } /** *

* The status of the Amazon Redshift event notification subscription. *

*

* Constraints: *

*
    *
  • *

    * Can be one of the following: active | no-permission | topic-not-exist *

    *
  • *
  • *

    * The status "no-permission" indicates that Amazon Redshift no longer has permission to post to the Amazon SNS * topic. The status "topic-not-exist" indicates that the topic was deleted after the subscription was created. *

    *
  • *
* * @return The status of the Amazon Redshift event notification subscription.

*

* Constraints: *

*
    *
  • *

    * Can be one of the following: active | no-permission | topic-not-exist *

    *
  • *
  • *

    * The status "no-permission" indicates that Amazon Redshift no longer has permission to post to the Amazon * SNS topic. The status "topic-not-exist" indicates that the topic was deleted after the subscription was * created. *

    *
  • */ public String status() { return status; } /** *

    * The date and time the Amazon Redshift event notification subscription was created. *

    * * @return The date and time the Amazon Redshift event notification subscription was created. */ public Instant subscriptionCreationTime() { return subscriptionCreationTime; } /** *

    * The source type of the events returned the Amazon Redshift event notification, such as cluster, or * cluster-snapshot. *

    * * @return The source type of the events returned the Amazon Redshift event notification, such as cluster, or * cluster-snapshot. */ public String sourceType() { return sourceType; } /** *

    * A list of the sources that publish events to the Amazon Redshift event notification subscription. *

    *

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

    * * @return A list of the sources that publish events to the Amazon Redshift event notification subscription. */ public List sourceIdsList() { return sourceIdsList; } /** *

    * The list of Amazon Redshift event categories specified in the event notification subscription. *

    *

    * Values: Configuration, Management, Monitoring, Security *

    *

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

    * * @return The list of Amazon Redshift event categories specified in the event notification subscription.

    *

    * Values: Configuration, Management, Monitoring, Security */ public List eventCategoriesList() { return eventCategoriesList; } /** *

    * The event severity specified in the Amazon Redshift event notification subscription. *

    *

    * Values: ERROR, INFO *

    * * @return The event severity specified in the Amazon Redshift event notification subscription.

    *

    * Values: ERROR, INFO */ public String severity() { return severity; } /** *

    * A boolean value indicating whether the subscription is enabled; true indicates that the subscription * is enabled. *

    * * @return A boolean value indicating whether the subscription is enabled; true indicates that the * subscription is enabled. */ public Boolean enabled() { return enabled; } /** *

    * The list of tags for the event subscription. *

    *

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

    * * @return The list of tags for the event subscription. */ public List tags() { return tags; } @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(customerAwsId()); hashCode = 31 * hashCode + Objects.hashCode(custSubscriptionId()); hashCode = 31 * hashCode + Objects.hashCode(snsTopicArn()); hashCode = 31 * hashCode + Objects.hashCode(status()); hashCode = 31 * hashCode + Objects.hashCode(subscriptionCreationTime()); hashCode = 31 * hashCode + Objects.hashCode(sourceType()); hashCode = 31 * hashCode + Objects.hashCode(sourceIdsList()); hashCode = 31 * hashCode + Objects.hashCode(eventCategoriesList()); hashCode = 31 * hashCode + Objects.hashCode(severity()); hashCode = 31 * hashCode + Objects.hashCode(enabled()); hashCode = 31 * hashCode + Objects.hashCode(tags()); return hashCode; } @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof EventSubscription)) { return false; } EventSubscription other = (EventSubscription) obj; return Objects.equals(customerAwsId(), other.customerAwsId()) && Objects.equals(custSubscriptionId(), other.custSubscriptionId()) && Objects.equals(snsTopicArn(), other.snsTopicArn()) && Objects.equals(status(), other.status()) && Objects.equals(subscriptionCreationTime(), other.subscriptionCreationTime()) && Objects.equals(sourceType(), other.sourceType()) && Objects.equals(sourceIdsList(), other.sourceIdsList()) && Objects.equals(eventCategoriesList(), other.eventCategoriesList()) && Objects.equals(severity(), other.severity()) && Objects.equals(enabled(), other.enabled()) && Objects.equals(tags(), other.tags()); } /** * 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("EventSubscription").add("CustomerAwsId", customerAwsId()) .add("CustSubscriptionId", custSubscriptionId()).add("SnsTopicArn", snsTopicArn()).add("Status", status()) .add("SubscriptionCreationTime", subscriptionCreationTime()).add("SourceType", sourceType()) .add("SourceIdsList", sourceIdsList()).add("EventCategoriesList", eventCategoriesList()) .add("Severity", severity()).add("Enabled", enabled()).add("Tags", tags()).build(); } public Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "CustomerAwsId": return Optional.ofNullable(clazz.cast(customerAwsId())); case "CustSubscriptionId": return Optional.ofNullable(clazz.cast(custSubscriptionId())); case "SnsTopicArn": return Optional.ofNullable(clazz.cast(snsTopicArn())); case "Status": return Optional.ofNullable(clazz.cast(status())); case "SubscriptionCreationTime": return Optional.ofNullable(clazz.cast(subscriptionCreationTime())); case "SourceType": return Optional.ofNullable(clazz.cast(sourceType())); case "SourceIdsList": return Optional.ofNullable(clazz.cast(sourceIdsList())); case "EventCategoriesList": return Optional.ofNullable(clazz.cast(eventCategoriesList())); case "Severity": return Optional.ofNullable(clazz.cast(severity())); case "Enabled": return Optional.ofNullable(clazz.cast(enabled())); case "Tags": return Optional.ofNullable(clazz.cast(tags())); default: return Optional.empty(); } } @Override public List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((EventSubscription) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

    * The AWS customer account associated with the Amazon Redshift event notification subscription. *

    * * @param customerAwsId * The AWS customer account associated with the Amazon Redshift event notification subscription. * @return Returns a reference to this object so that method calls can be chained together. */ Builder customerAwsId(String customerAwsId); /** *

    * The name of the Amazon Redshift event notification subscription. *

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

    * The Amazon Resource Name (ARN) of the Amazon SNS topic used by the event notification subscription. *

    * * @param snsTopicArn * The Amazon Resource Name (ARN) of the Amazon SNS topic used by the event notification subscription. * @return Returns a reference to this object so that method calls can be chained together. */ Builder snsTopicArn(String snsTopicArn); /** *

    * The status of the Amazon Redshift event notification subscription. *

    *

    * Constraints: *

    *
      *
    • *

      * Can be one of the following: active | no-permission | topic-not-exist *

      *
    • *
    • *

      * The status "no-permission" indicates that Amazon Redshift no longer has permission to post to the Amazon SNS * topic. The status "topic-not-exist" indicates that the topic was deleted after the subscription was created. *

      *
    • *
    * * @param status * The status of the Amazon Redshift event notification subscription.

    *

    * Constraints: *

    *
      *
    • *

      * Can be one of the following: active | no-permission | topic-not-exist *

      *
    • *
    • *

      * The status "no-permission" indicates that Amazon Redshift no longer has permission to post to the * Amazon SNS topic. The status "topic-not-exist" indicates that the topic was deleted after the * subscription was created. *

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

      * The date and time the Amazon Redshift event notification subscription was created. *

      * * @param subscriptionCreationTime * The date and time the Amazon Redshift event notification subscription was created. * @return Returns a reference to this object so that method calls can be chained together. */ Builder subscriptionCreationTime(Instant subscriptionCreationTime); /** *

      * The source type of the events returned the Amazon Redshift event notification, such as cluster, or * cluster-snapshot. *

      * * @param sourceType * The source type of the events returned the Amazon Redshift event notification, such as cluster, or * cluster-snapshot. * @return Returns a reference to this object so that method calls can be chained together. */ Builder sourceType(String sourceType); /** *

      * A list of the sources that publish events to the Amazon Redshift event notification subscription. *

      * * @param sourceIdsList * A list of the sources that publish events to the Amazon Redshift event notification subscription. * @return Returns a reference to this object so that method calls can be chained together. */ Builder sourceIdsList(Collection sourceIdsList); /** *

      * A list of the sources that publish events to the Amazon Redshift event notification subscription. *

      * * @param sourceIdsList * A list of the sources that publish events to the Amazon Redshift event notification subscription. * @return Returns a reference to this object so that method calls can be chained together. */ Builder sourceIdsList(String... sourceIdsList); /** *

      * The list of Amazon Redshift event categories specified in the event notification subscription. *

      *

      * Values: Configuration, Management, Monitoring, Security *

      * * @param eventCategoriesList * The list of Amazon Redshift event categories specified in the event notification subscription.

      *

      * Values: Configuration, Management, Monitoring, Security * @return Returns a reference to this object so that method calls can be chained together. */ Builder eventCategoriesList(Collection eventCategoriesList); /** *

      * The list of Amazon Redshift event categories specified in the event notification subscription. *

      *

      * Values: Configuration, Management, Monitoring, Security *

      * * @param eventCategoriesList * The list of Amazon Redshift event categories specified in the event notification subscription.

      *

      * Values: Configuration, Management, Monitoring, Security * @return Returns a reference to this object so that method calls can be chained together. */ Builder eventCategoriesList(String... eventCategoriesList); /** *

      * The event severity specified in the Amazon Redshift event notification subscription. *

      *

      * Values: ERROR, INFO *

      * * @param severity * The event severity specified in the Amazon Redshift event notification subscription.

      *

      * Values: ERROR, INFO * @return Returns a reference to this object so that method calls can be chained together. */ Builder severity(String severity); /** *

      * A boolean value indicating whether the subscription is enabled; true indicates that the * subscription is enabled. *

      * * @param enabled * A boolean value indicating whether the subscription is enabled; true indicates that the * subscription is enabled. * @return Returns a reference to this object so that method calls can be chained together. */ Builder enabled(Boolean enabled); /** *

      * The list of tags for the event subscription. *

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

      * The list of tags for the event subscription. *

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

      * The list of tags for the event subscription. *

      * This is a convenience that creates an instance of the {@link List.Builder} avoiding the need to create * one manually via {@link List#builder()}. * * When the {@link Consumer} completes, {@link List.Builder#build()} is called immediately and its result * is passed to {@link #tags(List)}. * * @param tags * a consumer that will call methods on {@link List.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #tags(List) */ Builder tags(Consumer... tags); } static final class BuilderImpl implements Builder { private String customerAwsId; private String custSubscriptionId; private String snsTopicArn; private String status; private Instant subscriptionCreationTime; private String sourceType; private List sourceIdsList = DefaultSdkAutoConstructList.getInstance(); private List eventCategoriesList = DefaultSdkAutoConstructList.getInstance(); private String severity; private Boolean enabled; private List tags = DefaultSdkAutoConstructList.getInstance(); private BuilderImpl() { } private BuilderImpl(EventSubscription model) { customerAwsId(model.customerAwsId); custSubscriptionId(model.custSubscriptionId); snsTopicArn(model.snsTopicArn); status(model.status); subscriptionCreationTime(model.subscriptionCreationTime); sourceType(model.sourceType); sourceIdsList(model.sourceIdsList); eventCategoriesList(model.eventCategoriesList); severity(model.severity); enabled(model.enabled); tags(model.tags); } public final String getCustomerAwsId() { return customerAwsId; } @Override public final Builder customerAwsId(String customerAwsId) { this.customerAwsId = customerAwsId; return this; } public final void setCustomerAwsId(String customerAwsId) { this.customerAwsId = customerAwsId; } public final String getCustSubscriptionId() { return custSubscriptionId; } @Override public final Builder custSubscriptionId(String custSubscriptionId) { this.custSubscriptionId = custSubscriptionId; return this; } public final void setCustSubscriptionId(String custSubscriptionId) { this.custSubscriptionId = custSubscriptionId; } public final String getSnsTopicArn() { return snsTopicArn; } @Override public final Builder snsTopicArn(String snsTopicArn) { this.snsTopicArn = snsTopicArn; return this; } public final void setSnsTopicArn(String snsTopicArn) { this.snsTopicArn = snsTopicArn; } public final String getStatus() { return status; } @Override public final Builder status(String status) { this.status = status; return this; } public final void setStatus(String status) { this.status = status; } public final Instant getSubscriptionCreationTime() { return subscriptionCreationTime; } @Override public final Builder subscriptionCreationTime(Instant subscriptionCreationTime) { this.subscriptionCreationTime = subscriptionCreationTime; return this; } public final void setSubscriptionCreationTime(Instant subscriptionCreationTime) { this.subscriptionCreationTime = subscriptionCreationTime; } public final String getSourceType() { return sourceType; } @Override public final Builder sourceType(String sourceType) { this.sourceType = sourceType; return this; } public final void setSourceType(String sourceType) { this.sourceType = sourceType; } public final Collection getSourceIdsList() { return sourceIdsList; } @Override public final Builder sourceIdsList(Collection sourceIdsList) { this.sourceIdsList = SourceIdsListCopier.copy(sourceIdsList); return this; } @Override @SafeVarargs public final Builder sourceIdsList(String... sourceIdsList) { sourceIdsList(Arrays.asList(sourceIdsList)); return this; } public final void setSourceIdsList(Collection sourceIdsList) { this.sourceIdsList = SourceIdsListCopier.copy(sourceIdsList); } public final Collection getEventCategoriesList() { return eventCategoriesList; } @Override public final Builder eventCategoriesList(Collection eventCategoriesList) { this.eventCategoriesList = EventCategoriesListCopier.copy(eventCategoriesList); return this; } @Override @SafeVarargs public final Builder eventCategoriesList(String... eventCategoriesList) { eventCategoriesList(Arrays.asList(eventCategoriesList)); return this; } public final void setEventCategoriesList(Collection eventCategoriesList) { this.eventCategoriesList = EventCategoriesListCopier.copy(eventCategoriesList); } public final String getSeverity() { return severity; } @Override public final Builder severity(String severity) { this.severity = severity; return this; } public final void setSeverity(String severity) { this.severity = severity; } public final Boolean getEnabled() { return enabled; } @Override public final Builder enabled(Boolean enabled) { this.enabled = enabled; return this; } public final void setEnabled(Boolean enabled) { this.enabled = enabled; } public final Collection getTags() { return tags != null ? tags.stream().map(Tag::toBuilder).collect(Collectors.toList()) : null; } @Override public final Builder tags(Collection tags) { this.tags = TagListCopier.copy(tags); return this; } @Override @SafeVarargs public final Builder tags(Tag... tags) { tags(Arrays.asList(tags)); return this; } @Override @SafeVarargs public final Builder tags(Consumer... tags) { tags(Stream.of(tags).map(c -> Tag.builder().applyMutation(c).build()).collect(Collectors.toList())); return this; } public final void setTags(Collection tags) { this.tags = TagListCopier.copyFromBuilder(tags); } @Override public EventSubscription build() { return new EventSubscription(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy