-
Notifications
You must be signed in to change notification settings - Fork 218
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding conditionKeyValue and serviceResolvedConditionKeys traits
- Loading branch information
Showing
21 changed files
with
295 additions
and
70 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
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
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
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
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
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
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
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
21 changes: 21 additions & 0 deletions
21
...-iam-traits/src/test/java/software/amazon/smithy/aws/iam/traits/SmithyErrorFilesTest.java
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package software.amazon.smithy.aws.iam.traits; | ||
|
||
import org.junit.jupiter.params.ParameterizedTest; | ||
import org.junit.jupiter.params.provider.MethodSource; | ||
import software.amazon.smithy.model.validation.testrunner.SmithyTestCase; | ||
import software.amazon.smithy.model.validation.testrunner.SmithyTestSuite; | ||
|
||
import java.util.concurrent.Callable; | ||
import java.util.stream.Stream; | ||
|
||
public class SmithyErrorFilesTest { | ||
@ParameterizedTest(name = "{0}") | ||
@MethodSource("source") | ||
public void testRunner(String filename, Callable<SmithyTestCase.Result> callable) throws Exception { | ||
callable.call(); | ||
} | ||
|
||
public static Stream<?> source() { | ||
return SmithyTestSuite.defaultParameterizedTestSource(SmithyErrorFilesTest.class); | ||
} | ||
} |
29 changes: 8 additions & 21 deletions
29
...raits/src/test/resources/software/amazon/smithy/aws/iam/traits/condition-key-value.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,33 +1,20 @@ | ||
$version: "2.0" | ||
namespace smithy.example | ||
|
||
use aws.iam#conditionKeyValue | ||
namespace smithy.example | ||
|
||
@aws.iam#defineConditionKeys( | ||
"smithy:ActionContextKey1": { type: "String" }, | ||
"smithy:ActionContextKey2": { type: "String" }, | ||
"smithy:ActionContextKey3": { type: "String" }, | ||
"smithy:requesterId": { type: "String" } | ||
"smithy:ActionContextKey1": { type: "String" } | ||
) | ||
@aws.iam#conditionKeysResolvedByService(["smithy:requesterId"]) | ||
@aws.auth#sigv4(name: "smithy") | ||
service MyService { | ||
version: "2019-02-20", | ||
operations: [Echo, GetResource2] | ||
operations: [Echo] | ||
} | ||
|
||
|
||
@aws.iam#actionName("overridingActionName") | ||
operation Echo {} | ||
|
||
operation GetResource2 { | ||
input: GetResource2Input | ||
operation Echo { | ||
input: EchoInput | ||
} | ||
|
||
structure GetResource2Input { | ||
@aws.iam#conditionKeyValue("smithy:ActionContextKey2") | ||
id1: String, | ||
|
||
@required | ||
id2: String | ||
structure EchoInput { | ||
@aws.iam#conditionKeyValue("smithy:ActionContextKey1") | ||
id1: String | ||
} |
1 change: 1 addition & 0 deletions
1
...mazon/smithy/aws/iam/traits/errorfiles/invalid-condition-key-also-service-resolved.errors
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
[ERROR] smithy.example#EchoInput$id1: This operation `smithy.example#Echo` scoped within the `smithy.example#MyService` service with member `smithy.example#EchoInput$id1` refers to a condition key `smithy:ServiceResolveContextKey` that is also resolved by service. | ConditionKeys |
Oops, something went wrong.