use of software.amazon.awssdk.services.iam.IamClient in project aws-doc-sdk-examples by awsdocs.
the class UpdateUser method main.
public static void main(String[] args) {
final String USAGE = "\n" + "Usage:\n" + " <curName> <newName> \n\n" + "Where:\n" + " curName - the current user name. \n\n" + " newName - an updated user name. \n\n";
if (args.length != 2) {
System.out.println(USAGE);
System.exit(1);
}
String curName = args[0];
String newName = args[1];
Region region = Region.AWS_GLOBAL;
IamClient iam = IamClient.builder().region(region).build();
updateIAMUser(iam, curName, newName);
System.out.println("Done");
iam.close();
}
use of software.amazon.awssdk.services.iam.IamClient in project aws-doc-sdk-examples by awsdocs.
the class CreateAccountAlias method main.
public static void main(String[] args) {
final String USAGE = "\n" + "Usage:\n" + " <alias> \n\n" + "Where:\n" + " alias - the account alias to create (for example, myawsaccount). \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();
createIAMAccountAlias(iam, alias);
iam.close();
System.out.println("Done");
}
use of software.amazon.awssdk.services.iam.IamClient in project aws-doc-sdk-examples by awsdocs.
the class CreateRole method main.
public static void main(String[] args) {
final String USAGE = "\n" + "Usage:\n" + " <rolename> <fileLocation> \n\n" + "Where:\n" + " rolename - the name of the role to create. \n\n" + " fileLocation - the location of the JSON document that represents the trust policy. \n\n";
if (args.length != 2) {
System.out.println(USAGE);
System.exit(1);
}
String rolename = args[0];
String fileLocation = args[1];
Region region = Region.AWS_GLOBAL;
IamClient iam = IamClient.builder().region(region).build();
String result = createIAMRole(iam, rolename, fileLocation);
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 DeleteUser 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 delete. \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();
deleteIAMUser(iam, userName);
System.out.println("Done");
iam.close();
}
Aggregations