Search in sources :

Example 1 with AmazonIdentityManagement

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;
        }
    }
}
Also used : ServerCertificateMetadata(com.amazonaws.services.identitymanagement.model.ServerCertificateMetadata) ListServerCertificatesRequest(com.amazonaws.services.identitymanagement.model.ListServerCertificatesRequest) AmazonIdentityManagement(com.amazonaws.services.identitymanagement.AmazonIdentityManagement) ListServerCertificatesResult(com.amazonaws.services.identitymanagement.model.ListServerCertificatesResult)

Example 2 with AmazonIdentityManagement

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);
}
Also used : UpdateAccessKeyRequest(com.amazonaws.services.identitymanagement.model.UpdateAccessKeyRequest) AmazonIdentityManagement(com.amazonaws.services.identitymanagement.AmazonIdentityManagement) UpdateAccessKeyResult(com.amazonaws.services.identitymanagement.model.UpdateAccessKeyResult)

Example 3 with AmazonIdentityManagement

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);
}
Also used : UpdateServerCertificateResult(com.amazonaws.services.identitymanagement.model.UpdateServerCertificateResult) AmazonIdentityManagement(com.amazonaws.services.identitymanagement.AmazonIdentityManagement) UpdateServerCertificateRequest(com.amazonaws.services.identitymanagement.model.UpdateServerCertificateRequest)

Example 4 with AmazonIdentityManagement

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);
    }
}
Also used : ListAccountAliasesResult(com.amazonaws.services.identitymanagement.model.ListAccountAliasesResult) AmazonIdentityManagement(com.amazonaws.services.identitymanagement.AmazonIdentityManagement)

Example 5 with AmazonIdentityManagement

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());
}
Also used : CreateAccessKeyResult(com.amazonaws.services.identitymanagement.model.CreateAccessKeyResult) CreateAccessKeyRequest(com.amazonaws.services.identitymanagement.model.CreateAccessKeyRequest) AmazonIdentityManagement(com.amazonaws.services.identitymanagement.AmazonIdentityManagement)

Aggregations

AmazonIdentityManagement (com.amazonaws.services.identitymanagement.AmazonIdentityManagement)22 AmazonServiceException (com.amazonaws.AmazonServiceException)2 AttachedPolicy (com.amazonaws.services.identitymanagement.model.AttachedPolicy)2 ListAttachedRolePoliciesRequest (com.amazonaws.services.identitymanagement.model.ListAttachedRolePoliciesRequest)2 ListAttachedRolePoliciesResult (com.amazonaws.services.identitymanagement.model.ListAttachedRolePoliciesResult)2 CloudConnectorException (com.sequenceiq.cloudbreak.cloud.exception.CloudConnectorException)2 AmazonClientException (com.amazonaws.AmazonClientException)1 AccessKeyMetadata (com.amazonaws.services.identitymanagement.model.AccessKeyMetadata)1 AttachRolePolicyRequest (com.amazonaws.services.identitymanagement.model.AttachRolePolicyRequest)1 CreateAccessKeyRequest (com.amazonaws.services.identitymanagement.model.CreateAccessKeyRequest)1 CreateAccessKeyResult (com.amazonaws.services.identitymanagement.model.CreateAccessKeyResult)1 CreateAccountAliasRequest (com.amazonaws.services.identitymanagement.model.CreateAccountAliasRequest)1 CreateAccountAliasResult (com.amazonaws.services.identitymanagement.model.CreateAccountAliasResult)1 CreatePolicyRequest (com.amazonaws.services.identitymanagement.model.CreatePolicyRequest)1 CreatePolicyResult (com.amazonaws.services.identitymanagement.model.CreatePolicyResult)1 CreateUserRequest (com.amazonaws.services.identitymanagement.model.CreateUserRequest)1 CreateUserResult (com.amazonaws.services.identitymanagement.model.CreateUserResult)1 DeleteAccessKeyRequest (com.amazonaws.services.identitymanagement.model.DeleteAccessKeyRequest)1 DeleteAccessKeyResult (com.amazonaws.services.identitymanagement.model.DeleteAccessKeyResult)1 DeleteAccountAliasRequest (com.amazonaws.services.identitymanagement.model.DeleteAccountAliasRequest)1