def get_server_certs(iam, name=None):
 results = dict()
 try:
  if name:
   server_certs = [iam.get_server_certificate(ServerCertificateName=name)['ServerCertificate']]
  else:
   server_certs = iam.list_server_certificates()['ServerCertificateMetadataList']
  for server_cert in server_certs:
   if (not name):
    server_cert = iam.get_server_certificate(ServerCertificateName=server_cert['ServerCertificateName'])['ServerCertificate']
   cert_md = server_cert['ServerCertificateMetadata']
   results[cert_md['ServerCertificateName']] = {'certificate_body': server_cert['CertificateBody'], 'server_certificate_id': cert_md['ServerCertificateId'], 'server_certificate_name': cert_md['ServerCertificateName'], 'arn': cert_md['Arn'], 'path': cert_md['Path'], 'expiration': cert_md['Expiration'].isoformat(), 'upload_date': cert_md['UploadDate'].isoformat()}
 except botocore.exceptions.ClientError:
  pass
 return results

def get_server_certs ( iam , name = None ) : results = dict ( ) try : if name : server_certs = [ iam . get_server_certificate ( ServerCertificateName = name ) [ 'ServerCertificate' ] ] else : server_certs = iam . list_server_certificates ( ) [ 'ServerCertificateMetadataList' ] for server_cert in server_certs : if ( not name ) : server_cert = iam . get_server_certificate ( ServerCertificateName = server_cert [ 'ServerCertificateName' ] ) [ 'ServerCertificate' ] cert_md = server_cert [ 'ServerCertificateMetadata' ] results [ cert_md [ 'ServerCertificateName' ] ] = { 'certificate_body' : server_cert [ 'CertificateBody' ] , 'server_certificate_id' : cert_md [ 'ServerCertificateId' ] , 'server_certificate_name' : cert_md [ 'ServerCertificateName' ] , 'arn' : cert_md [ 'Arn' ] , 'path' : cert_md [ 'Path' ] , 'expiration' : cert_md [ 'Expiration' ] . isoformat ( ) , 'upload_date' : cert_md [ 'UploadDate' ] . isoformat ( ) } except botocore . exceptions . ClientError : pass return results
retrieve the attributes of a server certificate if it exists or all certs .