Class: Aws::IAM::Policy
- Inherits:
-
Object
- Object
- Aws::IAM::Policy
- Extended by:
- Deprecations
- Defined in:
- sig/policy.rbs,
lib/aws-sdk-iam/policy.rb
Overview
Defined Under Namespace
Classes: Collection
Read-Only Attributes collapse
- #arn ⇒ String
-
#attachment_count ⇒ Integer
The number of entities (users, groups, and roles) that the policy is attached to.
-
#create_date ⇒ Time
The date and time, in [ISO 8601 date-time format][1], when the policy was created.
-
#default_version_id ⇒ String
The identifier for the version of the policy that is set as the default version.
-
#description ⇒ String
A friendly description of the policy.
-
#is_attachable ⇒ Boolean
Specifies whether the policy can be attached to an IAM user, group, or role.
-
#path ⇒ String
The path to the policy.
-
#permissions_boundary_usage_count ⇒ Integer
The number of entities (users and roles) for which the policy is used to set the permissions boundary.
-
#policy_id ⇒ String
The stable and unique string identifying the policy.
-
#policy_name ⇒ String
The friendly name (not ARN) identifying the policy.
-
#tags ⇒ Array<Types::Tag>
A list of tags that are attached to the instance profile.
-
#update_date ⇒ Time
The date and time, in [ISO 8601 date-time format][1], when the policy was last updated.
Actions collapse
- #attach_group(options = {}) ⇒ EmptyStructure
- #attach_role(options = {}) ⇒ EmptyStructure
- #attach_user(options = {}) ⇒ EmptyStructure
- #create_version(options = {}) ⇒ PolicyVersion
- #delete(options = {}) ⇒ EmptyStructure
- #detach_group(options = {}) ⇒ EmptyStructure
- #detach_role(options = {}) ⇒ EmptyStructure
- #detach_user(options = {}) ⇒ EmptyStructure
Associations collapse
- #attached_groups(options = {}) ⇒ Group::Collection
- #attached_roles(options = {}) ⇒ Role::Collection
- #attached_users(options = {}) ⇒ User::Collection
- #default_version ⇒ PolicyVersion?
- #identifiers ⇒ Object deprecated private Deprecated.
- #versions(options = {}) ⇒ PolicyVersion::Collection
Instance Method Summary collapse
- #client ⇒ Client
-
#data ⇒ Types::Policy
Returns the data for this Policy.
-
#data_loaded? ⇒ Boolean
Returns
trueif this resource is loaded. -
#initialize(*args) ⇒ Policy
constructor
A new instance of Policy.
- #load ⇒ self (also: #reload)
-
#wait_until(options = {}) {|resource| ... } ⇒ Resource
deprecated
Deprecated.
Use [Aws::IAM::Client] #wait_until instead
Constructor Details
Instance Method Details
#arn ⇒ String
18 |
# File 'sig/policy.rbs', line 18
def arn: () -> String
|
#attach_group(options = {}) ⇒ EmptyStructure
67 |
# File 'sig/policy.rbs', line 67
def attach_group: (
|
#attach_role(options = {}) ⇒ EmptyStructure
73 |
# File 'sig/policy.rbs', line 73
def attach_role: (
|
#attach_user(options = {}) ⇒ EmptyStructure
79 |
# File 'sig/policy.rbs', line 79
def attach_user: (
|
#attached_groups(options = {}) ⇒ Group::Collection
115 |
# File 'sig/policy.rbs', line 115
def attached_groups: (
|
#attached_roles(options = {}) ⇒ Role::Collection
122 |
# File 'sig/policy.rbs', line 122
def attached_roles: (
|
#attached_users(options = {}) ⇒ User::Collection
129 |
# File 'sig/policy.rbs', line 129
def attached_users: (
|
#attachment_count ⇒ Integer
The number of entities (users, groups, and roles) that the policy is attached to.
33 |
# File 'sig/policy.rbs', line 33
def attachment_count: () -> ::Integer
|
#create_date ⇒ Time
The date and time, in ISO 8601 date-time format, when the policy was created.
45 |
# File 'sig/policy.rbs', line 45
def create_date: () -> ::Time
|
#create_version(options = {}) ⇒ PolicyVersion
85 |
# File 'sig/policy.rbs', line 85
def create_version: (
|
#data ⇒ Types::Policy
Returns the data for this Aws::IAM::Policy. Calls
Client#get_policy if #data_loaded? is false.
60 |
# File 'sig/policy.rbs', line 60
def data: () -> Types::Policy
|
#data_loaded? ⇒ Boolean
63 |
# File 'sig/policy.rbs', line 63
def data_loaded?: () -> bool
|
#default_version ⇒ PolicyVersion?
136 |
# File 'sig/policy.rbs', line 136
def default_version: () -> PolicyVersion?
|
#default_version_id ⇒ String
The identifier for the version of the policy that is set as the default version.
30 |
# File 'sig/policy.rbs', line 30
def default_version_id: () -> ::String
|
#delete(options = {}) ⇒ EmptyStructure
92 |
# File 'sig/policy.rbs', line 92
def delete: (
|
#description ⇒ String
A friendly description of the policy.
This element is included in the response to the GetPolicy operation. It is not included in the response to the ListPolicies operation.
42 |
# File 'sig/policy.rbs', line 42
def description: () -> ::String
|
#detach_group(options = {}) ⇒ EmptyStructure
97 |
# File 'sig/policy.rbs', line 97
def detach_group: (
|
#detach_role(options = {}) ⇒ EmptyStructure
103 |
# File 'sig/policy.rbs', line 103
def detach_role: (
|
#detach_user(options = {}) ⇒ EmptyStructure
109 |
# File 'sig/policy.rbs', line 109
def detach_user: (
|
#identifiers ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
746 747 748 |
# File 'lib/aws-sdk-iam/policy.rb', line 746 def identifiers { arn: @arn } end |
#is_attachable ⇒ Boolean
Specifies whether the policy can be attached to an IAM user, group, or role.
39 |
# File 'sig/policy.rbs', line 39
def is_attachable: () -> bool
|
#load ⇒ self Also known as: reload
Loads, or reloads #data for the current Aws::IAM::Policy.
Returns self making it possible to chain methods.
policy.reload.data
56 |
# File 'sig/policy.rbs', line 56
def load: () -> self
|
#path ⇒ String
The path to the policy.
For more information about paths, see IAM identifiers in the IAM User Guide.
27 |
# File 'sig/policy.rbs', line 27
def path: () -> ::String
|
#permissions_boundary_usage_count ⇒ Integer
The number of entities (users and roles) for which the policy is used to set the permissions boundary.
For more information about permissions boundaries, see Permissions boundaries for IAM identities in the IAM User Guide.
36 |
# File 'sig/policy.rbs', line 36
def permissions_boundary_usage_count: () -> ::Integer
|
#policy_id ⇒ String
The stable and unique string identifying the policy.
For more information about IDs, see IAM identifiers in the IAM User Guide.
24 |
# File 'sig/policy.rbs', line 24
def policy_id: () -> ::String
|
#policy_name ⇒ String
The friendly name (not ARN) identifying the policy.
21 |
# File 'sig/policy.rbs', line 21
def policy_name: () -> ::String
|
#tags ⇒ Array<Types::Tag>
A list of tags that are attached to the instance profile. For more information about tagging, see Tagging IAM resources in the IAM User Guide.
51 |
# File 'sig/policy.rbs', line 51
def tags: () -> ::Array[Types::Tag]
|
#update_date ⇒ Time
The date and time, in ISO 8601 date-time format, when the policy was last updated.
When a policy has only one version, this field contains the date and time when the policy was created. When a policy has more than one version, this field contains the date and time when the most recent policy version was created.
48 |
# File 'sig/policy.rbs', line 48
def update_date: () -> ::Time
|
#versions(options = {}) ⇒ PolicyVersion::Collection
139 |
# File 'sig/policy.rbs', line 139
def versions: (
|
#wait_until(options = {}) {|resource| ... } ⇒ Resource
Use [Aws::IAM::Client] #wait_until instead
The waiting operation is performed on a copy. The original resource remains unchanged.
Waiter polls an API operation until a resource enters a desired state.
Basic Usage
Waiter will polls until it is successful, it fails by entering a terminal state, or until a maximum number of attempts are made.
# polls in a loop until condition is true
resource.wait_until() {|resource| condition}
Example
instance.wait_until(max_attempts:10, delay:5) do |instance|
instance.state.name == 'running'
end
Configuration
You can configure the maximum number of polling attempts, and the delay (in seconds) between each polling attempt. The waiting condition is set by passing a block to #wait_until:
# poll for ~25 seconds
resource.wait_until(max_attempts:5,delay:5) {|resource|...}
Callbacks
You can be notified before each polling attempt and before each
delay. If you throw :success or :failure from these callbacks,
it will terminate the waiter.
started_at = Time.now
# poll for 1 hour, instead of a number of attempts
proc = Proc.new do |attempts, response|
throw :failure if Time.now - started_at > 3600
end
# disable max attempts
instance.wait_until(before_wait:proc, max_attempts:nil) {...}
Handling Errors
When a waiter is successful, it returns the Resource. When a waiter fails, it raises an error.
begin
resource.wait_until(...)
rescue Aws::Waiters::Errors::WaiterFailed
# resource did not enter the desired state in time
end
attempts attempt in seconds invoked before each attempt invoked before each wait
275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 |
# File 'lib/aws-sdk-iam/policy.rb', line 275 def wait_until( = {}, &block) self_copy = self.dup attempts = 0 [:max_attempts] = 10 unless .key?(:max_attempts) [:delay] ||= 10 [:poller] = Proc.new do attempts += 1 if block.call(self_copy) [:success, self_copy] else self_copy.reload unless attempts == [:max_attempts] :retry end end Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do Aws::Waiters::Waiter.new().wait({}) end end |