-
Notifications
You must be signed in to change notification settings - Fork 225
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit adds support for more complex ARN formats, including those with colon (':') chars or a combination of colons and foward slashes ('/').
- Loading branch information
Showing
2 changed files
with
43 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 38 additions & 24 deletions
62
...ftware/amazon/smithy/aws/iam/traits/errorfiles/iam-resources/invalid-iam-resources.smithy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,67 @@ | ||
$version: "2" | ||
|
||
namespace smithy.example | ||
|
||
use aws.api#arn | ||
use aws.api#service | ||
use aws.iam#defineConditionKeys | ||
use aws.iam#iamResource | ||
|
||
@aws.api#service(sdkId: "My") | ||
@aws.iam#defineConditionKeys("foo:baz": {type: "String", documentation: "Foo baz"}) | ||
@service(sdkId: "My") | ||
@defineConditionKeys( | ||
"foo:baz": { type: "String", documentation: "Foo baz" } | ||
) | ||
service MyService { | ||
version: "2019-02-20", | ||
version: "2019-02-20" | ||
resources: [ | ||
BadIamResourceName, | ||
Beer, | ||
InvalidResource, | ||
BadIamResourceName | ||
Beer | ||
InvalidResource | ||
ShouldNotThrowAnError | ||
ColonResource | ||
CombinedResource | ||
] | ||
} | ||
|
||
@aws.iam#iamResource(name: "bad-iam-resourceName") | ||
@iamResource(name: "bad-iam-resourceName") | ||
@arn(template: "bad-iam-resource-name/{id}") | ||
resource BadIamResourceName { | ||
identifiers: { | ||
id: String | ||
} | ||
identifiers: { id: String } | ||
} | ||
|
||
@aws.iam#iamResource(name: "beer") | ||
@iamResource(name: "beer") | ||
@arn(template: "beer/{beerId}") | ||
resource Beer { | ||
identifiers: { | ||
beerId: String | ||
} | ||
resources: [IncompatibleResourceName] | ||
identifiers: { beerId: String } | ||
resources: [ | ||
IncompatibleResourceName | ||
] | ||
} | ||
|
||
@arn(template: "beer/{beerId}/incompatible-resource-name") | ||
@aws.iam#iamResource(name: "IncompatibleResourceName") | ||
@iamResource(name: "IncompatibleResourceName") | ||
resource IncompatibleResourceName { | ||
identifiers: { | ||
beerId: String | ||
} | ||
identifiers: { beerId: String } | ||
} | ||
|
||
@aws.iam#iamResource(name: "invalidResource") | ||
@iamResource(name: "invalidResource") | ||
@arn(template: "invalid-resource") | ||
resource InvalidResource {} | ||
|
||
@aws.iam#iamResource(name: "shouldNotThrowError") | ||
@iamResource(name: "shouldNotThrowError") | ||
@arn(template: "{arn}", absolute: true) | ||
resource ShouldNotThrowAnError { | ||
identifiers: { | ||
arn: String | ||
} | ||
identifiers: { arn: String } | ||
} | ||
|
||
@iamResource(name: "colon") | ||
@arn(template: "colon:{fooId}") | ||
resource ColonResource { | ||
identifiers: { fooId: String } | ||
} | ||
|
||
@iamResource(name: "combined") | ||
@arn(template: "combined:{fooId}/{barId}") | ||
resource CombinedResource { | ||
identifiers: { fooId: String, barId: String } | ||
} |