Class | AWS::IAM::AccessKey |
In: |
lib/aws/iam/access_key.rb
|
Parent: | Resource |
@attr_reader [Symbol] status The status of this access key.
Status may be `:active` or `:inactive`.
id | -> | access_key_id |
id | [R] | @return [String] Returns the access key id. |
user | [R] |
@return [User,nil] Returns the user this access key
belongs to.
Returns `nil` if this access key belongs to the AWS account and not a specific user. |
@param [String] access_key_id The id of this access key. @param [Hash] options @option [String] :user The IAM user this access key belongs to.
If `:user` is omitted then this access key belongs to the AWS account.
Activates this access key.
@example
access_key.activate! access_key.status # => :active
@return [nil]
Returns a hash that should be saved somewhere safe.
access_keys = iam.access_keys.create access_keys.credentials #=> { :access_key_id => '...', :secret_access_key => '...' }
You can also use these credentials to make requests:
s3 = AWS::S3.new(access_keys.credentials) s3.buckets.create('newbucket')
@return [Hash] Returns a hash with the access key id and
secret access key.
Deactivates this access key.
@example
access_key.deactivate! access_key.status # => :inactive
@return [nil] @return [nil]
Returns the secret access key.
You can only access the secret for newly created access keys. Calling `secret` on existing access keys raises an error.
@example Getting the secret from a newly created access key
access_key = iam.access_keys.create access_key.secret #=> 'SECRET_ACCESS_KEY'
@example Failing to get the secret from an existing access key.
access_key = iam.access_keys.first access_key.secret #=> raises a runtime error
@return [String] Returns the secret access key.
@return [String,nil] Returns the name of the user this access key
belogns to. If the access key belongs to the account, `nil` is returned.
IAM does not provide a request for "get access keys". Also note, we do not page the response. This is because restrictions on how many access keys an account / user may have is fewer than one page of results. @api private