AWS SNS Ruby SDK Cannot Sign Application Endpoint

The Ruby SDK is a little confusing as the docs have two subscription methods. One of them is outdated, now I believe here .

Class: AWS :: SNS :: Client

Another is the intended method, as it says in the source code: # To create a subscription, use the {Topic#subscribe} method.

But in the code it points to, those passed in the parameters go through a filtering process that prevents me from specifying the protocol application

.

def endpoint_opts (endpoint, opts = {})

    case
    when endpoint.is_a?(SQS::Queue)

      # auto add a policy to the queue to allow the topic
      # to send the queue messages
      unless opts[:update_policy] == false
        policy = endpoint.policy || SQS::Policy.new
        policy.allow(
          :principal => :any,
          :actions => [:send_message],
          :resources => [endpoint]
        ).where(:source_arn).is(arn)
        endpoint.policy = policy
      end

      { :protocol => 'sqs', :endpoint => endpoint.arn }

    when endpoint =~ /^arn:/

      ################################################# 
      THIS IS WHAT FILTERS IT, I get this error
      ################################################# 
      raise ArgumentError, "expected a queue ARN" unless
        endpoint =~ /^arn:aws(.*?):sqs:/
      { :protocol => "sqs", :endpoint => endpoint }
    when endpoint.kind_of?(URI)
      { :protocol => endpoint.scheme,
        :endpoint => endpoint.to_s }
    when endpoint =~ /^(https?):/
      { :protocol => $1, :endpoint => endpoint }
    when endpoint.include?("@")
      { :protocol => opts[:json] ? "email-json" : "email",
        :endpoint => endpoint }
    when endpoint.gsub(/\D/,'') =~ /\d{11,15}/
      { :protocol => "sms", :endpoint => endpoint.gsub(/\D/,'') }
    else
      raise ArgumentError, "could not determine protocol for '#{endpoint}'"
    end
  end

      

and the documentation does not specify a way to do it either as it lists all the protocols other than the application.

So ... It looks like the protocol option application

is being filtered on purpose, or someone is not writing very good tests :) Is there a way to use the AWS SDK to subscribe endpoints from a topic app? Am I missing something big here? Please, help!

+3
ruby ruby-on-rails sdk amazon-web-services amazon-sns


source to share


No one has answered this question yet

Check out similar questions:

1998
How to write a switch statement in Ruby
1339
How can I rename a database column in Ruby on Rails migrations?
1165
Check if value exists in array in Ruby
1116
Android SDK installation not finding JDK
1023
How do I get the current absolute url in Ruby on Rails?
978
What is attr_accessor in Ruby?
876
Brief explanation of nil v. Empty v. Blank in Ruby on Rails
771
How to get a random number in Ruby
1
SNS - Topic subscription not required for confirmation?
1
AWS SNS - How do I subscribe to an endpoint in a topic using "application" as the protocol?



All Articles
Loading...
X
Show
Funny
Dev
Pics