Class: OpsWorks::Permission
- Defined in:
- lib/opsworks/permission.rb
Instance Attribute Summary collapse
-
#iam_user_arn ⇒ Object
Returns the value of attribute iam_user_arn.
-
#id ⇒ Object
Returns the value of attribute id.
-
#ssh ⇒ Object
Returns the value of attribute ssh.
-
#stack_id ⇒ Object
Returns the value of attribute stack_id.
-
#sudo ⇒ Object
Returns the value of attribute sudo.
Attributes inherited from Resource
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Resource
Constructor Details
This class inherits a constructor from OpsWorks::Resource
Instance Attribute Details
#iam_user_arn ⇒ Object
Returns the value of attribute iam_user_arn.
3 4 5 |
# File 'lib/opsworks/permission.rb', line 3 def iam_user_arn @iam_user_arn end |
#id ⇒ Object
Returns the value of attribute id.
3 4 5 |
# File 'lib/opsworks/permission.rb', line 3 def id @id end |
#ssh ⇒ Object
Returns the value of attribute ssh.
3 4 5 |
# File 'lib/opsworks/permission.rb', line 3 def ssh @ssh end |
#stack_id ⇒ Object
Returns the value of attribute stack_id.
3 4 5 |
# File 'lib/opsworks/permission.rb', line 3 def stack_id @stack_id end |
#sudo ⇒ Object
Returns the value of attribute sudo.
3 4 5 |
# File 'lib/opsworks/permission.rb', line 3 def sudo @sudo end |
Class Method Details
.from_collection_response(client, response) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/opsworks/permission.rb', line 5 def self.from_collection_response(client, response) response.data[:permissions].map do || hash = .to_h new( client, id: hash[:permission_id], stack_id: hash[:stack_id], iam_user_arn: hash[:iam_user_arn], sudo: hash[:allow_sudo], ssh: hash[:allow_ssh] ) end end |
Instance Method Details
#ssh? ⇒ Boolean
23 24 25 |
# File 'lib/opsworks/permission.rb', line 23 def ssh? ssh end |
#sudo? ⇒ Boolean
27 28 29 |
# File 'lib/opsworks/permission.rb', line 27 def sudo? sudo end |
#update(options = {}) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/opsworks/permission.rb', line 31 def update( = {}) [:ssh] = ssh if [:ssh].nil? [:sudo] = sudo if [:sudo].nil? client.( stack_id: stack_id, iam_user_arn: iam_user_arn, allow_ssh: [:ssh], allow_sudo: [:sudo] ) self.ssh = [:ssh] self.sudo = [:sudo] end |
#user ⇒ Object
19 20 21 |
# File 'lib/opsworks/permission.rb', line 19 def user iam_user_arn.gsub(%r{^.*user/}, '') end |