RightAwsBase
# File lib/sns/right_sns_interface.rb, line 39 def self.bench_service @@bench.service end
# File lib/sns/right_sns_interface.rb, line 36 def self.bench_xml @@bench.xml end
# File lib/sns/right_sns_interface.rb, line 43 def initialize(aws_access_key_id=nil, aws_secret_access_key=nil, params={}) if params[:region] server = "sns.#{params[:region]}.amazonaws.com" params.delete(:region) else server = DEFAULT_HOST end init({ :name => 'SNS', :default_host => ENV['SNS_URL'] ? URI.parse(ENV['SNS_URL']).host : server, :default_port => ENV['SNS_URL'] ? URI.parse(ENV['SNS_URL']).port : DEFAULT_PORT, :default_service => ENV['SNS_URL'] ? URI.parse(ENV['SNS_URL']).path : DEFAULT_SERVICE, :default_protocol => ENV['SNS_URL'] ? URI.parse(ENV['SNS_URL']).scheme : DEFAULT_PROTOCOL}, aws_access_key_id || ENV['AWS_ACCESS_KEY_ID'], aws_secret_access_key || ENV['AWS_SECRET_ACCESS_KEY'], params) end
# File lib/sns/right_sns_interface.rb, line 171 def add_permission(topic_arn, label, acct_action_hash_ary) n_hash = { 'TopicArn' => topic_arn, 'Label' => label } acct_action_hash_ary.each_with_index do |hash_val, idx| n_hash["AWSAccountId.member.#{idx+1}"] = hash_val[:aws_account_id] n_hash["ActionName.member.#{idx+1}"] = hash_val[:action] end req_hash = generate_request('AddPermission', n_hash) request_info(req_hash, RightHttp2xxParser.new) end
# File lib/sns/right_sns_interface.rb, line 166 def confirm_subscription(topic_arn, token, authenticate_on_unsubscribe=false) req_hash = generate_request('ConfirmSubscription', 'AuthenticateOnUnsubscribe' => authenticate_on_unsubscribe.to_s, 'Token' => token, 'TopicArn' => topic_arn) request_info(req_hash, SnsConfirmSubscriptionParser.new) end
# File lib/sns/right_sns_interface.rb, line 117 def create_topic(topic_name) req_hash = generate_request('CreateTopic', 'Name' => topic_name) request_info(req_hash, SnsCreateTopicParser.new) end
# File lib/sns/right_sns_interface.rb, line 127 def delete_topic(topic_arn) req_hash = generate_request('DeleteTopic', 'TopicArn' => topic_arn) request_info(req_hash, RightHttp2xxParser.new) end
# File lib/sns/right_sns_interface.rb, line 155 def get_topic_attributes(topic_arn) req_hash = generate_request('GetTopicAttributes', 'TopicArn' => topic_arn) request_info(req_hash, SnsGetTopicAttributesParser.new) end
Calls either the ListSubscriptions or ListSubscriptionsByTopic depending on whether or not the topic_arn parameter is provided.
# File lib/sns/right_sns_interface.rb, line 161 def list_subscriptions(topic_arn = nil) req_hash = topic_arn ? generate_request('ListSubscriptionsByTopic', 'TopicArn' => topic_arn) : generate_request('ListSubscriptions') request_info(req_hash, SnsListSubscriptionsParser.new) end
# File lib/sns/right_sns_interface.rb, line 122 def list_topics() req_hash = generate_request('ListTopics') request_info(req_hash, SnsListTopicsParser.new) end
# File lib/sns/right_sns_interface.rb, line 142 def publish(topic_arn, message, subject) req_hash = generate_request('Publish', 'TopicArn' => topic_arn, 'Message' => message, 'Subject' => subject) request_info(req_hash, SnsPublishParser.new) end
# File lib/sns/right_sns_interface.rb, line 186 def remove_permission(topic_arn, label) req_hash = generate_request('RemovePermission', 'TopicArn' => topic_arn, 'Label' => label) request_info(req_hash, RightHttp2xxParser.new) end
# File lib/sns/right_sns_interface.rb, line 147 def set_topic_attribute(topic_arn, attribute_name, attribute_value) if attribute_name != 'Policy' && attribute_name != 'DisplayName' raise(ArgumentError, "The only values accepted for the attribute_name parameter are (Policy, DisplayName)") end req_hash = generate_request('SetTopicAttributes', 'TopicArn' => topic_arn, 'AttributeName' => attribute_name, 'AttributeValue' => attribute_value) request_info(req_hash, RightHttp2xxParser.new) end
# File lib/sns/right_sns_interface.rb, line 132 def subscribe(topic_arn, protocol, endpoint) req_hash = generate_request('Subscribe', 'TopicArn' => topic_arn, 'Protocol' => protocol, 'Endpoint' => endpoint) request_info(req_hash, SnsSubscribeParser.new) end
Generated with the Darkfish Rdoc Generator 2.