use of com.amazonaws.services.identitymanagement.AmazonIdentityManagement in project aws-doc-sdk-examples by awsdocs.
the class ListServerCertificates method main.
public static void main(String[] args) {
final AmazonIdentityManagement iam = AmazonIdentityManagementClientBuilder.defaultClient();
boolean done = false;
while (!done) {
ListServerCertificatesRequest request = new ListServerCertificatesRequest();
ListServerCertificatesResult response = iam.listServerCertificates(request);
for (ServerCertificateMetadata metadata : response.getServerCertificateMetadataList()) {
System.out.printf("Retrieved server certificate %s", metadata.getServerCertificateName());
}
request.setMarker(response.getMarker());
if (!response.getIsTruncated()) {
done = true;
}
}
}
use of com.amazonaws.services.identitymanagement.AmazonIdentityManagement in project aws-doc-sdk-examples by awsdocs.
the class UpdateAccessKey method main.
public static void main(String[] args) {
final String USAGE = "To run this example, supply a username, access key id and status\n" + "Ex: UpdateAccessKey <username> <access-key-id> <Activate|Inactive>\n";
if (args.length != 3) {
System.out.println(USAGE);
System.exit(1);
}
String username = args[0];
String access_id = args[1];
String status = args[2];
final AmazonIdentityManagement iam = AmazonIdentityManagementClientBuilder.defaultClient();
UpdateAccessKeyRequest request = new UpdateAccessKeyRequest().withAccessKeyId(access_id).withUserName(username).withStatus(status);
UpdateAccessKeyResult response = iam.updateAccessKey(request);
System.out.printf("Successfully updated status of access key %s to" + "status %s for user %s", access_id, status, username);
}
use of com.amazonaws.services.identitymanagement.AmazonIdentityManagement in project aws-doc-sdk-examples by awsdocs.
the class UpdateServerCertificate method main.
public static void main(String[] args) {
final String USAGE = "To run this example, supply the current certificate name and\n" + "a new name. Ex:\n\n" + "UpdateServerCertificate <current-name> <new-name>\n";
if (args.length != 2) {
System.out.println(USAGE);
System.exit(1);
}
String cur_name = args[0];
String new_name = args[1];
final AmazonIdentityManagement iam = AmazonIdentityManagementClientBuilder.defaultClient();
UpdateServerCertificateRequest request = new UpdateServerCertificateRequest().withServerCertificateName(cur_name).withNewServerCertificateName(new_name);
UpdateServerCertificateResult response = iam.updateServerCertificate(request);
System.out.printf("Successfully updated server certificate to name %s", new_name);
}
use of com.amazonaws.services.identitymanagement.AmazonIdentityManagement in project aws-doc-sdk-examples by awsdocs.
the class ListAccountAliases method main.
public static void main(String[] args) {
final AmazonIdentityManagement iam = AmazonIdentityManagementClientBuilder.defaultClient();
ListAccountAliasesResult response = iam.listAccountAliases();
for (String alias : response.getAccountAliases()) {
System.out.printf("Retrieved account alias %s", alias);
}
}
use of com.amazonaws.services.identitymanagement.AmazonIdentityManagement in project aws-doc-sdk-examples by awsdocs.
the class CreateAccessKey method main.
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());
}
Aggregations