Class: Fog::AWS::IAM::Policy

Inherits:
Model
  • Object
show all
Defined in:
lib/fog/aws/models/iam/policy.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#group_nameObject

Returns the value of attribute group_name.



9
10
11
# File 'lib/fog/aws/models/iam/policy.rb', line 9

def group_name
  @group_name
end

Instance Method Details

#destroyObject



26
27
28
29
30
31
32
# File 'lib/fog/aws/models/iam/policy.rb', line 26

def destroy
  requires :id
  requires :username

  service.delete_user_policy(username, id)
  true
end

#saveObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/fog/aws/models/iam/policy.rb', line 11

def save
  requires :id
  requires_one :username, :group_name
  requires :document

  data = if username
           service.put_user_policy(username, id, document).body
         else
           service.put_group_policy(group_name, id, document).body
         end

  merge_attributes(data)
  true
end

#userObject



34
35
36
37
# File 'lib/fog/aws/models/iam/policy.rb', line 34

def user
  requires :username
  service.users.get(username)
end