Java源码示例:com.amazonaws.services.identitymanagement.model.GetRolePolicyRequest
示例1
/**
* Gets the inline role policy.
*
* @param roleName
* the role name
* @param policyName
* the policy name
* @param amazonIdentityManagement
* the amazon identity management
* @return the inline role policy
*/
private static Policy getInlineRolePolicy(String roleName, String policyName,
AmazonIdentityManagement amazonIdentityManagement) {
Policy policy = new Policy();
try {
GetRolePolicyRequest policyRequest = new GetRolePolicyRequest();
policyRequest.setRoleName(roleName);
policyRequest.setPolicyName(policyName);
GetRolePolicyResult policyResult = amazonIdentityManagement.getRolePolicy(policyRequest);
String policyAsString = policyResult.getPolicyDocument();
policyAsString = java.net.URLDecoder.decode(policyAsString, "UTF-8");
policy = Policy.fromJson(policyAsString);
} catch (Exception e) {
logger.error(e.getMessage());
}
return policy;
}
示例2
private String fetchMainPolicy(String roleName, AmazonIdentityManagementClient iamClient) {
return Optional.of(new GetRolePolicyRequest().withRoleName(roleName).withPolicyName(roleName))
.map(iamClient::getRolePolicy)
.map(GetRolePolicyResult::getPolicyDocument)
.map(PolicyProviderImpl::urlDecode)
.orElse(EMPTY_JSON);
}
示例3
@Override
public boolean load(GetRolePolicyRequest request) {
return load(request, null);
}
示例4
@Override
public boolean load(GetRolePolicyRequest request,
ResultCapture<GetRolePolicyResult> extractor) {
return resource.load(request, extractor);
}
示例5
/**
* Makes a call to the service to load this resource's attributes if they
* are not loaded yet.
* The following request parameters will be populated from the data of this
* <code>RolePolicy</code> resource, and any conflicting parameter value set
* in the request will be overridden:
* <ul>
* <li>
* <b><code>RoleName</code></b>
* - mapped from the <code>RoleName</code> identifier.
* </li>
* <li>
* <b><code>PolicyName</code></b>
* - mapped from the <code>Name</code> identifier.
* </li>
* </ul>
*
* <p>
*
* @return Returns {@code true} if the resource is not yet loaded when this
* method was invoked, which indicates that a service call has been
* made to retrieve the attributes.
* @see GetRolePolicyRequest
*/
boolean load(GetRolePolicyRequest request);
示例6
/**
* Makes a call to the service to load this resource's attributes if they
* are not loaded yet, and use a ResultCapture to retrieve the low-level
* client response
* The following request parameters will be populated from the data of this
* <code>RolePolicy</code> resource, and any conflicting parameter value set
* in the request will be overridden:
* <ul>
* <li>
* <b><code>RoleName</code></b>
* - mapped from the <code>RoleName</code> identifier.
* </li>
* <li>
* <b><code>PolicyName</code></b>
* - mapped from the <code>Name</code> identifier.
* </li>
* </ul>
*
* <p>
*
* @return Returns {@code true} if the resource is not yet loaded when this
* method was invoked, which indicates that a service call has been
* made to retrieve the attributes.
* @see GetRolePolicyRequest
*/
boolean load(GetRolePolicyRequest request,
ResultCapture<GetRolePolicyResult> extractor);