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 SQS is a pull-queue on AWS. The queue must be a Standard queue type with a <code>MaximumMessageSize</code> of <code>256 KB</code>.</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>sqs:SendMessage</code> permission on this queue.</p> 022 */ 023@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") 024public class SqsDestinationImpl implements SqsDestination, ModelBase { 025 026 private String type; 027 028 private String accessKey; 029 030 private String accessSecret; 031 032 private String queueUrl; 033 034 private String region; 035 036 private com.commercetools.api.models.subscription.AwsAuthenticationMode authenticationMode; 037 038 /** 039 * create instance with all properties 040 */ 041 @JsonCreator 042 SqsDestinationImpl(@JsonProperty("accessKey") final String accessKey, 043 @JsonProperty("accessSecret") final String accessSecret, @JsonProperty("queueUrl") final String queueUrl, 044 @JsonProperty("region") final String region, 045 @JsonProperty("authenticationMode") final com.commercetools.api.models.subscription.AwsAuthenticationMode authenticationMode) { 046 this.accessKey = accessKey; 047 this.accessSecret = accessSecret; 048 this.queueUrl = queueUrl; 049 this.region = region; 050 this.authenticationMode = authenticationMode; 051 this.type = SQS; 052 } 053 054 /** 055 * create empty instance 056 */ 057 public SqsDestinationImpl() { 058 this.type = SQS; 059 } 060 061 /** 062 * 063 */ 064 065 public String getType() { 066 return this.type; 067 } 068 069 /** 070 * <p>Only present if <code>authenticationMode</code> is set to <code>Credentials</code>.</p> 071 */ 072 073 public String getAccessKey() { 074 return this.accessKey; 075 } 076 077 /** 078 * <p>Only present if <code>authenticationMode</code> is set to <code>Credentials</code>.</p> 079 */ 080 081 public String getAccessSecret() { 082 return this.accessSecret; 083 } 084 085 /** 086 * <p>URL of the Amazon SQS queue.</p> 087 */ 088 089 public String getQueueUrl() { 090 return this.queueUrl; 091 } 092 093 /** 094 * <p>AWS Region the message queue is located in.</p> 095 */ 096 097 public String getRegion() { 098 return this.region; 099 } 100 101 /** 102 * <p>Defines the method of authentication for the SQS queue.</p> 103 */ 104 105 public com.commercetools.api.models.subscription.AwsAuthenticationMode getAuthenticationMode() { 106 return this.authenticationMode; 107 } 108 109 public void setAccessKey(final String accessKey) { 110 this.accessKey = accessKey; 111 } 112 113 public void setAccessSecret(final String accessSecret) { 114 this.accessSecret = accessSecret; 115 } 116 117 public void setQueueUrl(final String queueUrl) { 118 this.queueUrl = queueUrl; 119 } 120 121 public void setRegion(final String region) { 122 this.region = region; 123 } 124 125 public void setAuthenticationMode( 126 final com.commercetools.api.models.subscription.AwsAuthenticationMode authenticationMode) { 127 this.authenticationMode = authenticationMode; 128 } 129 130 @Override 131 public boolean equals(Object o) { 132 if (this == o) 133 return true; 134 135 if (o == null || getClass() != o.getClass()) 136 return false; 137 138 SqsDestinationImpl that = (SqsDestinationImpl) o; 139 140 return new EqualsBuilder().append(type, that.type) 141 .append(accessKey, that.accessKey) 142 .append(accessSecret, that.accessSecret) 143 .append(queueUrl, that.queueUrl) 144 .append(region, that.region) 145 .append(authenticationMode, that.authenticationMode) 146 .isEquals(); 147 } 148 149 @Override 150 public int hashCode() { 151 return new HashCodeBuilder(17, 37).append(type) 152 .append(accessKey) 153 .append(accessSecret) 154 .append(queueUrl) 155 .append(region) 156 .append(authenticationMode) 157 .toHashCode(); 158 } 159 160}