Class: Fastlane::Actions::AwsSnsTopicAction

Inherits:
Action
  • Object
show all
Defined in:
lib/fastlane/plugin/aws_sns_topic/actions/aws_sns_topic_action.rb

Class Method Summary collapse

Class Method Details

.authorsObject



31
32
33
# File 'lib/fastlane/plugin/aws_sns_topic/actions/aws_sns_topic_action.rb', line 31

def self.authors
  ["Levi Bostian"]
end

.available_optionsObject



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# 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

.descriptionObject



27
28
29
# 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

.detailsObject



39
40
41
# 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) ⇒ Boolean

Returns:

  • (Boolean)


78
79
80
81
82
83
84
# 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_valueObject



35
36
37
# 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) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# 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