-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
feat: remote invoke context initial impl #5183
feat: remote invoke context initial impl #5183
Conversation
f"please provide --resource-id to resolve ambiguity." | ||
) | ||
|
||
raise NoResourceFoundForRemoteInvoke( |
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 we do a if not resource_summaries
here first.
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.
Since we already exhausted all other options above, I was just raising the exception here. If you think that would be useful, I can add a comment on top of it to state this is the case where we don't have any resource summaries at all.
_boto_client_provider: BotoProviderType | ||
_boto_resource_provider: BotoProviderType | ||
_stack_name: Optional[str] | ||
_resource_id: Optional[str] | ||
_resource_summary: Optional[CloudFormationResourceSummary] |
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.
Curious: Why define this here? Is there some advantage this has?
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 makes it more explicit about all the fields and their types that will/may be instantiated in this class. Mypy doesn't need to implicitly find their types from assignments. I know it is more verbose but I personally find this way more readable :)
if not self._stack_name and not self._resource_id: | ||
raise InvalidRemoteInvokeParameters("Either --stack-name or --resource-id parameter should be provided") |
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 this check be in the "cli" part instead of the context? More a nit/question on where the validation of parameters happens (assuming this are parameters)
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.
🤔 agreed on this one, this validation can be moved up to command.py
through click
. @hnnasit what do you think?
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.
I think that makes sense. We will also have another validation for payload
and payload-file
in command.py. We can move the above validation to cli 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.
Regarding to this one, I feel weird when removing this validation since typing system can't guarantee one or the other field should have a value. After discussing with @hnnasit we decided to keep it here as well as adding it to the command.py
implementation later.
Adds
RemoteInvokeContext
class implementation with following validations;stack_name
orresource_id
is provided, it fails withInvalidRemoteInvokeParameters
stack_name
is provided;AmbiguousResourceForRemoteInvoke
NoResourceFoundForRemoteInvoke
resource_id
is provided;resource_id
is a valid ARN from supported resource, continues executionresource_id
is a validphysical_resource_id
in a deployed stack, continues executionresource_id
is an invalidphysical_resource_id
(where it can't be find by CFN API call), fails withAmbiguousResourceForRemoteInvoke
Mandatory Checklist
PRs will only be reviewed after checklist is complete
make pr
passesmake update-reproducible-reqs
if dependencies were changedBy submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.