class Fastlane::Actions::AwsSnsTopicAction

Public Class Methods

authors() click to toggle source
# File lib/fastlane/plugin/aws_sns_topic/actions/aws_sns_topic_action.rb, line 31
def self.authors
  ["Levi Bostian"]
end
available_options() click to toggle source
# File lib/fastlane/plugin/aws_sns_topic/actions/aws_sns_topic_action.rb, line 43
def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :access_key,
                                 env_name: "AWS_SNS_ACCESS_KEY",
                                 description: "AWS Access Key ID",
                                 optional: false,
                                 default_value: ENV['AWS_ACCESS_KEY_ID']),
    FastlaneCore::ConfigItem.new(key: :secret_access_key,
                                 env_name: "AWS_SNS_SECRET_ACCESS_KEY",
                                 description: "AWS Secret Access Key",
                                 optional: false,
                                 default_value: ENV['AWS_SECRET_ACCESS_KEY']),
    FastlaneCore::ConfigItem.new(key: :region,
                                 env_name: "AWS_SNS_REGION",
                                 description: "AWS Region",
                                 optional: false,
                                 default_value: ENV['AWS_REGION']),
    FastlaneCore::ConfigItem.new(key: :topic_arn,
                                 env_name: "AWS_SNS_TOPIC_ARN",
                                 description: "AWS SNS topic ARN for the topic to send message to",
                                 optional: false,
                                 default_value: ENV['AWS_SNS_TOPIC_ARN']),
    FastlaneCore::ConfigItem.new(key: :message,
                                 env_name: "AWS_SNS_TOPIC_MESSAGE",
                                 description: "The message you want to send to the AWS SNS topic",
                                 optional: false,
                                 default_value: ENV['AWS_SNS_TOPIC_MESSAGE']),
    FastlaneCore::ConfigItem.new(key: :subject,
                                 env_name: "AWS_SNS_TOPIC_SUBJECT",
                                 description: "The subject you want to send to the AWS SNS topic",
                                 optional: false,
                                 default_value: ENV['AWS_SNS_TOPIC_SUBJECT'])
  ]
end
description() click to toggle source
# File lib/fastlane/plugin/aws_sns_topic/actions/aws_sns_topic_action.rb, line 27
def self.description
  "Public a message to a AWS SNS topic."
end
details() click to toggle source
# File lib/fastlane/plugin/aws_sns_topic/actions/aws_sns_topic_action.rb, line 39
def self.details
  "Public a new message to an AWS SNS topic. Created with the original intent of notifying a SNS topic about a new app release."
end
is_supported?(platform) click to toggle source
# File lib/fastlane/plugin/aws_sns_topic/actions/aws_sns_topic_action.rb, line 78
def self.is_supported?(platform)
  # Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example)
  # See: https://docs.fastlane.tools/advanced/#control-configuration-by-lane-and-by-platform
  #
  # [:ios, :mac, :android].include?(platform)
  true
end
return_value() click to toggle source
# File lib/fastlane/plugin/aws_sns_topic/actions/aws_sns_topic_action.rb, line 35
def self.return_value
  # If your method provides a return value, you can describe here what it does
end
run(params) click to toggle source
# File lib/fastlane/plugin/aws_sns_topic/actions/aws_sns_topic_action.rb, line 9
def self.run(params)
  access_key = params[:access_key]
  secret_access_key = params[:secret_access_key]
  region = params[:region]

  topic_arn = params[:topic_arn]
  message = params[:message]
  subject = params[:subject]

  Helper::AwsSnsTopicHelper.verify_params(params, [:access_key, :secret_access_key, :region, :topic_arn, :message, :subject])

  topic_sender = Helper::AwsSns.new(access_key, secret_access_key, region, topic_arn)

  UI.message("Sending message to SNS topic...")
  topic_sender.publish_message(message, subject)
  UI.success("AWS SNS Topic message sent!")
end