use of software.amazon.awssdk.services.iam.IamClient in project aws-doc-sdk-examples by awsdocs.
the class DeleteAccessKey method main.
public static void main(String[] args) {
final String USAGE = "\n" + "Usage:\n" + " <username> <accessKey> \n\n" + "Where:\n" + " username - the name of the user. \n\n" + " accessKey - the access key ID for the secret access key you want to delete. \n\n";
if (args.length != 2) {
System.out.println(USAGE);
System.exit(1);
}
String username = args[0];
String accessKey = args[1];
Region region = Region.AWS_GLOBAL;
IamClient iam = IamClient.builder().region(region).build();
deleteKey(iam, username, accessKey);
iam.close();
}
use of software.amazon.awssdk.services.iam.IamClient in project aws-doc-sdk-examples by awsdocs.
the class DeletePolicy method main.
public static void main(String[] args) {
final String USAGE = "\n" + "Usage:\n" + " <policyARN> \n\n" + "Where:\n" + " policyARN - a policy ARN value to delete. \n\n";
if (args.length != 1) {
System.out.println(USAGE);
System.exit(1);
}
String policyARN = args[0];
Region region = Region.AWS_GLOBAL;
IamClient iam = IamClient.builder().region(region).build();
deleteIAMPolicy(iam, policyARN);
iam.close();
}
use of software.amazon.awssdk.services.iam.IamClient in project aws-doc-sdk-examples by awsdocs.
the class CreatePolicy method main.
// snippet-end:[iam.java2.create_policy.policy_document]
public static void main(String[] args) {
final String USAGE = "\n" + "Usage:\n" + " CreatePolicy <policyName> \n\n" + "Where:\n" + " policyName - a unique policy name. \n\n";
if (args.length != 1) {
System.out.println(USAGE);
System.exit(1);
}
String policyName = args[0];
Region region = Region.AWS_GLOBAL;
IamClient iam = IamClient.builder().region(region).build();
String result = createIAMPolicy(iam, policyName);
System.out.println("Successfully created a policy with this ARN value: " + result);
iam.close();
}
use of software.amazon.awssdk.services.iam.IamClient in project aws-doc-sdk-examples by awsdocs.
the class CreateUser method main.
public static void main(String[] args) {
final String USAGE = "\n" + "Usage:\n" + " <username> \n\n" + "Where:\n" + " username - the name of the user to create. \n\n";
if (args.length != 1) {
System.out.println(USAGE);
System.exit(1);
}
String username = args[0];
Region region = Region.AWS_GLOBAL;
IamClient iam = IamClient.builder().region(region).build();
String result = createIAMUser(iam, username);
System.out.println("Successfully created user: " + result);
iam.close();
}
use of software.amazon.awssdk.services.iam.IamClient in project aws-doc-sdk-examples by awsdocs.
the class DeleteServerCertificate method main.
public static void main(String[] args) {
final String USAGE = "\n" + "Usage:\n" + " <certName> \n\n" + "Where:\n" + " certName - a certificate name to delete. \n\n";
if (args.length != 1) {
System.out.println(USAGE);
System.exit(1);
}
String certName = args[0];
Region region = Region.AWS_GLOBAL;
IamClient iam = IamClient.builder().region(region).build();
deleteCert(iam, certName);
System.out.println("Done");
iam.close();
}
Aggregations