001
002package com.commercetools.api.models.subscription;
003
004import java.time.*;
005import java.util.*;
006
007import com.fasterxml.jackson.annotation.JsonCreator;
008import com.fasterxml.jackson.annotation.JsonProperty;
009import com.fasterxml.jackson.databind.annotation.*;
010
011import io.vrap.rmf.base.client.ModelBase;
012import io.vrap.rmf.base.client.utils.Generated;
013
014import org.apache.commons.lang3.builder.EqualsBuilder;
015import org.apache.commons.lang3.builder.HashCodeBuilder;
016
017/**
018 *  <p>AWS SNS can be used to push messages to AWS Lambda, HTTP endpoints (webhooks), or fan-out messages to SQS queues. The SQS queue must be a Standard queue type.</p>
019 *  <p>We recommend setting <code>authenticationMode</code> to <code>IAM</code>, to avoid unnecessary key management. For IAM authentication and before creating the Subscription, give permissions to the following user account: <code>arn:aws-cn:iam::417094354346:user/subscriptions</code> if the Project is hosted in the China (AWS, Ningxia) Region; <code>arn:aws:iam::362576667341:user/subscriptions</code> for all other Regions. Otherwise, a test message will not be sent.</p>
020 *  <p>If you prefer to use <code>Credentials</code> for authentication, we recommend creating an IAM user with an <code>accessKey</code> and <code>accessSecret</code> pair specifically for each Subscription.</p>
021 *  <p>The IAM user should only have the <code>sns:Publish</code> permission on this topic.</p>
022 */
023@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
024public class SnsDestinationImpl implements SnsDestination, ModelBase {
025
026    private String type;
027
028    private String accessKey;
029
030    private String accessSecret;
031
032    private String topicArn;
033
034    private com.commercetools.api.models.subscription.AwsAuthenticationMode authenticationMode;
035
036    /**
037     * create instance with all properties
038     */
039    @JsonCreator
040    SnsDestinationImpl(@JsonProperty("accessKey") final String accessKey,
041            @JsonProperty("accessSecret") final String accessSecret, @JsonProperty("topicArn") final String topicArn,
042            @JsonProperty("authenticationMode") final com.commercetools.api.models.subscription.AwsAuthenticationMode authenticationMode) {
043        this.accessKey = accessKey;
044        this.accessSecret = accessSecret;
045        this.topicArn = topicArn;
046        this.authenticationMode = authenticationMode;
047        this.type = SNS;
048    }
049
050    /**
051     * create empty instance
052     */
053    public SnsDestinationImpl() {
054        this.type = SNS;
055    }
056
057    /**
058     *
059     */
060
061    public String getType() {
062        return this.type;
063    }
064
065    /**
066     *  <p>Only present if <code>authenticationMode</code> is set to <code>Credentials</code>.</p>
067     */
068
069    public String getAccessKey() {
070        return this.accessKey;
071    }
072
073    /**
074     *  <p>Only present if <code>authenticationMode</code> is set to <code>Credentials</code>.</p>
075     */
076
077    public String getAccessSecret() {
078        return this.accessSecret;
079    }
080
081    /**
082     *  <p>Amazon Resource Name (ARN) of the topic.</p>
083     */
084
085    public String getTopicArn() {
086        return this.topicArn;
087    }
088
089    /**
090     *  <p>Defines the method of authentication for the SNS topic.</p>
091     */
092
093    public com.commercetools.api.models.subscription.AwsAuthenticationMode getAuthenticationMode() {
094        return this.authenticationMode;
095    }
096
097    public void setAccessKey(final String accessKey) {
098        this.accessKey = accessKey;
099    }
100
101    public void setAccessSecret(final String accessSecret) {
102        this.accessSecret = accessSecret;
103    }
104
105    public void setTopicArn(final String topicArn) {
106        this.topicArn = topicArn;
107    }
108
109    public void setAuthenticationMode(
110            final com.commercetools.api.models.subscription.AwsAuthenticationMode authenticationMode) {
111        this.authenticationMode = authenticationMode;
112    }
113
114    @Override
115    public boolean equals(Object o) {
116        if (this == o)
117            return true;
118
119        if (o == null || getClass() != o.getClass())
120            return false;
121
122        SnsDestinationImpl that = (SnsDestinationImpl) o;
123
124        return new EqualsBuilder().append(type, that.type)
125                .append(accessKey, that.accessKey)
126                .append(accessSecret, that.accessSecret)
127                .append(topicArn, that.topicArn)
128                .append(authenticationMode, that.authenticationMode)
129                .isEquals();
130    }
131
132    @Override
133    public int hashCode() {
134        return new HashCodeBuilder(17, 37).append(type)
135                .append(accessKey)
136                .append(accessSecret)
137                .append(topicArn)
138                .append(authenticationMode)
139                .toHashCode();
140    }
141
142}