-
Notifications
You must be signed in to change notification settings - Fork 218
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding IAM Action name trait to override using the API operation name #1665
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- This will need updates to the specification, that'd be in
aws-iam.rst
in thedocs
folder. - Java files should use the short-form license header (see Prefer short-form license header #1614)
smithy-aws-iam-traits/.gitignore
Outdated
@@ -0,0 +1,3 @@ | |||
gradle/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can remove this, the top level .gitignore
should handle these.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -5,3 +5,4 @@ software.amazon.smithy.aws.iam.traits.DisableConditionKeyInferenceTrait$Provider | |||
software.amazon.smithy.aws.iam.traits.RequiredActionsTrait$Provider | |||
software.amazon.smithy.aws.iam.traits.SupportedPrincipalTypesTrait$Provider | |||
software.amazon.smithy.aws.iam.traits.IamResourceTrait$Provider | |||
software.amazon.smithy.aws.iam.traits.ActionNameTrait$Provider |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: should have a trailing newline.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added
smithy-aws-iam-traits/src/main/java/software/amazon/smithy/aws/iam/traits/ActionNameTrait.java
Show resolved
Hide resolved
}, | ||
"traits": { | ||
"smithy.api#trait": { | ||
"selector": ":test(operation, member)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds like this should be "operation"
, given the documentation. Tests should be updated to reflect this as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -0,0 +1,17 @@ | |||
$version: "1.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be a v2 model.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
Thanks, made updates.
updated
updated |
docs/source-2.0/aws/aws-iam.rst
Outdated
.. smithy-trait:: aws.iam#actionName | ||
.. _aws.iam#actionName-trait: | ||
|
||
------------------------------- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The -
wrapping needs to be the same length as the header content.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
docs/source-2.0/aws/aws-iam.rst
Outdated
------------------------------- | ||
|
||
Summary | ||
Provides the ability to override the default action name for the operation. By convention, the action name is the same as the operation name. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you wrap the new contents at 80 chars like the rest of the spec?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Simplify the summary to "Provides a custom IAM action name." since the rest is duplicate information with somewhere else in the spec.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
docs/source-2.0/aws/aws-iam.rst
Outdated
Summary | ||
Provides the ability to override the default action name for the operation. By convention, the action name is the same as the operation name. | ||
Trait selector | ||
``:test(operation)`` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't need to be wrapped in :test()
.
"smithy.api#trait": { | ||
"selector": "operation" | ||
}, | ||
"smithy.api#documentation": "Provides the ability to override the default action name for the operation. By convention, the action name is the same as the operation name." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/convention/default
Replace the first sentence with the one recommended for the spec.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
docs/source-2.0/aws/aws-iam.rst
Outdated
Value type | ||
``string`` | ||
|
||
Operations not annotated with the ``actionName`` trait use the operation name as the action name. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Defaults to the :ref:`shape name of the shape ID ` of the targeted operation
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
docs/source-2.0/aws/aws-iam.rst
Outdated
|
||
The following example defines two operations: | ||
|
||
* OperationA is not annoated with the ``actionName`` trait, so has the action name ``OperationA`` which is the same as the operation name. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- The first
OperationA
should be in double backticks. - s/annoated/annotated
- "so has the action name
OperationA
which is the same as the operation name." -> and resolves the action name ofOperationA
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
docs/source-2.0/aws/aws-iam.rst
Outdated
The following example defines two operations: | ||
|
||
* OperationA is not annoated with the ``actionName`` trait, so has the action name ``OperationA`` which is the same as the operation name. | ||
* OperationB has the ``actionName`` trait, so has the action name ``OverridingActionName``. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OperationB
should be in double backticks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
Issue #, if available:
Description of changes:
Adds the ActionName trait to override using the API operation name as the IAM action name. Also, allows adding additional actions using the input member field if the value is not null in the request.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.