Skip to content
This repository has been archived by the owner on Nov 20, 2018. It is now read-only.

Commit

Permalink
Resolves a validation error with IAM.resources.json
Browse files Browse the repository at this point in the history
The User#create_access_key method was attempting to return
an object with data, but the data path did not resolve to the
appropriate shape. It was attempting to return an "AccessKey" shape
instead of the "AccessKeyMetadata" shape required by its type.

To resolve this, a new resource type has been added, "AccessKeyPair".
This resource has the access key id AND the secret access key.

    # provides access to the secret only on newly created objects
    key_pair = IAM::Resource.new.user('name').create_access_key
    key_pair.access_key_id
    key_pair.secret_access_key

    # secrets are not retrievable after creation
    key = IAM::Resource.new.user('name').access_key('id)
    key.access_key_id
    key.secret_access_key #=> raises NoMethodError
  • Loading branch information
trevorrowe committed Oct 3, 2014
1 parent 0da20fb commit 4a0c0c2
Showing 1 changed file with 28 additions and 1 deletion.
29 changes: 28 additions & 1 deletion aws-sdk-core/apis/IAM.resources.json
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,33 @@
}
}
},
"AccessKeyPair": {
"identifiers": [
{ "name": "UserName" },
{ "name": "Id" }
],
"shape": "AccessKey",
"hasOne": {
"AccessKey": {
"resource": {
"type": "AccessKey",
"identifiers": [
{ "target":"UserName", "sourceType":"identifier", "source":"UserName" },
{ "target":"Id", "sourceType":"identifier", "source":"Id" }
]
}
},
"User": {
"resource": {
"type": "AccessKey",
"identifiers": [
{ "target":"UserName", "sourceType":"identifier", "source":"UserName" },
{ "target":"Id", "sourceType":"identifier", "source":"Id" }
]
}
}
}
},
"AccountAlias": {
"identifiers": [
{ "name": "Name" }
Expand Down Expand Up @@ -803,7 +830,7 @@
]
},
"resource": {
"type": "AccessKey",
"type": "AccessKeyPair",
"identifiers": [
{ "target":"UserName", "sourceType":"identifier", "source":"Name" },
{ "target":"Id", "sourceType":"responsePath", "source":"AccessKey.AccessKeyId" }
Expand Down

0 comments on commit 4a0c0c2

Please sign in to comment.