ruby/example_code/iam/iam-ruby-example-server-certificates.rb
# Changes the name of a server certificate in
# AWS Identity and Access Management (IAM).
#
# Prerequisites:
#
# - The server certificate in IAM.
#
# @param iam_client [Aws::IAM::Client] An initialized IAM client.
# @param server_certificate_current_name [String] The current name of
#   the server certificate.
# @param server_certificate_new_name [String] The new name for the
#   the server certificate.
# @return [Boolean] true if the name of the server certificate
#   was changed; otherwise, false.
# @example
#   exit 1 unless server_certificate_name_changed?(
#     Aws::IAM::Client.new,
#     'my-server-certificate',
#     'my-changed-server-certificate'
#   )

Changes the name of a server certificate in
AWS Identity and Access Management (IAM).



The server certificate in IAM.
Changes the name of a server certificate in AWS Identity and Access Management ( IAM ) . The server certificate in IAM .
def server_certificate_name_changed?(
  iam_client,
  server_certificate_current_name,
  server_certificate_new_name
)
  iam_client.update_server_certificate(
    server_certificate_name: server_certificate_current_name,
    new_server_certificate_name: server_certificate_new_name
  )
  return true
rescue StandardError => e
  puts "Error updating server certificate name: #{e.message}"
  return false
end
def server_certificate_name_changed? ( iam_client , server_certificate_current_name , server_certificate_new_name ) iam_client . update_server_certificate ( server_certificate_name : server_certificate_current_name , new_server_certificate_name : server_certificate_new_name ) return true rescue StandardError => e puts "Error updating server certificate name: #{e.message}" return false end
Changes the name of a server certificate in
AWS Identity and Access Management (IAM).
Changes the name of a server certificate in AWS Identity and Access Management ( IAM ) .
true if the name of the server certificate was changed; otherwise, false.
true if the name of the server certificate was changed ; otherwise false .
Boolean
iam_client
An initialized IAM client.
An initialized IAM client .
server_certificate_current_name
The current name of the server certificate.
The current name of the server certificate .
server_certificate_new_name
The new name for the the server certificate.
The new name for the the server certificate .
example
exit 1 unless server_certificate_name_changed?( Aws::IAM::Client.new, 'my-server-certificate', 'my-changed-server-certificate' )
exit 1 unless server_certificate_name_changed? ( Aws :: IAM :: Client . new ' my - server - certificate ' ' my - changed - server - certificate ' )