Search in sources :

Example 66 with Region

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

the class GetObjectUrl method main.

public static void main(String[] args) {
    final String USAGE = "\n" + "Usage:\n" + "    <bucketName> <keyName> \n\n" + "Where:\n" + "    bucketName - the Amazon S3 bucket name.\n\n" + "    keyName - a key name that represents the object. \n\n";
    if (args.length != 2) {
        System.out.println(USAGE);
        System.exit(1);
    }
    String bucketName = args[0];
    String keyName = args[1];
    Region region = Region.US_WEST_2;
    S3Client s3 = S3Client.builder().region(region).build();
    getURL(s3, bucketName, keyName);
    s3.close();
}
Also used : Region(software.amazon.awssdk.regions.Region) S3Client(software.amazon.awssdk.services.s3.S3Client)

Example 67 with Region

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

the class LifecycleConfiguration method main.

public static void main(String[] args) {
    final String USAGE = "\n" + "Usage:\n" + "  <bucketName> <accountId> \n\n" + "Where:\n" + "  bucketName - the Amazon Simple Storage Service (Amazon S3) bucket to upload an object into.\n" + "  accountId - the id of the account that owns the Amazon S3 bucket.\n";
    if (args.length != 2) {
        System.out.println(USAGE);
        System.exit(1);
    }
    String bucketName = args[0];
    String accountId = args[1];
    Region region = Region.US_EAST_1;
    S3Client s3 = S3Client.builder().region(region).build();
    setLifecycleConfig(s3, bucketName, accountId);
    getLifecycleConfig(s3, bucketName, accountId);
    deleteLifecycleConfig(s3, bucketName, accountId);
    System.out.println("You have successfully created, updated, and deleted a Lifecycle configuration ");
    s3.close();
}
Also used : Region(software.amazon.awssdk.regions.Region) S3Client(software.amazon.awssdk.services.s3.S3Client)

Example 68 with Region

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

the class VideoPersonDetection method main.

public static void main(String[] args) {
    final String USAGE = "\n" + "Usage: " + "   <bucket> <video> <topicArn> <roleArn>\n\n" + "Where:\n" + "   bucket - the name of the bucket in which the video is located (for example, (for example, myBucket). \n\n" + "   video - the name of video (for example, people.mp4). \n\n" + "   topicArn - the ARN of the Amazon Simple Notification Service (Amazon SNS) topic. \n\n" + "   roleArn - the ARN of the AWS Identity and Access Management (IAM) role to use. \n\n";
    if (args.length != 4) {
        System.out.println(USAGE);
        System.exit(1);
    }
    String bucket = args[0];
    String video = args[1];
    String topicArn = args[2];
    String roleArn = args[3];
    Region region = Region.US_EAST_1;
    RekognitionClient rekClient = RekognitionClient.builder().region(region).build();
    NotificationChannel channel = NotificationChannel.builder().snsTopicArn(topicArn).roleArn(roleArn).build();
    startPersonLabels(rekClient, channel, bucket, video);
    GetPersonDetectionResults(rekClient);
    System.out.println("This example is done!");
    rekClient.close();
}
Also used : NotificationChannel(software.amazon.awssdk.services.rekognition.model.NotificationChannel) Region(software.amazon.awssdk.regions.Region) RekognitionClient(software.amazon.awssdk.services.rekognition.RekognitionClient)

Example 69 with Region

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

the class DeleteHostedZone method main.

public static void main(String[] args) {
    final String USAGE = "\n" + "Usage:\n" + "    <hostedZoneId> \n\n" + "Where:\n" + "    hostedZoneId - the hosted zone id. \n";
    if (args.length < 1) {
        System.out.println(USAGE);
        System.exit(1);
    }
    String hostedZoneId = args[0];
    Region region = Region.AWS_GLOBAL;
    Route53Client route53Client = Route53Client.builder().region(region).build();
    delHostedZone(route53Client, hostedZoneId);
    route53Client.close();
}
Also used : Region(software.amazon.awssdk.regions.Region) Route53Client(software.amazon.awssdk.services.route53.Route53Client)

Example 70 with Region

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

the class AbortMultipartUpload method main.

public static void main(String[] args) {
    final String USAGE = "\n" + "Usage:\n" + "  <bucketName> <accountId> \n\n" + "Where:\n" + "  bucketName - the Amazon Simple Storage Service (Amazon S3) bucket.\n" + "  accountId - the id of the account that owns the Amazon S3 bucket.\n";
    if (args.length != 2) {
        System.out.println(USAGE);
        System.exit(1);
    }
    String bucketName = args[0];
    String accountId = args[1];
    Region region = Region.US_WEST_2;
    S3Client s3 = S3Client.builder().region(region).build();
    abortUploads(s3, bucketName, accountId);
    s3.close();
}
Also used : Region(software.amazon.awssdk.regions.Region) S3Client(software.amazon.awssdk.services.s3.S3Client)

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