refactor(iam): extract CreateRoleInput from create_role#355
Merged
vieiralucas merged 1 commit intomainfrom Apr 13, 2026
Merged
Conversation
The parse + validate prologue of create_role was 28 lines (RoleName, AssumeRolePolicyDocument, Path, Description, MaxSessionDuration, Tags + tag validation, PermissionsBoundary + ARN format check). Extract into CreateRoleInput::from_query so create_role itself is a 35-line state-mutation flow. get_role (16L) and list_roles (68L) audited in the same pass and judged already clean: get_role is a one-shot lookup with one error path; list_roles is a clear sequence of validate → filter by path prefix → sort → marker-paginate → render, with each phase short and focused.
vieiralucas
added a commit
that referenced
this pull request
Apr 13, 2026
…Input The two longest functions in the SSM sub-modules were create_patch_baseline (~150 lines) and create_association_inner (~162 lines). Both were dominated by body parsing, field validation, and field extraction — with the actual state mutation only in the last 30-40 lines. This extracts dedicated *Input structs with from_body() constructors, leaving each function focused on idempotency, ID generation, and struct assembly. Same pattern as PRs #324/#328/#338/#355/#356.
2 tasks
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The parse + validate prologue of `create_role` was 28 lines: RoleName, AssumeRolePolicyDocument, Path, Description, MaxSessionDuration, Tags + tag validation, PermissionsBoundary + ARN format check. Extract `CreateRoleInput::from_query` so `create_role` itself is a 35-line state-mutation flow.
Audited and judged already-clean
Test plan
Summary by cubic
Refactored IAM
create_roleby extracting parsing and validation intoCreateRoleInput::from_query, keepingcreate_rolefocused on state mutation. No behavior changes.CreateRoleInputwithfrom_queryto encapsulate:create_roleto constructIamRolefromCreateRoleInput.get_roleandlist_roles; left unchanged.Written for commit a345221. Summary will update on new commits.