mirror of
https://github.com/floci-io/floci.git
synced 2026-11-30 08:55:17 -05:00
feat(ssm): support UnlabelParameterVersion (#5339)
* feat(ssm): support UnlabelParameterVersion
Remove one or more labels from a parameter version. Labels attached to
the version are returned in RemovedLabels; labels that are not on that
version, including ones attached to a different version, are returned in
InvalidLabels and left in place. A missing parameter is ParameterNotFound,
a missing version ParameterVersionNotFound, and an omitted ParameterVersion
or an empty or oversized label list a ValidationException.
* fix(ssm): match AWS errors and ordering in UnlabelParameterVersion
Verified against real AWS (us-east-1):
- Report every missing or invalid member in one ValidationException, in
the order name, parameterVersion, labels, and render the label list
the way AWS does ('[prod, ]').
- Reject a string or boolean ParameterVersion and a non-string Name or
label with SerializationException; truncate a fractional version and
clamp one outside the range of a long, as AWS does.
- Reject an ARN, a malformed or ssm-prefixed name, and deny an
aws-prefixed one before the lookup; ignore surrounding whitespace in
the lookup but echo the name as sent in error messages.
- Word ParameterVersionNotFound as AWS does.
- Return RemovedLabels in the order the labels are stored on the
version, and InvalidLabels in request order.
LabelParameterVersion shares the label-list parsing, so its label
validation messages and non-string labels now match AWS too.
* fix(ssm): take the service monitor when deleting parameters
PutParameter, LabelParameterVersion and UnlabelParameterVersion already
run under the SsmService monitor, but DeleteParameter and
DeleteParameters did not. A delete landing between a label or unlabel
call's lookup and its history write left orphaned history that a later
PutParameter of the same name appended to.
Also pin LabelParameterVersion's AWS-verified label validation messages
and its SerializationException for a non-string label in its own
integration test, and share the parameter-name format rule between the
two reserved-name messages.
This commit is contained in:
1 parent
07ebc33d28
commit
4f34a903fc
7 files changed
+651
-81
No files matched your search
@@ -45,6 +45,26 @@ class TestSSMParameter:
|
||||
finally:
|
||||
ssm_client.delete_parameter(Name=param_name)
|
||||
|
||||
def test_unlabel_parameter_version(self, ssm_client, unique_name):
|
||||
"""Test UnlabelParameterVersion removes attached labels and reports the rest."""
|
||||
param_name = f"/pytest-sdk-test/{unique_name}"
|
||||
|
||||
ssm_client.put_parameter(Name=param_name, Value="value", Type="String")
|
||||
try:
|
||||
ssm_client.label_parameter_version(
|
||||
Name=param_name, Labels=["py-prod", "py-stable"], ParameterVersion=1
|
||||
)
|
||||
response = ssm_client.unlabel_parameter_version(
|
||||
Name=param_name, Labels=["py-prod", "py-missing"], ParameterVersion=1
|
||||
)
|
||||
assert response["RemovedLabels"] == ["py-prod"]
|
||||
assert response["InvalidLabels"] == ["py-missing"]
|
||||
|
||||
history = ssm_client.get_parameter_history(Name=param_name)
|
||||
assert history["Parameters"][0]["Labels"] == ["py-stable"]
|
||||
finally:
|
||||
ssm_client.delete_parameter(Name=param_name)
|
||||
|
||||
def test_get_parameter_history(self, ssm_client, unique_name):
|
||||
"""Test GetParameterHistory returns parameter versions."""
|
||||
param_name = f"/pytest-sdk-test/{unique_name}"
|
||||
|
||||
Reference in new issue
Block a user