Sha256: 24c6b16c8e37a3c5a4149c081f2b1673e5259a68b54fe325b88db684820a0125
Contents?: true
Size: 982 Bytes
Versions: 9
Compression:
Stored size: 982 Bytes
Contents
require 'opsworks/resource' module OpsWorks class Permission < Resource attr_accessor :id, :stack_id, :iam_user_arn, :ssh, :sudo def self.from_collection_response(response) response.data[:permissions].map do |hash| new( 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 def user iam_user_arn.gsub(%r{^.*user/}, '') end def ssh? ssh end def sudo? sudo end def update(options = {}) options[:ssh] = ssh if options[:ssh].nil? options[:sudo] = sudo if options[:sudo].nil? self.class.client.set_permission( stack_id: stack_id, iam_user_arn: iam_user_arn, allow_ssh: options[:ssh], allow_sudo: options[:sudo] ) self.ssh = options[:ssh] self.sudo = options[:sudo] end end end
Version data entries
9 entries across 9 versions & 1 rubygems