ruby/example_code/iam/iam-ruby-example-server-certificates.rb
def list_server_certificate_names(iam_client)
  response = iam_client.list_server_certificates

  if response.key?('server_certificate_metadata_list') &&
    response.server_certificate_metadata_list.count.positive?

    response.server_certificate_metadata_list.each do |certificate_metadata|
      puts certificate_metadata.server_certificate_name
    end
  else
    puts 'No server certificates found. Stopping program.'
    exit 1
  end
rescue StandardError => e
  puts "Error getting server certificate names: #{e.message}"
end
# Gets a list of available server certificate names in
# AWS Identity and Access Management (IAM).
#
# @param iam_client [Aws::IAM::Client] An initialized IAM client.
# @example
#   list_server_certificate_names(Aws::IAM::Client.new)

Gets a list of available server certificate names in
AWS Identity and Access Management (IAM).
Gets a list of available server certificate names in AWS Identity and Access Management ( IAM ) .
def list_server_certificate_names(iam_client)
  response = iam_client.list_server_certificates
  if response.key?('server_certificate_metadata_list') &&
    response.server_certificate_metadata_list.count.positive?
    response.server_certificate_metadata_list.each do |certificate_metadata|
      puts certificate_metadata.server_certificate_name
    end
  else
    puts 'No server certificates found. Stopping program.'
    exit 1
  end
rescue StandardError => e
  puts "Error getting server certificate names: #{e.message}"
end
def list_server_certificate_names ( iam_client ) response = iam_client . list_server_certificates if response . key? ( 'server_certificate_metadata_list' ) && response . server_certificate_metadata_list . count . positive? response . server_certificate_metadata_list . each do | certificate_metadata | puts certificate_metadata . server_certificate_name end else puts 'No server certificates found. Stopping program.' exit 1 end rescue StandardError => e puts "Error getting server certificate names: #{e.message}" end
Gets a list of available server certificate names in
AWS Identity and Access Management (IAM).
Gets a list of available server certificate names in AWS Identity and Access Management ( IAM ) .
iam_client
An initialized IAM client.
An initialized IAM client .
example
None