Class: AWSEdges::IAM
- Inherits:
-
Object
- Object
- AWSEdges::IAM
- Defined in:
- lib/aws-edges/iam.rb
Instance Attribute Summary collapse
-
#nodes ⇒ Object
readonly
Returns the value of attribute nodes.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(iam) ⇒ IAM
constructor
A new instance of IAM.
Constructor Details
#initialize(iam) ⇒ IAM
Returns a new instance of IAM.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 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/aws-edges/iam.rb', line 5 def initialize(iam) @nodes = Array.new # get IAM groups iam.list_groups[:groups].each{|g| @nodes.push({ :group_name => g[:group_name], :group_id => g[:group_id], :group_arn => g[:arn], :group_create_date => g[:create_date], :users => [], :group_policies => [] }) # get group members assigned_users = Array.new iam.get_group( = {:group_name => g[:group_name]})[:users].each {|u| assigned_users.push({ :user_name => u[:user_name], :user_id => u[:user_id], :arn => u[:arn], :path => u[:path], :create_date => u[:create_date], }) } @nodes[@nodes.length - 1][:users] = assigned_users # get group policies assigned_policies = Array.new iam.list_group_policies( = {:group_name => g[:group_name]})[:policy_names].each {|p| assigned_policies.push({ :policy_name => p }) } @nodes[@nodes.length - 1][:group_policies] = assigned_policies } # get IAM users iam.list_users[:users].each{|u| @nodes.push({ :user_name => u[:user_name], :user_id => u[:user_id], :user_arn => u[:arn], :user_path => u[:path], :user_create_date => u[:create_date], :groups => [], :user_policies => [] }) # get membership assigned_groups = Array.new iam.list_groups_for_user( = {:user_name => u[:user_name]})[:groups].each {|g| assigned_groups.push({ :path => g[:path], :group_name => g[:group_name], :group_id => g[:group_id], :arn => g[:arn], :create_date => g[:create_date] }) } @nodes[@nodes.length - 1][:groups] = assigned_groups # get user policies assigned_policies = Array.new iam.list_user_policies( = {:user_name => u[:user_name]})[:policy_names].each {|p| assigned_policies.push({ :policy_name => p }) } @nodes[@nodes.length - 1][:user_policies] = assigned_policies } end |
Instance Attribute Details
#nodes ⇒ Object (readonly)
Returns the value of attribute nodes.
3 4 5 |
# File 'lib/aws-edges/iam.rb', line 3 def nodes @nodes end |
Class Method Details
.supported_fields ⇒ Object
78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/aws-edges/iam.rb', line 78 def self.supported_fields [ "group_path", "group_name", "group_id", "group_arn", "group_create_date", "users-path", "users-user_name", "users-user_id", "users-arn", "users-create_date", "group_policies-policy_name", "user_path", "user_name", "user_id", "user_arn", "user_create_date", "groups-path", "groups-group_name", "groups-group_id", "groups-arn", "groups-create_date", "user_policies-policy_name" ] end |