Class: Cumulus::IAM::GroupConfig
- Inherits:
-
ResourceWithPolicy
- Object
- ResourceWithPolicy
- Cumulus::IAM::GroupConfig
- Defined in:
- lib/iam/models/GroupConfig.rb
Overview
Public: Represents a config file for a group
Instance Attribute Summary collapse
-
#users ⇒ Object
Returns the value of attribute users.
Attributes inherited from ResourceWithPolicy
#attached_policies, #inlines, #name, #statics, #type
Instance Method Summary collapse
-
#diff(aws_resource) ⇒ Object
override diff to check for changes in users.
-
#initialize(name = nil, json = nil) ⇒ GroupConfig
constructor
Public: Constructor.
Methods inherited from ResourceWithPolicy
#generated_policy_name, #hash, #json, #policy
Constructor Details
#initialize(name = nil, json = nil) ⇒ GroupConfig
Public: Constructor
name - the name of the group json - the Hash containing the JSON configuration for this GroupConfig, if
nil, this will be an "empty GroupConfig"
17 18 19 20 21 |
# File 'lib/iam/models/GroupConfig.rb', line 17 def initialize(name = nil, json = nil) super(name, json) @type = "group" @users = json["users"] unless json.nil? end |
Instance Attribute Details
#users ⇒ Object
Returns the value of attribute users.
10 11 12 |
# File 'lib/iam/models/GroupConfig.rb', line 10 def users @users end |
Instance Method Details
#diff(aws_resource) ⇒ Object
override diff to check for changes in users
24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/iam/models/GroupConfig.rb', line 24 def diff(aws_resource) differences = super(aws_resource) aws_users = aws_resource.users.map { |user| user.name } new_users = @users.select { |local| !aws_users.include?(local) } unmanaged = aws_users.select { |aws| !@users.include?(aws) } if !unmanaged.empty? or !new_users.empty? differences << IamDiff.users(new_users, unmanaged) end differences end |