Class AWS::IAM::ServerCertificateCollection
In: lib/aws/iam/server_certificate_collection.rb
Parent: Object

A collection that provides access to IAM server certificates belonging to this account.

  iam = AWS::IAM.new
  certificates = iam.server_certificates

Uploading A Server Certificate

You can upload any valid, signed certificate using {upload}.

  certificates.upload(:name => "MyCert",
                      :certificate_body => my_certificate_body,
                      :private_key => my_private_key)

For information about generating a server certificate for use with IAM, see {docs.amazonwebservices.com/IAM/latest/UserGuide/InstallCert.html Creating and Uploading Server Certificates} in Using AWS Identity and Access Management.

Getting a Server Certificate by Name

You can get a reference to a server certificate using array notation:

  certificate = certificates['MyCert']

Enumerating Server Certificates

Server certificate collections can also be used to enumerate certificates:

  certificates.each do |cert|
    puts cert.name
  end

You can limit the certificates returned by passing a +:prefix+ option to any of the enumerator methods. When you pass a prefix, only the certificates whose paths start with the given string will be returned.

Methods

[]   create   each   each_item   enumerator   upload  

Included Modules

Collection::WithPrefix

Public Instance methods

Returns a reference to the server certificate with the given name:

  certificate = iam.server_certificates['MyCert']

@param [String] name Name of the server certificate.

@return [ServerCertificate] Returns a reference to the named

  server certificate.
create(options = {})

Alias for upload

Yields once for each server certificate

You can limit the number of certificates yielded using +:limit+ and +:path_prefix+.

@param [Hash] options

@option options [String] :path_prefix (’/’) A path prefix that

  filters according to the path of the certificate.

@option options [Integer] :limit The maximum number of

  certificates to yield.

@option options [Integer] :batch_size The maximum number of

  certificates to retrieve in each service request.

@yieldparam [ServerCertificate] certificate @return [nil]

Returns an enumerable object for this collection. This can be useful if you want to call an enumerable method that does not accept options (e.g. collect, first, etc).

  certificates.enumerator(:path_prefix => '/production').
    collect(&:name)

@param (see each) @option (see each) @return [Enumerator]

Uploads a server certificate entity for the AWS account. The server certificate entity includes a public key certificate, a private key, and an optional certificate chain, which should all be PEM-encoded.

@param [Hash] options Options for uploading the certificate.

  +:name+, +:certificate_body+, and +:private_key+ are
  required.

@option options [String] :certificate_body The contents of the

  public key certificate in PEM-encoded format.

@option options [String] :name The name for the server

  certificate. Do not include the path in this value.

@option options [String] :path The path for the server

  certificate. For more information about paths, see
  {http://docs.amazonwebservices.com/IAM/latest/UserGuide/index.html?Using_Identifiers.html
  Identifiers for IAM Entities} in <i>Using AWS Identity and
  Access Management</i>.

@option options [String] :private_key The contents of the

  private key in PEM-encoded format.

@option options [String] :certificate_chain The contents of

  the certificate chain. This is typically a concatenation of
  the PEM-encoded public key certificates of the chain.

@return [ServerCertificate] The newly created server

  certificate.

Protected Instance methods

[Validate]