refactor(ssm): split long parameter, document, command, and maintenance ops#325
Merged
vieiralucas merged 1 commit intomainfrom Apr 13, 2026
Merged
refactor(ssm): split long parameter, document, command, and maintenance ops#325vieiralucas merged 1 commit intomainfrom
vieiralucas merged 1 commit intomainfrom
Conversation
…ce ops Four SSM operations were carrying enough inline parsing/duplication to obscure their actual work. - parameters: get_parameter and get_parameters both built the same 'historical version Value' inline (same json! body, same SecureString masking, repeated three times across the two functions). Move that into build_param_history_value so each call site is one line. - documents: get_document had a 35-line if/else chain to resolve which SsmDocumentVersion the request was asking for (VersionName + DocumentVersion combinations, plus '$LATEST', plus default). Move it into select_document_version, a pure function over (doc, version, version_name) that returns Option<&SsmDocumentVersion>. - commands: send_command's first 80 lines were entirely body parsing and validation. Move them into SendCommandInput::from_body so the operation body just constructs SsmCommand, persists it, and shapes the response. - maintenance: same treatment for create_maintenance_window — pull the field-by-field validation and parsing into CreateMaintenanceWindowInput::from_body. The operation body keeps the idempotency check + state insertion which is the part that actually mutates state. No behavior change. Same lock semantics, same error messages.
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
Four SSM operations were carrying enough inline parsing/duplication to obscure their actual work.
No behavior change. Same lock semantics, same error messages.
Test plan
Summary by cubic
Refactored SSM handlers to move heavy parsing and version selection into small helpers. The handlers are shorter, easier to read, and behavior is unchanged.
build_param_history_valueto build historical values and apply SecureString masking; simplifiedget_parameter/get_parameters.select_document_versionto handleDocumentVersion/VersionName(incl.$LATESTand default);get_documentstays defaulting to JSON when format isn’t specified.SendCommandInput::from_bodyfor request parsing/validation;send_commandnow focuses on constructingSsmCommand, persisting, and shaping the response.CreateMaintenanceWindowInput::from_body; operation keeps theClientTokenidempotency check and state insertion.Written for commit 89f9fdf. Summary will update on new commits.