Class: AwsIamPolicy

Inherits:
Object
  • Object
show all
Includes:
AwsSingularResourceMixin
Defined in:
lib/resources/aws/aws_iam_policy.rb

Defined Under Namespace

Classes: Backend

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from AwsSingularResourceMixin

#exists?, included

Methods included from AwsResourceMixin

#catch_aws_errors, #check_resource_param_names, #initialize, #inspec_runner

Instance Attribute Details

#arnObject (readonly)

Returns the value of attribute arn.



13
14
15
# File 'lib/resources/aws/aws_iam_policy.rb', line 13

def arn
  @arn
end

#attachment_countObject (readonly)

Returns the value of attribute attachment_count.



13
14
15
# File 'lib/resources/aws/aws_iam_policy.rb', line 13

def attachment_count
  @attachment_count
end

#default_version_idObject (readonly)

Returns the value of attribute default_version_id.



13
14
15
# File 'lib/resources/aws/aws_iam_policy.rb', line 13

def default_version_id
  @default_version_id
end

Instance Method Details

#attached?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/resources/aws/aws_iam_policy.rb', line 19

def attached?
  !attachment_count.zero?
end

#attached_groupsObject



29
30
31
32
33
# File 'lib/resources/aws/aws_iam_policy.rb', line 29

def attached_groups
  return @attached_groups if defined? @attached_groups
  fetch_attached_entities
  @attached_groups
end

#attached_rolesObject



35
36
37
38
39
# File 'lib/resources/aws/aws_iam_policy.rb', line 35

def attached_roles
  return @attached_roles if defined? @attached_roles
  fetch_attached_entities
  @attached_roles
end

#attached_to_group?(group_name) ⇒ Boolean

Returns:

  • (Boolean)


45
46
47
# File 'lib/resources/aws/aws_iam_policy.rb', line 45

def attached_to_group?(group_name)
  attached_groups.include?(group_name)
end

#attached_to_role?(role_name) ⇒ Boolean

Returns:

  • (Boolean)


49
50
51
# File 'lib/resources/aws/aws_iam_policy.rb', line 49

def attached_to_role?(role_name)
  attached_roles.include?(role_name)
end

#attached_to_user?(user_name) ⇒ Boolean

Returns:

  • (Boolean)


41
42
43
# File 'lib/resources/aws/aws_iam_policy.rb', line 41

def attached_to_user?(user_name)
  attached_users.include?(user_name)
end

#attached_usersObject



23
24
25
26
27
# File 'lib/resources/aws/aws_iam_policy.rb', line 23

def attached_users
  return @attached_users if defined? @attached_users
  fetch_attached_entities
  @attached_users
end

#to_sObject



15
16
17
# File 'lib/resources/aws/aws_iam_policy.rb', line 15

def to_s
  "Policy #{@policy_name}"
end