Class: Aws::IAM::InstanceProfile

Inherits:
Object
  • Object
show all
Extended by:
Deprecations
Defined in:
sig/instance_profile.rbs,
lib/aws-sdk-iam/instance_profile.rb

Overview

Defined Under Namespace

Classes: Collection

Read-Only Attributes collapse

Actions collapse

Associations collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, options = {}) ⇒ InstanceProfile #initialize(options = {}) ⇒ InstanceProfile

Returns a new instance of InstanceProfile.

Overloads:

  • #initialize(name, options = {}) ⇒ InstanceProfile

    Parameters:

    • name (String)

    Options Hash (options):

  • #initialize(options = {}) ⇒ InstanceProfile

    Options Hash (options):

    • :name (required, String)
    • :client (Client)


13
14
15
# File 'sig/instance_profile.rbs', line 13

def initialize: (String name, Hash[Symbol, untyped] options) -> void
| (name: String, ?client: Client) -> void
| (Hash[Symbol, untyped] args) -> void

Instance Method Details

#add_role(options = {}) ⇒ EmptyStructure

Examples:

Request syntax with placeholder values


instance_profile.add_role({
  role_name: "roleNameType", # required
})

Parameters:

  • options (Hash) (defaults to: {})

    ({})

Options Hash (options):

  • :role_name (required, String)

    The name of the role to add.

    This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-

Returns:

  • (EmptyStructure)


57
# File 'sig/instance_profile.rbs', line 57

def add_role: (

#arnString

The Amazon Resource Name (ARN) specifying the instance profile. For more information about ARNs and how to use them in policies, see IAM identifiers in the IAM User Guide.

Returns:

  • (String)


28
# File 'sig/instance_profile.rbs', line 28

def arn: () -> ::String

#clientClient

Returns:



94
# File 'lib/aws-sdk-iam/instance_profile.rb', line 94

def client: () -> Client

#create_dateTime

The date when the instance profile was created.

Returns:

  • (Time)


31
# File 'sig/instance_profile.rbs', line 31

def create_date: () -> ::Time

#dataTypes::InstanceProfile

Returns the data for this Aws::IAM::InstanceProfile. Calls Client#get_instance_profile if #data_loaded? is false.

Returns:



43
# File 'sig/instance_profile.rbs', line 43

def data: () -> Types::InstanceProfile

#data_loaded?Boolean

Returns true if this resource is loaded. Accessing attributes or #data on an unloaded resource will trigger a call to #load.

Returns:

  • (Boolean)

    Returns true if this resource is loaded. Accessing attributes or #data on an unloaded resource will trigger a call to #load.



46
# File 'sig/instance_profile.rbs', line 46

def data_loaded?: () -> bool

#delete(options = {}) ⇒ EmptyStructure

Examples:

Request syntax with placeholder values


instance_profile.delete()

Parameters:

  • options (Hash) (defaults to: {})

    ({})

Returns:

  • (EmptyStructure)


63
# File 'sig/instance_profile.rbs', line 63

def delete: (

#exists?(options = {}) ⇒ Boolean

Returns true if the InstanceProfile exists.

Parameters:

  • options (Hash) (defaults to: {})

    ({})

Returns:

  • (Boolean)

    Returns true if the InstanceProfile exists.



49
50
# File 'sig/instance_profile.rbs', line 49

def exists?: (?max_attempts: Integer, ?delay: Numeric, ?before_attempt: (^(Integer attempts) -> void), ?before_wait: (^(Integer attempts, untyped response) -> void)) -> bool
| (?Hash[Symbol, untyped]) -> bool

#identifiersObject

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.

Deprecated.


344
345
346
# File 'lib/aws-sdk-iam/instance_profile.rb', line 344

def identifiers
  { name: @name }
end

#instance_profile_idString

The stable and unique string identifying the instance profile. For more information about IDs, see IAM identifiers in the IAM User Guide.

Returns:

  • (String)


25
# File 'sig/instance_profile.rbs', line 25

def instance_profile_id: () -> ::String

#loadself Also known as: reload

Loads, or reloads #data for the current Aws::IAM::InstanceProfile. Returns self making it possible to chain methods.

instance_profile.reload.data

Returns:

  • (self)


39
# File 'sig/instance_profile.rbs', line 39

def load: () -> self

#nameString Also known as: instance_profile_name

Returns:

  • (String)


18
# File 'sig/instance_profile.rbs', line 18

def name: () -> String

#pathString

The path to the instance profile. For more information about paths, see IAM identifiers in the IAM User Guide.

Returns:

  • (String)


22
# File 'sig/instance_profile.rbs', line 22

def path: () -> ::String

#remove_role(options = {}) ⇒ EmptyStructure

Examples:

Request syntax with placeholder values


instance_profile.remove_role({
  role_name: "roleNameType", # required
})

Parameters:

  • options (Hash) (defaults to: {})

    ({})

Options Hash (options):

  • :role_name (required, String)

    The name of the role to remove.

    This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-

Returns:

  • (EmptyStructure)


68
# File 'sig/instance_profile.rbs', line 68

def remove_role: (

#rolesRole::Collection

Returns:



74
# File 'sig/instance_profile.rbs', line 74

def roles: () -> Role::Collection

#tagsArray<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.

Returns:



34
# File 'sig/instance_profile.rbs', line 34

def tags: () -> ::Array[Types::Tag]

#wait_until(options = {}) {|resource| ... } ⇒ Resource

Deprecated.

Use [Aws::IAM::Client] #wait_until instead

Note:

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(options) {|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

Parameters:

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :max_attempts (Integer) — default: 10

    Maximum number of

  • :delay (Integer) — default: 10

    Delay between each

  • :before_attempt (Proc) — default: nil

    Callback

  • :before_wait (Proc) — default: nil

    Callback

Yield Parameters:

  • resource (Resource)

    to be used in the waiting condition.

Returns:

  • (Resource)

    if the waiter was successful

Raises:

  • (Aws::Waiters::Errors::FailureStateError)

    Raised when the waiter terminates because the waiter has entered a state that it will not transition out of, preventing success.

    yet successful.

  • (Aws::Waiters::Errors::UnexpectedError)

    Raised when an error is encountered while polling for a resource that is not expected.

  • (NotImplementedError)

    Raised when the resource does not



241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
# File 'lib/aws-sdk-iam/instance_profile.rb', line 241

def wait_until(options = {}, &block)
  self_copy = self.dup
  attempts = 0
  options[:max_attempts] = 10 unless options.key?(:max_attempts)
  options[:delay] ||= 10
  options[:poller] = Proc.new do
    attempts += 1
    if block.call(self_copy)
      [:success, self_copy]
    else
      self_copy.reload unless attempts == options[:max_attempts]
      :retry
    end
  end
  Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
    Aws::Waiters::Waiter.new(options).wait({})
  end
end

#wait_until_exists(options = {}, &block) ⇒ InstanceProfile

Parameters:

  • options (Hash) (defaults to: {})

    ({})

Options Hash (options):

  • :max_attempts (Integer) — default: 40
  • :delay (Float) — default: 1
  • :before_attempt (Proc)
  • :before_wait (Proc)

Returns:



53
54
# File 'sig/instance_profile.rbs', line 53

def wait_until_exists: (?max_attempts: Integer, ?delay: Numeric, ?before_attempt: (^(Integer attempts) -> void), ?before_wait: (^(Integer attempts, untyped response) -> void)) ?{ (untyped waiter) -> void } -> InstanceProfile
| (?Hash[Symbol, untyped]) ?{ (untyped waiter) -> void } -> InstanceProfile