Search in sources :

Example 36 with Region

use of software.amazon.awssdk.regions.Region in project aws-doc-sdk-examples by awsdocs.

the class UpdateTable method main.

public static void main(String[] args) {
    final String USAGE = "\n" + "Usage:\n" + "    UpdateTable <tableName> <readCapacity> <writeCapacity>\n\n" + "Where:\n" + "    tableName - the Amazon DynamoDB table to update (for example, Music3).\n" + "    readCapacity  - the new read capacity of the table (for example, 16).\n" + "    writeCapacity - the new write capacity of the table (for example, 10).\n\n" + "Example:\n" + "    UpdateTable Music3 16 10\n";
    if (args.length != 3) {
        System.out.println(USAGE);
        System.exit(1);
    }
    String tableName = args[0];
    Long readCapacity = Long.parseLong(args[1]);
    Long writeCapacity = Long.parseLong(args[2]);
    Region region = Region.US_WEST_2;
    DynamoDbClient ddb = DynamoDbClient.builder().region(region).build();
    updateDynamoDBTable(ddb, tableName, readCapacity, writeCapacity);
    ddb.close();
}
Also used : DynamoDbClient(software.amazon.awssdk.services.dynamodb.DynamoDbClient) Region(software.amazon.awssdk.regions.Region)

Example 37 with Region

use of software.amazon.awssdk.regions.Region in project aws-doc-sdk-examples by awsdocs.

the class CloudWatchTest method setUp.

@BeforeAll
public static void setUp() throws IOException {
    Region region = Region.US_WEST_2;
    ;
    cw = CloudWatchClient.builder().region(region).build();
    cloudWatchLogsClient = CloudWatchLogsClient.builder().region(region).build();
    cwe = CloudWatchEventsClient.builder().region(region).build();
    try (InputStream input = CloudWatchTest.class.getClassLoader().getResourceAsStream("config.properties")) {
        Properties prop = new Properties();
        if (input == null) {
            System.out.println("Sorry, unable to find config.properties");
            return;
        }
        // load a properties file from class path, inside static method
        prop.load(input);
        // Populate the data members required for all tests
        logGroup = prop.getProperty("logGroup");
        alarmName = prop.getProperty("alarmName");
        streamName = prop.getProperty("streamName");
        ruleResource = prop.getProperty("ruleResource");
        metricId = prop.getProperty("metricId");
        filterName = prop.getProperty("filterName");
        destinationArn = prop.getProperty("destinationArn");
        roleArn = prop.getProperty("roleArn");
        filterPattern = prop.getProperty("filterPattern");
        instanceId = prop.getProperty("instanceId");
        ruleName = prop.getProperty("ruleName");
        ruleArn = prop.getProperty("ruleArn");
        namespace = prop.getProperty("namespace");
    } catch (IOException ex) {
        ex.printStackTrace();
    }
}
Also used : Region(software.amazon.awssdk.regions.Region)

Example 38 with Region

use of software.amazon.awssdk.regions.Region in project aws-doc-sdk-examples by awsdocs.

the class CreatePullRequest method main.

public static void main(String[] args) {
    final String USAGE = "\n" + "Usage:\n" + "    <repoName> <destinationReference> <sourceReference> \n\n" + "Where:\n" + "    repoName - the name of the repository.\n" + "    destinationReference -  the branch of the repository where the pull request changes are merged.\n" + "    sourceReference - the branch of the repository that contains the changes for the pull request.\n";
    if (args.length != 3) {
        System.out.println(USAGE);
        System.exit(1);
    }
    String repoName = args[0];
    String destinationReference = args[1];
    String sourceReference = args[2];
    Region region = Region.US_EAST_1;
    CodeCommitClient codeCommitClient = CodeCommitClient.builder().region(region).build();
    String prId = createPR(codeCommitClient, repoName, destinationReference, sourceReference);
    System.out.println("The pull request id is " + prId);
    codeCommitClient.close();
}
Also used : CodeCommitClient(software.amazon.awssdk.services.codecommit.CodeCommitClient) Region(software.amazon.awssdk.regions.Region)

Example 39 with Region

use of software.amazon.awssdk.regions.Region in project aws-doc-sdk-examples by awsdocs.

the class DeleteBranch method main.

public static void main(String[] args) {
    final String USAGE = "\n" + "Usage:\n" + "    <repoName> <branchName> \n\n" + "Where:\n" + "    repoName - the name of the repository.\n" + "    branchName - the name of the branch. \n";
    if (args.length != 2) {
        System.out.println(USAGE);
        System.exit(1);
    }
    String repoName = args[0];
    String branchName = args[1];
    Region region = Region.US_EAST_1;
    CodeCommitClient codeCommitClient = CodeCommitClient.builder().region(region).build();
    deleteSpecificBranch(codeCommitClient, repoName, branchName);
    codeCommitClient.close();
}
Also used : CodeCommitClient(software.amazon.awssdk.services.codecommit.CodeCommitClient) Region(software.amazon.awssdk.regions.Region)

Example 40 with Region

use of software.amazon.awssdk.regions.Region in project aws-doc-sdk-examples by awsdocs.

the class DescribePullRequestEvents method main.

public static void main(String[] args) {
    final String USAGE = "\n" + "Usage:\n" + "    <prId> \n\n" + "Where:\n" + "    prId - the id of the pull request. \n";
    if (args.length != 1) {
        System.out.println(USAGE);
        System.exit(1);
    }
    String prId = args[0];
    Region region = Region.US_EAST_1;
    CodeCommitClient codeCommitClient = CodeCommitClient.builder().region(region).build();
    describePREvents(codeCommitClient, prId);
    codeCommitClient.close();
}
Also used : CodeCommitClient(software.amazon.awssdk.services.codecommit.CodeCommitClient) Region(software.amazon.awssdk.regions.Region)

Aggregations

Region (software.amazon.awssdk.regions.Region)534 S3Client (software.amazon.awssdk.services.s3.S3Client)43 RekognitionClient (software.amazon.awssdk.services.rekognition.RekognitionClient)32 DynamoDbClient (software.amazon.awssdk.services.dynamodb.DynamoDbClient)31 IamClient (software.amazon.awssdk.services.iam.IamClient)23 PersonalizeClient (software.amazon.awssdk.services.personalize.PersonalizeClient)22 Ec2Client (software.amazon.awssdk.services.ec2.Ec2Client)20 Test (org.junit.Test)17 AwsCredentialsProvider (software.amazon.awssdk.auth.credentials.AwsCredentialsProvider)15 KmsClient (software.amazon.awssdk.services.kms.KmsClient)15 URI (java.net.URI)13 CodeCommitClient (software.amazon.awssdk.services.codecommit.CodeCommitClient)13 GlueClient (software.amazon.awssdk.services.glue.GlueClient)12 Properties (java.util.Properties)11 DynamoDbEnhancedClient (software.amazon.awssdk.enhanced.dynamodb.DynamoDbEnhancedClient)11 SesClient (software.amazon.awssdk.services.ses.SesClient)11 SdkBytes (software.amazon.awssdk.core.SdkBytes)9 Route53Client (software.amazon.awssdk.services.route53.Route53Client)9 CloudTrailClient (software.amazon.awssdk.services.cloudtrail.CloudTrailClient)8 CloudWatchClient (software.amazon.awssdk.services.cloudwatch.CloudWatchClient)8