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

software.amazon.awssdk.services.sns.model.Subscription Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Amazon SNS module holds the client classes that are used for communicating with Amazon Simple Notification Service

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

import java.io.Serializable;
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.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.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;

/**
 * 

* A wrapper type for the attributes of an Amazon SNS subscription. *

*/ @Generated("software.amazon.awssdk:codegen") public final class Subscription implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField SUBSCRIPTION_ARN_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("SubscriptionArn").getter(getter(Subscription::subscriptionArn)).setter(setter(Builder::subscriptionArn)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SubscriptionArn").build()).build(); private static final SdkField OWNER_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Owner") .getter(getter(Subscription::owner)).setter(setter(Builder::owner)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Owner").build()).build(); private static final SdkField PROTOCOL_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("Protocol").getter(getter(Subscription::protocol)).setter(setter(Builder::protocol)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Protocol").build()).build(); private static final SdkField ENDPOINT_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("Endpoint").getter(getter(Subscription::endpoint)).setter(setter(Builder::endpoint)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Endpoint").build()).build(); private static final SdkField TOPIC_ARN_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("TopicArn").getter(getter(Subscription::topicArn)).setter(setter(Builder::topicArn)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TopicArn").build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(SUBSCRIPTION_ARN_FIELD, OWNER_FIELD, PROTOCOL_FIELD, ENDPOINT_FIELD, TOPIC_ARN_FIELD)); private static final long serialVersionUID = 1L; private final String subscriptionArn; private final String owner; private final String protocol; private final String endpoint; private final String topicArn; private Subscription(BuilderImpl builder) { this.subscriptionArn = builder.subscriptionArn; this.owner = builder.owner; this.protocol = builder.protocol; this.endpoint = builder.endpoint; this.topicArn = builder.topicArn; } /** *

* The subscription's ARN. *

* * @return The subscription's ARN. */ public final String subscriptionArn() { return subscriptionArn; } /** *

* The subscription's owner. *

* * @return The subscription's owner. */ public final String owner() { return owner; } /** *

* The subscription's protocol. *

* * @return The subscription's protocol. */ public final String protocol() { return protocol; } /** *

* The subscription's endpoint (format depends on the protocol). *

* * @return The subscription's endpoint (format depends on the protocol). */ public final String endpoint() { return endpoint; } /** *

* The ARN of the subscription's topic. *

* * @return The ARN of the subscription's topic. */ public final String topicArn() { return topicArn; } @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(subscriptionArn()); hashCode = 31 * hashCode + Objects.hashCode(owner()); hashCode = 31 * hashCode + Objects.hashCode(protocol()); hashCode = 31 * hashCode + Objects.hashCode(endpoint()); hashCode = 31 * hashCode + Objects.hashCode(topicArn()); 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 Subscription)) { return false; } Subscription other = (Subscription) obj; return Objects.equals(subscriptionArn(), other.subscriptionArn()) && Objects.equals(owner(), other.owner()) && Objects.equals(protocol(), other.protocol()) && Objects.equals(endpoint(), other.endpoint()) && Objects.equals(topicArn(), other.topicArn()); } /** * 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("Subscription").add("SubscriptionArn", subscriptionArn()).add("Owner", owner()) .add("Protocol", protocol()).add("Endpoint", endpoint()).add("TopicArn", topicArn()).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "SubscriptionArn": return Optional.ofNullable(clazz.cast(subscriptionArn())); case "Owner": return Optional.ofNullable(clazz.cast(owner())); case "Protocol": return Optional.ofNullable(clazz.cast(protocol())); case "Endpoint": return Optional.ofNullable(clazz.cast(endpoint())); case "TopicArn": return Optional.ofNullable(clazz.cast(topicArn())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((Subscription) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The subscription's ARN. *

* * @param subscriptionArn * The subscription's ARN. * @return Returns a reference to this object so that method calls can be chained together. */ Builder subscriptionArn(String subscriptionArn); /** *

* The subscription's owner. *

* * @param owner * The subscription's owner. * @return Returns a reference to this object so that method calls can be chained together. */ Builder owner(String owner); /** *

* The subscription's protocol. *

* * @param protocol * The subscription's protocol. * @return Returns a reference to this object so that method calls can be chained together. */ Builder protocol(String protocol); /** *

* The subscription's endpoint (format depends on the protocol). *

* * @param endpoint * The subscription's endpoint (format depends on the protocol). * @return Returns a reference to this object so that method calls can be chained together. */ Builder endpoint(String endpoint); /** *

* The ARN of the subscription's topic. *

* * @param topicArn * The ARN of the subscription's topic. * @return Returns a reference to this object so that method calls can be chained together. */ Builder topicArn(String topicArn); } static final class BuilderImpl implements Builder { private String subscriptionArn; private String owner; private String protocol; private String endpoint; private String topicArn; private BuilderImpl() { } private BuilderImpl(Subscription model) { subscriptionArn(model.subscriptionArn); owner(model.owner); protocol(model.protocol); endpoint(model.endpoint); topicArn(model.topicArn); } public final String getSubscriptionArn() { return subscriptionArn; } public final void setSubscriptionArn(String subscriptionArn) { this.subscriptionArn = subscriptionArn; } @Override public final Builder subscriptionArn(String subscriptionArn) { this.subscriptionArn = subscriptionArn; return this; } public final String getOwner() { return owner; } public final void setOwner(String owner) { this.owner = owner; } @Override public final Builder owner(String owner) { this.owner = owner; return this; } public final String getProtocol() { return protocol; } public final void setProtocol(String protocol) { this.protocol = protocol; } @Override public final Builder protocol(String protocol) { this.protocol = protocol; return this; } public final String getEndpoint() { return endpoint; } public final void setEndpoint(String endpoint) { this.endpoint = endpoint; } @Override public final Builder endpoint(String endpoint) { this.endpoint = endpoint; return this; } public final String getTopicArn() { return topicArn; } public final void setTopicArn(String topicArn) { this.topicArn = topicArn; } @Override public final Builder topicArn(String topicArn) { this.topicArn = topicArn; return this; } @Override public Subscription build() { return new Subscription(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy