mirror of
https://github.com/floci-io/floci.git
synced 2026-11-24 14:30:28 -05:00
feat(iam): add ListInstanceProfileTags (#4140)
TagInstanceProfile and UntagInstanceProfile already existed; the read side was missing. Mirrors ListUserTags's response shape, and sorts the result by tag key to match the documented AWS behavior. Also adds the instance-profile tag actions to AwsQueryController's IAM_ACTIONS fallback set, completing the Tag/Untag/List triple already present there for users, roles and policies. Covers the trio in the SDK compatibility suite (compatibility-tests), which previously had no instance-profile tagging coverage.
This commit is contained in:
1 parent
63c0c3ada5
commit
2f5aa99701
6 files changed
+170
No files matched your search
@@ -102,6 +102,7 @@ public class AwsQueryController {
|
||||
"TagUser", "UntagUser", "ListUserTags",
|
||||
"TagRole", "UntagRole", "ListRoleTags",
|
||||
"TagPolicy", "UntagPolicy", "ListPolicyTags",
|
||||
"TagInstanceProfile", "UntagInstanceProfile", "ListInstanceProfileTags",
|
||||
"CreateLoginProfile", "GetLoginProfile", "DeleteLoginProfile", "UpdateLoginProfile",
|
||||
"GenerateCredentialReport", "GetCredentialReport",
|
||||
"GetAccountSummary", "GetAccountAuthorizationDetails",
|
||||
|
||||
@@ -25,6 +25,7 @@ import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
@@ -122,6 +123,7 @@ public class IamQueryHandler {
|
||||
case "UntagRole" -> handleUntagRole(params);
|
||||
case "TagInstanceProfile" -> handleTagInstanceProfile(params);
|
||||
case "UntagInstanceProfile" -> handleUntagInstanceProfile(params);
|
||||
case "ListInstanceProfileTags" -> handleListInstanceProfileTags(params);
|
||||
case "ListRoleTags" -> handleListRoleTags(params);
|
||||
|
||||
// Managed Policies
|
||||
@@ -1522,4 +1524,13 @@ public class IamQueryHandler {
|
||||
iamService.untagInstanceProfile(getParam(params, "InstanceProfileName"), extractTagKeys(params));
|
||||
return Response.ok(AwsQueryResponse.envelopeNoResult("UntagInstanceProfile", AwsNamespaces.IAM)).build();
|
||||
}
|
||||
|
||||
private Response handleListInstanceProfileTags(MultivaluedMap<String, String> params) {
|
||||
String instanceProfileName = getParam(params, "InstanceProfileName");
|
||||
// AWS documents the result as sorted by tag key.
|
||||
Map<String, String> tags = new TreeMap<>(iamService.listInstanceProfileTags(instanceProfileName));
|
||||
String result = new XmlBuilder().start("Tags").raw(tagsXml(tags)).end("Tags")
|
||||
.elem("IsTruncated", false).build();
|
||||
return Response.ok(AwsQueryResponse.envelope("ListInstanceProfileTags", AwsNamespaces.IAM, result)).build();
|
||||
}
|
||||
}
|
||||
@@ -2633,4 +2633,8 @@ public class IamService implements SessionAccountLookup, ResourceProvider {
|
||||
tagKeys.forEach(profile.getTags()::remove);
|
||||
instanceProfiles.put(instanceProfileName, profile);
|
||||
}
|
||||
|
||||
public Map<String, String> listInstanceProfileTags(String instanceProfileName) {
|
||||
return getInstanceProfile(instanceProfileName).getTags();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user