本文整理汇总了Java中com.amazonaws.services.identitymanagement.model.ListRolePoliciesRequest类的典型用法代码示例。如果您正苦于以下问题:Java ListRolePoliciesRequest类的具体用法?Java ListRolePoliciesRequest怎么用?Java ListRolePoliciesRequest使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ListRolePoliciesRequest类属于com.amazonaws.services.identitymanagement.model包,在下文中一共展示了ListRolePoliciesRequest类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: fetchInlinePolicyNames
import com.amazonaws.services.identitymanagement.model.ListRolePoliciesRequest; //导入依赖的package包/类
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);
}
示例2: getPolicies
import com.amazonaws.services.identitymanagement.model.ListRolePoliciesRequest; //导入依赖的package包/类
@Override
public RolePolicyCollection getPolicies(ListRolePoliciesRequest request) {
ResourceCollectionImpl result = resource.getCollection("Policies",
request);
if (result == null) return null;
return new RolePolicyCollectionImpl(result);
}
示例3: validateInstanceProfileCreation
import com.amazonaws.services.identitymanagement.model.ListRolePoliciesRequest; //导入依赖的package包/类
private void validateInstanceProfileCreation(AwsCredentialView awsCredentialView) {
GetRoleRequest roleRequest = new GetRoleRequest();
String roleName = awsCredentialView.getRoleArn().split("/")[1];
LOGGER.info("Start validate {} role for S3 access.", roleName);
roleRequest.withRoleName(roleName);
AmazonIdentityManagement client = awsClient.createAmazonIdentityManagement(awsCredentialView);
try {
ListRolePoliciesRequest listRolePoliciesRequest = new ListRolePoliciesRequest();
listRolePoliciesRequest.setRoleName(roleName);
ListRolePoliciesResult listRolePoliciesResult = client.listRolePolicies(listRolePoliciesRequest);
for (String s : listRolePoliciesResult.getPolicyNames()) {
if (checkIamOrS3Statement(roleName, client, s)) {
LOGGER.info("Validation successful for s3 or iam access.");
return;
}
}
ListAttachedRolePoliciesRequest listAttachedRolePoliciesRequest = new ListAttachedRolePoliciesRequest();
listAttachedRolePoliciesRequest.setRoleName(roleName);
ListAttachedRolePoliciesResult listAttachedRolePoliciesResult = client.listAttachedRolePolicies(listAttachedRolePoliciesRequest);
for (AttachedPolicy attachedPolicy : listAttachedRolePoliciesResult.getAttachedPolicies()) {
if (checkIamOrS3Access(client, attachedPolicy)) {
LOGGER.info("Validation successful for s3 or iam access.");
return;
}
}
} catch (AmazonServiceException ase) {
if (ase.getStatusCode() == UNAUTHORIZED) {
String policyMEssage = "Could not get policies on the role because the arn role do not have enough permission: %s";
LOGGER.info(String.format(policyMEssage, ase.getErrorMessage()));
throw new CloudConnectorException(String.format(policyMEssage, ase.getErrorMessage()));
} else {
LOGGER.info(ase.getMessage());
throw new CloudConnectorException(ase.getErrorMessage());
}
} catch (Exception e) {
LOGGER.info(e.getMessage());
throw new CloudConnectorException(e.getMessage());
}
LOGGER.info("Could not get policies on the role because the arn role do not have enough permission.");
throw new CloudConnectorException("Could not get policies on the role because the arn role do not have enough permission.");
}
示例4: getPolicies
import com.amazonaws.services.identitymanagement.model.ListRolePoliciesRequest; //导入依赖的package包/类
/**
* Retrieves the Policies collection referenced by this resource.
*/
RolePolicyCollection getPolicies(ListRolePoliciesRequest request);