ruby/example_code/iam/iam-ruby-example-account-alias.rb
# Deletes an AWS account alias.
#
# @param iam [Aws::IAM::Client] An initialized IAM client.
# @param account_alias [String] The name of the account alias to delete.
# @return [Boolean] true if the account alias was deleted; otherwise, false.
# @example
#   exit 1 unless alias_deleted?(Aws::IAM::Client.new, 'my-account-alias')

Deletes an AWS account alias.
Deletes an AWS account alias .
def alias_deleted?(iam, account_alias)
  iam.delete_account_alias(account_alias: account_alias)
  return true
rescue StandardError => e
  puts "Error deleting account alias: #{e.message}"
  return false
end
def alias_deleted? ( iam , account_alias ) iam . delete_account_alias ( account_alias : account_alias ) return true rescue StandardError => e puts "Error deleting account alias: #{e.message}" return false end
Deletes an AWS account alias.
Deletes an AWS account alias .
true if the account alias was deleted; otherwise, false.
true if the account alias was deleted ; otherwise false .
Boolean
iam
An initialized IAM client.
An initialized IAM client .
account_alias
The name of the account alias to delete.
The name of the account alias to delete .
example
exit 1 unless alias_deleted?(Aws::IAM::Client.new, 'my-account-alias')
exit 1 unless alias_deleted? ( Aws :: IAM :: Client . new ' my - account - alias ' )