use of software.amazon.awssdk.services.iam.IamClient in project aws-doc-sdk-examples by awsdocs.
the class DetachRolePolicy method main.
public static void main(String[] args) {
final String USAGE = "\n" + "Usage:\n" + " <roleName> <policyArn> \n\n" + "Where:\n" + " roleName - a role name that you can obtain from the AWS Management Console. \n\n" + " policyArn - a policy ARN that you can obtain from the AWS Management Console. \n\n";
if (args.length != 2) {
System.out.println(USAGE);
System.exit(1);
}
String roleName = args[0];
String policyArn = args[1];
Region region = Region.AWS_GLOBAL;
IamClient iam = IamClient.builder().region(region).build();
detachPolicy(iam, roleName, policyArn);
System.out.println("Done");
iam.close();
}
use of software.amazon.awssdk.services.iam.IamClient in project aws-doc-sdk-examples by awsdocs.
the class ListServerCertificates method main.
public static void main(String[] args) {
Region region = Region.AWS_GLOBAL;
IamClient iam = IamClient.builder().region(region).build();
listCertificates(iam);
System.out.println("Done");
iam.close();
}
use of software.amazon.awssdk.services.iam.IamClient in project aws-doc-sdk-examples by awsdocs.
the class UpdateAccessKey method main.
public static void main(String[] args) {
final String USAGE = "\n" + "Usage:\n" + " <username> <accessId> <status> \n\n" + "Where:\n" + " username - the name of the user whose key you want to update. \n\n" + " accessId - the access key ID of the secret access key you want to update. \n\n" + " status - the status you want to assign to the secret access key. \n\n";
if (args.length != 3) {
System.out.println(USAGE);
System.exit(1);
}
String username = args[0];
String accessId = args[1];
String status = args[2];
Region region = Region.AWS_GLOBAL;
IamClient iam = IamClient.builder().region(region).build();
updateKey(iam, username, accessId, status);
System.out.println("Done");
iam.close();
}
use of software.amazon.awssdk.services.iam.IamClient in project aws-doc-sdk-examples by awsdocs.
the class CreateAccessKey method main.
public static void main(String[] args) {
final String USAGE = "\n" + "Usage:\n" + " <user> \n\n" + "Where:\n" + " user - an AWS IAM user that you can obtain from the AWS Management Console.\n\n";
if (args.length != 1) {
System.out.println(USAGE);
System.exit(1);
}
String user = args[0];
Region region = Region.AWS_GLOBAL;
IamClient iam = IamClient.builder().region(region).build();
String keyId = createIAMAccessKey(iam, user);
System.out.println("The Key Id is " + keyId);
iam.close();
}
use of software.amazon.awssdk.services.iam.IamClient in project aws-doc-sdk-examples by awsdocs.
the class DeleteAccountAlias method main.
public static void main(String[] args) {
final String USAGE = "\n" + "Usage:\n" + " <alias> \n\n" + "Where:\n" + " alias - the account alias to delete. \n\n";
if (args.length != 1) {
System.out.println(USAGE);
System.exit(1);
}
String alias = args[0];
Region region = Region.AWS_GLOBAL;
IamClient iam = IamClient.builder().region(region).build();
deleteIAMAccountAlias(iam, alias);
iam.close();
}
Aggregations