class AWS::IAM::AccessKeyCollection
#=> oops, raises a runtime error
access_keys.secret
access_keys = iam.access_keys.first
a newly created access key:
created an error will be raised. AWS will only give the secret for
If you try to access the secret on an access key that was not newly
secret = access_keys.secret
access_keys = iam.access_keys.create
and save it somewhere safe.
Make sure after creating an access to retrieve the secret access key
## Secret
user_access_keys = iam.users.access_keys.create
# for an iam user
access_keys = iam.access_keys.create
# for the aws account
## Create New Access Keys
You can create, delete, activate and deactivate access keys.
You can create new keys so that you can rotate out your old keys.
Both AWS accounts and IAM users can have access keys (maximum of 2).
def [] access_key_id
-
(AccessKey)
- Returns a reference to the access key with
Parameters:
-
access_key_id
(String
) -- The ID of the access key.
def [] access_key_id AccessKey.new(access_key_id, new_options) end
def clear
-
(nil)
-
def clear each{|access_key| access_key.delete } nil end
def create
def create options = {} options[:user_name] = user.name if user resp = client.create_access_key(options) AccessKey.new_from(:create_access_key, resp.access_key, resp.access_key.access_key_id, new_options) end
def each options = {}, &block
-
(nil)
-
Other tags:
- Yieldparam: access_key -
Options Hash:
(**options)
-
:batch_size
(Integer
) -- The maximum number of -
:limit
(Integer
) -- The maximum number of access keys
Parameters:
-
options
(Hash
) --
def each options = {}, &block each_options = options.dup each_options[:user_name] = user.name if user super(each_options, &block) end
def each_item response, &block
def each_item response, &block response.access_key_metadata.each do |item| access_key = AccessKey.new_from(:list_access_keys, item, item.access_key_id, new_options) yield(access_key) end end
def initialize options = {}
(**options)
-
:user
(User
) -- If present, this collection will only
Parameters:
-
options
(Hash
) --
def initialize options = {} @user = options[:user] @user ? super(@user, options) : super(options) end
def new_options
def new_options user ? { :user => user } : { :config => config } end