class Cumulus::SQS::DeadLetterConfig
Public: An object representing configuration for a queue's dead letter options
Attributes
max_receives[R]
target[R]
Public Class Methods
new(json = nil)
click to toggle source
Public: Constructor
json - a hash containing the JSON configuration for dead letter options
# File lib/sqs/models/DeadLetterConfig.rb, line 16 def initialize(json = nil) if !json.nil? @target = json["target"] @max_receives = json["max-receives"] end end
Public Instance Methods
diff(aws)
click to toggle source
Public: Produce an array of differences between two DeadLetterConfig
objects
aws - the DeadLetterConfig
object built from aws config
Returns an array of the DeadLetterDiffs that were found
# File lib/sqs/models/DeadLetterConfig.rb, line 54 def diff(aws) diffs = [] if @target != aws.target diffs << DeadLetterDiff.new(DeadLetterChange::TARGET, aws.target, @target) end if @max_receives != aws.max_receives diffs << DeadLetterDiff.new(DeadLetterChange::RECEIVE, aws.max_receives, @max_receives) end diffs end
populate!(aws)
click to toggle source
Public: Populate a config object with AWS configuration
aws - the JSON string containing dead letter attributes in AWS
# File lib/sqs/models/DeadLetterConfig.rb, line 40 def populate!(aws) attributes = JSON.parse(URI.decode(aws)) @target = SQS::queue_arns.key(attributes["deadLetterTargetArn"]) @max_receives = if attributes["maxReceiveCount"] then attributes["maxReceiveCount"].to_i end self end
to_aws()
click to toggle source
# File lib/sqs/models/DeadLetterConfig.rb, line 30 def to_aws { "deadLetterTargetArn" => SQS::queue_arns[@target], "maxReceiveCount" => @max_receives } end
to_hash()
click to toggle source
# File lib/sqs/models/DeadLetterConfig.rb, line 23 def to_hash { "target" => @target, "max-receives" => @max_receives, } end