com.amazonaws.services.identitymanagement.model.ListRolePoliciesRequest Java Examples

The following examples show how to use com.amazonaws.services.identitymanagement.model.ListRolePoliciesRequest. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: IAMUtils.java    From pacbot with Apache License 2.0 6 votes vote down vote up
/**
 * Gets the inline role policy.
 *
 * @param roleName
 *            the role name
 * @param amazonIdentityManagement
 *            the amazon identity management
 * @param actionSet
 *            the action set
 * @return the inline role policy
 */
private static Set<String> getInlineRolePolicyActionSet(String roleName,
		AmazonIdentityManagementClient amazonIdentityManagement) {
	Set<String> actionSet = new HashSet<>();

	List<String> inlineRolePolicyNameList = new ArrayList<>();
	ListRolePoliciesRequest listRolePoliciesRequest = new ListRolePoliciesRequest();
	listRolePoliciesRequest.setRoleName(roleName);
	ListRolePoliciesResult listRolePoliciesResult = null;
	do {
		listRolePoliciesResult = amazonIdentityManagement.listRolePolicies(listRolePoliciesRequest);
		inlineRolePolicyNameList.addAll(listRolePoliciesResult.getPolicyNames());
		listRolePoliciesRequest.setMarker(listRolePoliciesResult.getMarker());
	} while (listRolePoliciesResult.isTruncated());

	for (String policyName : inlineRolePolicyNameList) {
		Policy policy = getInlineRolePolicy(roleName, policyName, amazonIdentityManagement);
		actionSet.addAll(getActionSet(policy));
	}
	return actionSet;
}
 
Example #2
Source File: PolicyProviderImpl.java    From fullstop with Apache License 2.0 5 votes vote down vote up
private Set<String> fetchInlinePolicyNames(String roleName, AmazonIdentityManagementClient iamClient) {
    return Optional.of(new ListRolePoliciesRequest().withRoleName(roleName))
            .map(iamClient::listRolePolicies)
            .map(ListRolePoliciesResult::getPolicyNames)
            .map(nameList -> nameList.stream().collect(toSet()))
            .orElseGet(Collections::emptySet);
}
 
Example #3
Source File: RoleImpl.java    From aws-sdk-java-resources with Apache License 2.0 5 votes vote down vote up
@Override
public RolePolicyCollection getPolicies(ListRolePoliciesRequest request) {
    ResourceCollectionImpl result = resource.getCollection("Policies",
            request);

    if (result == null) return null;
    return new RolePolicyCollectionImpl(result);
}
 
Example #4
Source File: Role.java    From aws-sdk-java-resources with Apache License 2.0 2 votes vote down vote up
/**
 * Retrieves the Policies collection referenced by this resource.
 */
RolePolicyCollection getPolicies(ListRolePoliciesRequest request);