Class: AWS::IAM::Group
- Inherits:
-
Resource
- Object
- Core::Resource
- Resource
- AWS::IAM::Group
- Defined in:
- lib/aws/iam/group.rb
Overview
Represents a group of users. Groups don’t directly interact with AWS; only users do. The main reason to create groups is to collectively assign permissions to the users so they can do their jobs. For example, you could have a group called Admins and give that group the types of permissions admins typically need.
Instance Attribute Summary collapse
-
#arn ⇒ String
readonly
The group’s ARN (Amazon Resource Name).
-
#create_date ⇒ Time
readonly
When the group was created.
-
#id ⇒ String
readonly
The group’s unique ID.
-
#name ⇒ String
The group’s name.
-
#path ⇒ String
The group’s path.
Attributes included from Core::Model
Instance Method Summary collapse
-
#delete ⇒ Object
Deletes the group.
-
#exists? ⇒ Boolean
True if the resource exists.
-
#initialize(name, options = {}) ⇒ Group
constructor
A new instance of Group.
-
#policies ⇒ GroupPolicyCollection
Provides access to the policies associated with the group.
-
#users ⇒ GroupUserCollection
Provides access to the users in the group.
Methods inherited from Resource
prefix_update_attributes, update_prefix
Methods inherited from Core::Resource
attribute_providers, attribute_providers_for, attributes, #attributes_from_response, define_attribute_type, #eql?, #inspect, new_from
Methods included from Core::Cacheable
Methods included from Core::Model
#client, #config_prefix, #inspect
Constructor Details
#initialize(name, options = {}) ⇒ Group
Returns a new instance of Group.
34 35 36 37 |
# File 'lib/aws/iam/group.rb', line 34 def initialize(name, = {}) [:name] = name super end |
Instance Attribute Details
#arn ⇒ String (readonly)
The group’s ARN (Amazon Resource Name).
29 30 31 |
# File 'lib/aws/iam/group.rb', line 29 def arn @arn end |
#create_date ⇒ Time (readonly)
When the group was created.
29 30 31 |
# File 'lib/aws/iam/group.rb', line 29 def create_date @create_date end |
#id ⇒ String (readonly)
The group’s unique ID.
29 30 31 |
# File 'lib/aws/iam/group.rb', line 29 def id @id end |
#name ⇒ String
The group’s name.
29 30 31 |
# File 'lib/aws/iam/group.rb', line 29 def name @name end |
#path ⇒ String
The group’s path. Paths are used to identify which division or part of an organization the group belongs to.
29 30 31 |
# File 'lib/aws/iam/group.rb', line 29 def path @path end |
Instance Method Details
#delete ⇒ Object
Deletes the group. The group must not contain any users or have any attached policies.
68 69 70 71 |
# File 'lib/aws/iam/group.rb', line 68 def delete client.delete_group(:group_name => name) nil end |
#exists? ⇒ Boolean
Returns True if the resource exists.
64 |
# File 'lib/aws/iam/group.rb', line 64 def exists?; super; end |
#policies ⇒ GroupPolicyCollection
Provides access to the policies associated with the group. For example:
# get the policy named "ReadOnly"
group.policies["ReadOnly"]
# remove all policies associated with the group
group.policies.clear
98 99 100 |
# File 'lib/aws/iam/group.rb', line 98 def policies GroupPolicyCollection.new(self) end |
#users ⇒ GroupUserCollection
Provides access to the users in the group. For example:
# get the names of all the users in the group
group.users.map(&:name)
# remove all users from the group
group.users.clear
83 84 85 |
# File 'lib/aws/iam/group.rb', line 83 def users GroupUserCollection.new(self) end |