class AWS::SimpleEmailService::Identity
@attr_reader [String] verification_status
@attr_reader [String,nil] verification_token
@attr [String] bounce_topic_arn
@attr [String] complaint_topic_arn
@attr [Boolean] forwarding_enabled When ‘false`, complaint and bounce
notifications will not be forwarded via email. Can only be set to `false` when there is both a `bounce_topic` and `complaint_topic`.
@attr [Boolean] dkim_enabled When set to ‘true`, Easy DKIM signing will
be enabled for email sent from this identity.
@attr_reader [Array<String>] dkim_tokens Returns a set of DNS records,
or tokens, that must be published in the domain name's DNS to complete the DKIM verification process. Call {#verify_dkim} if this returns an empty list.
@attr_reader [String] dkim_verification_status
Attributes
@return [String] Returns the email address or domain name for
this identity.
Public Class Methods
@api private
AWS::Core::Resource::new
# File lib/aws/simple_email_service/identity.rb, line 42 def initialize email_address_or_domain, options = {} @identity = email_address_or_domain super end
Public Instance Methods
@return [SNS::Topic,nil]
# File lib/aws/simple_email_service/identity.rb, line 124 def bounce_topic if arn = bounce_topic_arn SNS::Topic.new(arn, :config => config) end end
@param [String,SNS::Topic] topic The topic (ARN string or topic
object) that bounce notifications should be published to.
# File lib/aws/simple_email_service/identity.rb, line 118 def bounce_topic= topic arn = topic.respond_to?(:arn) ? topic.arn : topic self.bounce_topic_arn = arn end
@return [SNS::Topic,nil]
# File lib/aws/simple_email_service/identity.rb, line 138 def complaint_topic if arn = complaint_topic_arn SNS::Topic.new(arn, :config => config) end end
@param [String,SNS::Topic] topic The topic (ARN string or topic
object) that complaint notifications should be published to.
# File lib/aws/simple_email_service/identity.rb, line 132 def complaint_topic= topic arn = topic.respond_to?(:arn) ? topic.arn : topic self.complaint_topic_arn = arn end
Deletes the current identity. @return [nil]
# File lib/aws/simple_email_service/identity.rb, line 170 def delete client.delete_identity(:identity => identity) nil end
@return [SNS::Topic,nil]
# File lib/aws/simple_email_service/identity.rb, line 110 def delivery_topic if arn = delivery_topic_arn SNS::Topic.new(arn, :config => config) end end
@param [String,SNS::Topic] topic The topic (ARN string or topic
object) that delivery notifications should be published to.
# File lib/aws/simple_email_service/identity.rb, line 104 def delivery_topic= topic arn = topic.respond_to?(:arn) ? topic.arn : topic self.delivery_topic_arn = arn end
@return [Boolean] Returns ‘true` if this {Identity} represents a
domain.
# File lib/aws/simple_email_service/identity.rb, line 152 def domain? !email_address? end
@return [Boolean] Returns ‘true` if this {Identity} represents an
email address.
# File lib/aws/simple_email_service/identity.rb, line 146 def email_address? identity.match(/@/) ? true : false end
@return [Boolean] Returns true if the identity exists.
# File lib/aws/simple_email_service/identity.rb, line 176 def exists? options = { :identities => [identity] } resp = client.get_identity_verification_attributes(options) !!resp[:verification_attributes][identity] end
@return [Boolean] Returns ‘true` if verification for this email
address/domain is still pending.
# File lib/aws/simple_email_service/identity.rb, line 164 def pending? verification_status == 'Pending' end
@return [Boolean] Returns ‘true` if this email address/domain has
been verified.
# File lib/aws/simple_email_service/identity.rb, line 158 def verified? verification_status == 'Success' end
@return [Array<String>] Returns an array of DKIM tokens.
# File lib/aws/simple_email_service/identity.rb, line 93 def verify_dkim if domain? resp = client.verify_domain_dkim(:domain => identity) resp[:dkim_tokens] else raise "unable to verify dkim for an email address" end end
Protected Instance Methods
# File lib/aws/simple_email_service/identity.rb, line 188 def get_resource attr method_name = case attr.name.to_s when /dkim/ then :get_identity_dkim_attributes when /verification/ then :get_identity_verification_attributes else :get_identity_notification_attributes end client.send(method_name, :identities => [identity]) end
# File lib/aws/simple_email_service/identity.rb, line 184 def resource_identifiers [[:identity, identity]] end
# File lib/aws/simple_email_service/identity.rb, line 201 def update_resource attr, value client_opts = {} client_opts[:identity] = identity case attr.name when :delivery_topic_arn method = :set_identity_notification_topic client_opts[:notification_type] = 'Delivery' client_opts[:sns_topic] = value if value when :bounce_topic_arn method = :set_identity_notification_topic client_opts[:notification_type] = 'Bounce' client_opts[:sns_topic] = value if value when :complaint_topic_arn method = :set_identity_notification_topic client_opts[:notification_type] = 'Complaint' client_opts[:sns_topic] = value if value when :forwarding_enabled method = :set_identity_feedback_forwarding_enabled client_opts[:forwarding_enabled] = value when :dkim_enabled method = :set_identity_dkim_enabled client_opts[:dkim_enabled] = value else raise "unhandled attribute: #{attr.name}" end client.send(method, client_opts) end