本文整理汇总了Java中com.amazonaws.services.identitymanagement.AmazonIdentityManagementClientBuilder类的典型用法代码示例。如果您正苦于以下问题:Java AmazonIdentityManagementClientBuilder类的具体用法?Java AmazonIdentityManagementClientBuilder怎么用?Java AmazonIdentityManagementClientBuilder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AmazonIdentityManagementClientBuilder类属于com.amazonaws.services.identitymanagement包,在下文中一共展示了AmazonIdentityManagementClientBuilder类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: client
import com.amazonaws.services.identitymanagement.AmazonIdentityManagementClientBuilder; //导入依赖的package包/类
private AmazonIdentityManagement client() {
return AmazonIdentityManagementClientBuilder.standard()
.withCredentials(new AWSStaticCredentialsProvider(new AWSCredentials() {
@Override
public String getAWSAccessKeyId() {
return bookmark.getCredentials().getUsername();
}
@Override
public String getAWSSecretKey() {
return bookmark.getCredentials().getPassword();
}
}))
.withClientConfiguration(configuration)
.withRegion(Regions.DEFAULT_REGION).build();
}
开发者ID:iterate-ch,项目名称:cyberduck,代码行数:17,代码来源:AmazonIdentityConfiguration.java
示例2: addRolesToIdentityPool
import com.amazonaws.services.identitymanagement.AmazonIdentityManagementClientBuilder; //导入依赖的package包/类
void addRolesToIdentityPool(String unauthenticatedRoleName, String unauthenticatedRole,
String authenticatedRoleName, String authenticatedRole, String identityPoolId,
AmazonCognitoIdentity client, LambdaLogger logger) {
// First update the roles to use the actual pool id in their conditions
logger
.log("Updating authenticated and unauthenticated roles to use the actual identity pool id: "
+ identityPoolId);
AmazonIdentityManagement iamClient = AmazonIdentityManagementClientBuilder.standard().build();
UpdateAssumeRolePolicyRequest updateAssumeRolePolicyRequest = new UpdateAssumeRolePolicyRequest();
updateAssumeRolePolicyRequest.setRoleName(unauthenticatedRoleName);
updateAssumeRolePolicyRequest.setPolicyDocument(getAssumeRolePolicyDocument(false,
identityPoolId, logger));
iamClient.updateAssumeRolePolicy(updateAssumeRolePolicyRequest);
updateAssumeRolePolicyRequest.setRoleName(authenticatedRoleName);
updateAssumeRolePolicyRequest.setPolicyDocument(getAssumeRolePolicyDocument(true,
identityPoolId, logger));
iamClient.updateAssumeRolePolicy(updateAssumeRolePolicyRequest);
// And add the updated roles to the pool
logger.log("Adding updated authenticated and unauthenticated roles to the identity pool");
SetIdentityPoolRolesRequest setIdentityPoolRolesRequest = new SetIdentityPoolRolesRequest();
setIdentityPoolRolesRequest.addRolesEntry("authenticated", authenticatedRole);
setIdentityPoolRolesRequest.addRolesEntry("unauthenticated", unauthenticatedRole);
setIdentityPoolRolesRequest.setIdentityPoolId(identityPoolId);
client.setIdentityPoolRoles(setIdentityPoolRolesRequest);
}
开发者ID:robinsteel,项目名称:Sqawsh,代码行数:27,代码来源:CognitoCustomResourceLambda.java
示例3: main
import com.amazonaws.services.identitymanagement.AmazonIdentityManagementClientBuilder; //导入依赖的package包/类
public static void main(String[] args) {
final String USAGE =
"To run this example, supply a username\n" +
"Ex: CreateUser <username>\n";
if (args.length != 1) {
System.out.println(USAGE);
System.exit(1);
}
String username = args[0];
final AmazonIdentityManagement iam =
AmazonIdentityManagementClientBuilder.defaultClient();
CreateUserRequest request = new CreateUserRequest()
.withUserName(username);
CreateUserResult response = iam.createUser(request);
System.out.println("Successfully created user: " +
response.getUser().getUserName());
}
开发者ID:awsdocs,项目名称:aws-doc-sdk-examples,代码行数:25,代码来源:CreateUser.java
示例4: main
import com.amazonaws.services.identitymanagement.AmazonIdentityManagementClientBuilder; //导入依赖的package包/类
public static void main(String[] args) {
final String USAGE =
"To run this example, supply a certificate name\n" +
"Ex: GetServerCertificate <certificate-name>\n";
if (args.length != 1) {
System.out.println(USAGE);
System.exit(1);
}
String cert_name = args[0];
final AmazonIdentityManagement iam =
AmazonIdentityManagementClientBuilder.defaultClient();
GetServerCertificateRequest request = new GetServerCertificateRequest()
.withServerCertificateName(cert_name);
GetServerCertificateResult response = iam.getServerCertificate(request);
System.out.format("Successfully retrieved certificate with body %s",
response.getServerCertificate().getCertificateBody());
}
开发者ID:awsdocs,项目名称:aws-doc-sdk-examples,代码行数:25,代码来源:GetServerCertificate.java
示例5: main
import com.amazonaws.services.identitymanagement.AmazonIdentityManagementClientBuilder; //导入依赖的package包/类
public static void main(String[] args) {
final String USAGE =
"To run this example, supply a policy arn\n" +
"Ex: GetPolicy <policy-arn>\n";
if (args.length != 1) {
System.out.println(USAGE);
System.exit(1);
}
String policy_arn = args[0];
final AmazonIdentityManagement iam =
AmazonIdentityManagementClientBuilder.defaultClient();
GetPolicyRequest request = new GetPolicyRequest()
.withPolicyArn(policy_arn);
GetPolicyResult response = iam.getPolicy(request);
System.out.format("Successfully retrieved policy %s",
response.getPolicy().getPolicyName());
}
开发者ID:awsdocs,项目名称:aws-doc-sdk-examples,代码行数:25,代码来源:GetPolicy.java
示例6: main
import com.amazonaws.services.identitymanagement.AmazonIdentityManagementClientBuilder; //导入依赖的package包/类
public static void main(String[] args) {
final String USAGE =
"To run this example, supply a certificate name\n" +
"Ex: DeleteServerCertificate <certificate-name>\n";
if (args.length != 1) {
System.out.println(USAGE);
System.exit(1);
}
String cert_name = args[0];
final AmazonIdentityManagement iam =
AmazonIdentityManagementClientBuilder.defaultClient();
DeleteServerCertificateRequest request =
new DeleteServerCertificateRequest()
.withServerCertificateName(cert_name);
DeleteServerCertificateResult response =
iam.deleteServerCertificate(request);
System.out.println("Successfully deleted server certificate " +
cert_name);
}
开发者ID:awsdocs,项目名称:aws-doc-sdk-examples,代码行数:27,代码来源:DeleteServerCertificate.java
示例7: main
import com.amazonaws.services.identitymanagement.AmazonIdentityManagementClientBuilder; //导入依赖的package包/类
public static void main(String[] args) {
final String USAGE =
"To run this example, supply a role name and policy arn\n" +
"Ex: DetachRolePolicy <role-name> <policy-arn>>\n";
if (args.length != 1) {
System.out.println(USAGE);
System.exit(1);
}
String role_name = args[0];
String policy_arn = args[1];
final AmazonIdentityManagement iam =
AmazonIdentityManagementClientBuilder.defaultClient();
DetachRolePolicyRequest request = new DetachRolePolicyRequest()
.withRoleName(role_name)
.withPolicyArn(policy_arn);
DetachRolePolicyResult response = iam.detachRolePolicy(request);
System.out.println("Successfully detached policy " + policy_arn +
" from role " + role_name);
}
开发者ID:awsdocs,项目名称:aws-doc-sdk-examples,代码行数:27,代码来源:DetachRolePolicy.java
示例8: main
import com.amazonaws.services.identitymanagement.AmazonIdentityManagementClientBuilder; //导入依赖的package包/类
public static void main(String[] args) {
final String USAGE =
"To run this example, supply an account alias\n" +
"Ex: DeleteAccountAlias <account-alias>\n";
if (args.length != 1) {
System.out.println(USAGE);
System.exit(1);
}
String alias = args[0];
final AmazonIdentityManagement iam =
AmazonIdentityManagementClientBuilder.defaultClient();
DeleteAccountAliasRequest request = new DeleteAccountAliasRequest()
.withAccountAlias(alias);
DeleteAccountAliasResult response = iam.deleteAccountAlias(request);
System.out.println("Successfully deleted account alias " + alias);
}
开发者ID:awsdocs,项目名称:aws-doc-sdk-examples,代码行数:24,代码来源:DeleteAccountAlias.java
示例9: main
import com.amazonaws.services.identitymanagement.AmazonIdentityManagementClientBuilder; //导入依赖的package包/类
public static void main(String[] args) {
final AmazonIdentityManagement iam =
AmazonIdentityManagementClientBuilder.defaultClient();
boolean done = false;
ListUsersRequest request = new ListUsersRequest();
while(!done) {
ListUsersResult response = iam.listUsers(request);
for(User user : response.getUsers()) {
System.out.format("Retrieved user %s", user.getUserName());
}
request.setMarker(response.getMarker());
if(!response.getIsTruncated()) {
done = true;
}
}
}
开发者ID:awsdocs,项目名称:aws-doc-sdk-examples,代码行数:23,代码来源:ListUsers.java
示例10: main
import com.amazonaws.services.identitymanagement.AmazonIdentityManagementClientBuilder; //导入依赖的package包/类
public static void main(String[] args) {
final String USAGE =
"To run this example, supply an IAM user\n" +
"Ex: CreateAccessKey <user>\n";
if (args.length != 1) {
System.out.println(USAGE);
System.exit(1);
}
String user = args[0];
final AmazonIdentityManagement iam =
AmazonIdentityManagementClientBuilder.defaultClient();
CreateAccessKeyRequest request = new CreateAccessKeyRequest()
.withUserName(user);
CreateAccessKeyResult response = iam.createAccessKey(request);
System.out.println("Created access key: " + response.getAccessKey());
}
开发者ID:awsdocs,项目名称:aws-doc-sdk-examples,代码行数:24,代码来源:CreateAccessKey.java
示例11: main
import com.amazonaws.services.identitymanagement.AmazonIdentityManagementClientBuilder; //导入依赖的package包/类
public static void main(String[] args) {
final String USAGE =
"To run this example, supply an access key id\n" +
"Ex: AccessKeyLastUsed <access-key-id>\n";
if (args.length != 1) {
System.out.println(USAGE);
System.exit(1);
}
String access_id = args[0];
final AmazonIdentityManagement iam =
AmazonIdentityManagementClientBuilder.defaultClient();
GetAccessKeyLastUsedRequest request = new GetAccessKeyLastUsedRequest()
.withAccessKeyId(access_id);
GetAccessKeyLastUsedResult response = iam.getAccessKeyLastUsed(request);
System.out.println("Access key was last used at: " +
response.getAccessKeyLastUsed().getLastUsedDate());
}
开发者ID:awsdocs,项目名称:aws-doc-sdk-examples,代码行数:25,代码来源:AccessKeyLastUsed.java
示例12: main
import com.amazonaws.services.identitymanagement.AmazonIdentityManagementClientBuilder; //导入依赖的package包/类
public static void main(String[] args) {
final String USAGE =
"To run this example, supply a policy name\n" +
"Ex: CreatePolicy <policy-name>\n";
if (args.length != 1) {
System.out.println(USAGE);
System.exit(1);
}
String policy_name = args[0];
final AmazonIdentityManagement iam =
AmazonIdentityManagementClientBuilder.defaultClient();
CreatePolicyRequest request = new CreatePolicyRequest()
.withPolicyName(policy_name)
.withPolicyDocument(POLICY_DOCUMENT);
CreatePolicyResult response = iam.createPolicy(request);
System.out.println("Successfully created policy: " +
response.getPolicy().getPolicyName());
}
开发者ID:awsdocs,项目名称:aws-doc-sdk-examples,代码行数:26,代码来源:CreatePolicy.java
示例13: main
import com.amazonaws.services.identitymanagement.AmazonIdentityManagementClientBuilder; //导入依赖的package包/类
public static void main(String[] args) {
final String USAGE =
"To run this example, supply a username and access key id\n" +
"Ex: DeleteAccessKey <username> <access-key-id>\n";
if (args.length != 2) {
System.out.println(USAGE);
System.exit(1);
}
String username = args[0];
String access_key = args[1];
final AmazonIdentityManagement iam =
AmazonIdentityManagementClientBuilder.defaultClient();
DeleteAccessKeyRequest request = new DeleteAccessKeyRequest()
.withAccessKeyId(access_key)
.withUserName(username);
DeleteAccessKeyResult response = iam.deleteAccessKey(request);
System.out.println("Successfully deleted access key " + access_key +
" from user " + username);
}
开发者ID:awsdocs,项目名称:aws-doc-sdk-examples,代码行数:27,代码来源:DeleteAccessKey.java
示例14: main
import com.amazonaws.services.identitymanagement.AmazonIdentityManagementClientBuilder; //导入依赖的package包/类
public static void main(String[] args) {
final String USAGE =
"To run this example, supply an alias\n" +
"Ex: CreateAccountAlias <alias>\n";
if (args.length != 1) {
System.out.println(USAGE);
System.exit(1);
}
String alias = args[0];
final AmazonIdentityManagement iam =
AmazonIdentityManagementClientBuilder.defaultClient();
CreateAccountAliasRequest request = new CreateAccountAliasRequest()
.withAccountAlias(alias);
CreateAccountAliasResult response = iam.createAccountAlias(request);
System.out.println("Successfully created account alias: " + alias);
}
开发者ID:awsdocs,项目名称:aws-doc-sdk-examples,代码行数:24,代码来源:CreateAccountAlias.java
示例15: execute
import com.amazonaws.services.identitymanagement.AmazonIdentityManagementClientBuilder; //导入依赖的package包/类
@Override
public void execute() throws MojoExecutionException, MojoFailureException {
Proxy proxy = new Proxy(httpsProxyHost, httpsProxyPort, httpsProxyUsername,
httpsProxyPassword);
AwsKeyPair keyPair = Util.getAwsKeyPair(serverId, awsAccessKey, awsSecretAccessKey,
settings, decrypter);
final AWSCredentialsProvider credentials = new AWSStaticCredentialsProvider(
new BasicAWSCredentials(keyPair.key, keyPair.secret));
ClientConfiguration cc = Util.createConfiguration(proxy);
AmazonIdentityManagement iam = AmazonIdentityManagementClientBuilder //
.standard() //
.withRegion(region) //
.withCredentials(credentials) //
.withClientConfiguration(cc) //
.build();
String accountId = iam.getUser().getUser().getUserId();
project.getProperties().setProperty("aws.account.id", accountId);
getLog().info("The following properties have been set for the project");
getLog().info("aws.account.id=" + accountId);
}
开发者ID:davidmoten,项目名称:aws-maven-plugin,代码行数:22,代码来源:AwsPropertyMojo.java
示例16: fromCredentials
import com.amazonaws.services.identitymanagement.AmazonIdentityManagementClientBuilder; //导入依赖的package包/类
public static PrincipalAutoSuggestion fromCredentials(AWSCredentialsProvider awsCredentials, ClientConfiguration clientConfiguration) {
AmazonIdentityManagement client = AmazonIdentityManagementClientBuilder.standard()
.withCredentials(awsCredentials)
.withClientConfiguration(transformAndVerifyOrThrow(clientConfiguration))
.withRegion(RegionResolver.getRegion())
.build();
return new PrincipalAutoSuggestion(client);
}
开发者ID:schibsted,项目名称:strongbox,代码行数:11,代码来源:PrincipalAutoSuggestion.java
示例17: fromCredentials
import com.amazonaws.services.identitymanagement.AmazonIdentityManagementClientBuilder; //导入依赖的package包/类
public static IAMPolicyManager fromCredentials(AWSCredentialsProvider awsCredentials, ClientConfiguration clientConfiguration) {
AmazonIdentityManagement client = AmazonIdentityManagementClientBuilder.standard()
.withCredentials(awsCredentials)
.withClientConfiguration(transformAndVerifyOrThrow(clientConfiguration))
.withRegion(RegionResolver.getRegion())
.build();
return new IAMPolicyManager(client, awsCredentials, clientConfiguration);
}
开发者ID:schibsted,项目名称:strongbox,代码行数:9,代码来源:IAMPolicyManager.java
示例18: cleanUpIAM
import com.amazonaws.services.identitymanagement.AmazonIdentityManagementClientBuilder; //导入依赖的package包/类
private static void cleanUpIAM(Regions testRegion, String testResourcePrefix, Date createdBeforeThreshold,
AWSCredentialsProvider awsCredentials) {
AmazonIdentityManagement iamClient = AmazonIdentityManagementClientBuilder.standard()
.withCredentials(awsCredentials)
.withRegion(testRegion)
.build();
IAMPolicyManager iamPolicyManager = IAMPolicyManager.fromCredentials(awsCredentials, new ClientConfiguration());
LOG.info("Cleaning IAM policies...");
ListPoliciesRequest listPoliciesRequest = new ListPoliciesRequest().withPathPrefix(IAMPolicyManager.PATH_PREFIX);
List<Policy> policies = iamClient.listPolicies(listPoliciesRequest).getPolicies();
for (Policy policy: policies) {
if (policy.getPolicyName().startsWith(testResourcePrefix) &&
policy.getCreateDate().before(createdBeforeThreshold)) {
LOG.info("Cleaning up policy: " + policy.getPolicyName());
IAMPolicyName iamPolicyName = IAMPolicyName.fromString(policy.getPolicyName());
iamPolicyManager.detachAllPrincipals(iamPolicyName.group);
DeletePolicyRequest deletePolicyRequest = new DeletePolicyRequest().withPolicyArn(policy.getArn());
iamClient.deletePolicy(deletePolicyRequest);
}
}
LOG.info("Cleaning IAM roles created for the assume role tests...");
ListRolesRequest listRolesRequest = new ListRolesRequest().withPathPrefix(IAMHelper.PATH);
List<Role> roles = iamClient.listRoles(listRolesRequest).getRoles();
for (Role role: roles) {
if (role.getRoleName().startsWith(AssumedRoleTestContext.ROLE_PREFIX) &&
role.getCreateDate().before(createdBeforeThreshold)) {
LOG.info("Cleaning up role: " + role.getRoleName());
DeleteRoleRequest deleteRoleRequest = new DeleteRoleRequest().withRoleName(role.getRoleName());
iamClient.deleteRole(deleteRoleRequest);
}
}
}
开发者ID:schibsted,项目名称:strongbox,代码行数:38,代码来源:IntegrationTestHelper.java
示例19: getAccountId
import com.amazonaws.services.identitymanagement.AmazonIdentityManagementClientBuilder; //导入依赖的package包/类
/**
* Method gets the aws accountId from the specified credentials.
*
* @param privateKeyId
* @param privateKey
* @return account ID
*/
private String getAccountId(String privateKeyId, String privateKey) {
AWSCredentials awsCredentials = new BasicAWSCredentials(privateKeyId, privateKey);
AWSStaticCredentialsProvider awsStaticCredentialsProvider = new AWSStaticCredentialsProvider(
awsCredentials);
AmazonIdentityManagementClientBuilder amazonIdentityManagementClientBuilder = AmazonIdentityManagementClientBuilder
.standard()
.withCredentials(awsStaticCredentialsProvider)
.withRegion(Regions.DEFAULT_REGION);
AmazonIdentityManagementClient iamClient = (AmazonIdentityManagementClient) amazonIdentityManagementClientBuilder
.build();
String userId = null;
try {
if ((iamClient.getUser() != null) && (iamClient.getUser().getUser() != null)
&& (iamClient.getUser().getUser().getArn() != null)) {
String arn = iamClient.getUser().getUser().getArn();
/*
* arn:aws:service:region:account:resource -> so limiting the split to 6 words and
* extracting the accountId which is 5th one in list. If the user is not authorized
* to perform iam:GetUser on that resource,still error mesage will have accountId
*/
userId = arn.split(":", 6)[4];
}
} catch (AmazonServiceException ex) {
if (ex.getErrorCode().compareTo("AccessDenied") == 0) {
String msg = ex.getMessage();
userId = msg.split(":", 7)[5];
} else {
logSevere("Exception getting the accountId %s", ex);
}
}
return userId;
}
开发者ID:vmware,项目名称:photon-model,代码行数:46,代码来源:AWSEndpointAdapterService.java
示例20: AAWSTest
import com.amazonaws.services.identitymanagement.AmazonIdentityManagementClientBuilder; //导入依赖的package包/类
public AAWSTest() {
super();
if (Config.has(Config.Key.IAM_ROLE_ARN)) {
final AWSSecurityTokenService sts = AWSSecurityTokenServiceClientBuilder.standard().withCredentials(new DefaultAWSCredentialsProviderChain()).build();
this.credentialsProvider = new STSAssumeRoleSessionCredentialsProvider.Builder(Config.get(Config.Key.IAM_ROLE_ARN), IAM_SESSION_NAME).withStsClient(sts).build();
} else {
this.credentialsProvider = new DefaultAWSCredentialsProviderChain();
}
this.ec2 = AmazonEC2ClientBuilder.standard().withCredentials(this.credentialsProvider).build();
this.iam = AmazonIdentityManagementClientBuilder.standard().withCredentials(this.credentialsProvider).build();
}
开发者ID:widdix,项目名称:aws-ec2-ssh,代码行数:12,代码来源:AAWSTest.java
注:本文中的com.amazonaws.services.identitymanagement.AmazonIdentityManagementClientBuilder类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论