Class: ElasticWhenever::Task::Role
- Inherits:
-
Object
- Object
- ElasticWhenever::Task::Role
- Defined in:
- lib/elastic_whenever/task/role.rb
Constant Summary collapse
- NAME =
"ecsEventsRole"
Instance Method Summary collapse
- #arn ⇒ Object
- #create ⇒ Object
- #exists? ⇒ Boolean
-
#initialize(option) ⇒ Role
constructor
A new instance of Role.
Constructor Details
Instance Method Details
#arn ⇒ Object
28 29 30 |
# File 'lib/elastic_whenever/task/role.rb', line 28 def arn role&.arn end |
#create ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/elastic_whenever/task/role.rb', line 12 def create @role = resource.create_role( role_name: NAME, assume_role_policy_document: role_json, ) role.attach_policy( policy_arn: "arn:aws:iam::aws:policy/service-role/AmazonEC2ContainerServiceEventsRole" ) end |
#exists? ⇒ Boolean
22 23 24 25 26 |
# File 'lib/elastic_whenever/task/role.rb', line 22 def exists? !!arn rescue Aws::IAM::Errors::NoSuchEntity false end |