Module: Chef::Handler::Sns::Config
- Extended by:
- Config
- Includes:
- Mixin::ParamsValidate
- Included in:
- Chef::Handler::Sns, Config
- Defined in:
- lib/chef/handler/sns/config.rb
Constant Summary collapse
- REQUIRED =
[ 'access_key', 'secret_key', 'topic_arn' ]
Instance Method Summary collapse
- #access_key(arg = nil) ⇒ Object
- #body_template(arg = nil) ⇒ Object
- #config_check ⇒ Object
- #config_init(config = {}) ⇒ Object
- #region(arg = nil) ⇒ Object
- #secret_key(arg = nil) ⇒ Object
- #subject(arg = nil) ⇒ Object
- #token(arg = nil) ⇒ Object
- #topic_arn(arg = nil) ⇒ Object
Instance Method Details
#access_key(arg = nil) ⇒ Object
55 56 57 58 59 60 61 |
# File 'lib/chef/handler/sns/config.rb', line 55 def access_key(arg=nil) set_or_return( :access_key, arg, :kind_of => String ) end |
#body_template(arg = nil) ⇒ Object
103 104 105 106 107 108 109 |
# File 'lib/chef/handler/sns/config.rb', line 103 def body_template(arg=nil) set_or_return( :body_template, arg, :kind_of => String ) end |
#config_check ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/chef/handler/sns/config.rb', line 41 def config_check REQUIRED.each do |key| if self.send(key).nil? raise Exceptions::ValidationFailed, "Required argument #{key.to_s} is missing!" end end if body_template and not ::File.exists?(body_template) raise Exceptions::ValidationFailed, "Template file not found: #{body_template}." end end |
#config_init(config = {}) ⇒ Object
31 32 33 34 35 36 37 38 39 |
# File 'lib/chef/handler/sns/config.rb', line 31 def config_init(config={}) config.each do |key, value| if Config.respond_to?(key) and not /^config_/ =~ key.to_s self.send(key, value) else Chef::Log.warn("#{self.class.to_s}: configuration method not found: #{key}.") end end end |
#region(arg = nil) ⇒ Object
71 72 73 74 75 76 77 |
# File 'lib/chef/handler/sns/config.rb', line 71 def region(arg=nil) set_or_return( :region, arg, :kind_of => String ) end |
#secret_key(arg = nil) ⇒ Object
63 64 65 66 67 68 69 |
# File 'lib/chef/handler/sns/config.rb', line 63 def secret_key(arg=nil) set_or_return( :secret_key, arg, :kind_of => String ) end |
#subject(arg = nil) ⇒ Object
95 96 97 98 99 100 101 |
# File 'lib/chef/handler/sns/config.rb', line 95 def subject(arg=nil) set_or_return( :subject, arg, :kind_of => String ) end |
#token(arg = nil) ⇒ Object
79 80 81 82 83 84 85 |
# File 'lib/chef/handler/sns/config.rb', line 79 def token(arg=nil) set_or_return( :token, arg, :kind_of => String ) end |
#topic_arn(arg = nil) ⇒ Object
87 88 89 90 91 92 93 |
# File 'lib/chef/handler/sns/config.rb', line 87 def topic_arn(arg=nil) set_or_return( :topic_arn, arg, :kind_of => String ) end |