Class: AWS::IAM::SigningCertificateCollection
- Inherits:
-
Object
- Object
- AWS::IAM::SigningCertificateCollection
- Includes:
- Collection
- Defined in:
- lib/aws/iam/signing_certificate_collection.rb
Overview
This is the primary interface for uploading X.509 signing certificates to an AWS account or an IAM user.
iam = AWS::IAM.new
# upload a certificate for the AWS account:
iam.signing_certificates.upload(<<-CERT)
-----BEGIN CERTIFICATE-----
MIICdzCCAeCgAwIBAgIFGS4fY6owDQYJKoZIhvcNAQEFBQAwUzELMAkGA1UEBhMC
......
Glli79yh87PRi0vNDlFEoHXNynkvC/c4TiWruZ4haM9BR9EdWr1DBNNu73ui093K
F9TbdXSWdgMl7E0=
-----END CERTIFICATE-----
CERT
If you want to work with an IAM user's certificates just use the signing certificate interface on a user:
user = iam.users['someuser']
user.signing_certificates.upload(cert_body)
Instance Attribute Summary collapse
-
#user ⇒ User?
readonly
Returns the user this collection belongs to.
Instance Method Summary collapse
-
#[](certificate_id) ⇒ SigningCertificate
Returns a reference to the signing certificate with the given certificate ID.
-
#clear ⇒ nil
Deletes all of the signing certificates from this collection.
-
#each(options = {}) {|signing_certificate| ... } ⇒ nil
Yields once for each signing certificate.
-
#initialize(options = {}) ⇒ SigningCertificateCollection
constructor
A new instance of SigningCertificateCollection.
-
#upload(certificate_body) ⇒ SigningCertificate
(also: #create)
Returns the newly created signing certificate.
Methods included from Core::Collection
#each_batch, #enum, #first, #in_groups_of, #page
Constructor Details
#initialize(options = {}) ⇒ SigningCertificateCollection
Returns a new instance of SigningCertificateCollection.
47 48 49 50 |
# File 'lib/aws/iam/signing_certificate_collection.rb', line 47 def initialize = {} @user = [:user] @user ? super(@user, ) : super() end |
Instance Attribute Details
#user ⇒ User? (readonly)
Returns the user this collection belongs to.
Returns nil
if the collection represents the root credentials
for the account. If the configured credentials belong to an
IAM user, then that user is the implied owner.
56 57 58 |
# File 'lib/aws/iam/signing_certificate_collection.rb', line 56 def user @user end |
Instance Method Details
#[](certificate_id) ⇒ SigningCertificate
Returns a reference to the signing certificate with the given certificate ID.
80 81 82 |
# File 'lib/aws/iam/signing_certificate_collection.rb', line 80 def [] certificate_id SigningCertificate.new(certificate_id.to_s, ) end |
#clear ⇒ nil
Deletes all of the signing certificates from this collection.
86 87 88 89 90 91 |
# File 'lib/aws/iam/signing_certificate_collection.rb', line 86 def clear each do |certificate| certificate.delete end nil end |
#each(options = {}) {|signing_certificate| ... } ⇒ nil
Yields once for each signing certificate.
You can limit the number of certificates yielded using :limit
.
104 105 106 107 108 |
# File 'lib/aws/iam/signing_certificate_collection.rb', line 104 def each = {}, &block = .dup [:user_name] = user.name if user super(, &block) end |
#upload(certificate_body) ⇒ SigningCertificate Also known as: create
Returns the newly created signing certificate.
62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/aws/iam/signing_certificate_collection.rb', line 62 def upload certificate_body = {} [:certificate_body] = certificate_body [:user_name] = user.name if user resp = client.upload_signing_certificate() SigningCertificate.new_from(:upload_signing_certificate, resp.certificate, resp.certificate.certificate_id, ) end |