Search in sources :

Example 61 with Region

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

the class ListFacesInCollection method main.

public static void main(String[] args) {
    final String USAGE = "\n" + "Usage: " + "ListFacesInCollection <collectionId>\n\n" + "Where:\n" + "collectionId - the name of the collection. \n\n";
    if (args.length < 1) {
        System.out.println(USAGE);
        System.exit(1);
    }
    String collectionId = args[0];
    Region region = Region.US_EAST_1;
    RekognitionClient rekClient = RekognitionClient.builder().region(region).build();
    System.out.println("Faces in collection " + collectionId);
    listFacesCollection(rekClient, collectionId);
    rekClient.close();
}
Also used : Region(software.amazon.awssdk.regions.Region) RekognitionClient(software.amazon.awssdk.services.rekognition.RekognitionClient)

Example 62 with Region

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

the class RecognizeCelebrities method main.

public static void main(String[] args) {
    final String USAGE = "\n" + "Usage: " + "   <sourceImage>\n\n" + "Where:\n" + "   sourceImage - the path to the image (for example, C:\\AWS\\pic1.png). \n\n";
    if (args.length != 1) {
        System.out.println(USAGE);
        System.exit(1);
    }
    String sourceImage = args[0];
    Region region = Region.US_EAST_1;
    RekognitionClient rekClient = RekognitionClient.builder().region(region).build();
    System.out.println("Locating celebrities in " + sourceImage);
    recognizeAllCelebrities(rekClient, sourceImage);
    rekClient.close();
}
Also used : Region(software.amazon.awssdk.regions.Region) RekognitionClient(software.amazon.awssdk.services.rekognition.RekognitionClient)

Example 63 with Region

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

the class VideoCelebrityDetection 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();
    StartCelebrityDetection(rekClient, channel, bucket, video);
    GetCelebrityDetectionResults(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 64 with Region

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

the class DeleteObjects method main.

public static void main(String[] args) {
    final String USAGE = "\n" + "To run this example, supply the name of an S3 bucket and at least\n" + "one object name (key) to delete.\n" + "\n" + "Ex: <bucketName> <objectName>\n";
    if (args.length != 2) {
        System.out.println(USAGE);
        System.exit(1);
    }
    String bucketName = args[0];
    String objectName = args[1];
    System.out.println("Deleting an object from the Amazon S3 bucket: " + bucketName);
    Region region = Region.US_WEST_2;
    S3Client s3 = S3Client.builder().region(region).build();
    deleteBucketObjects(s3, bucketName, objectName);
    s3.close();
}
Also used : Region(software.amazon.awssdk.regions.Region) S3Client(software.amazon.awssdk.services.s3.S3Client)

Example 65 with Region

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

the class GetObjectPresignedUrl method main.

public static void main(String[] args) {
    final String USAGE = "\n" + "Usage:\n" + "    GetObjectPresignedUrl <bucketName> <keyName> \n\n" + "Where:\n" + "    bucketName - the Amazon S3 bucket name. \n\n" + "    keyName - a key name that represents a text file. \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;
    S3Presigner presigner = S3Presigner.builder().region(region).build();
    getPresignedUrl(presigner, bucketName, keyName);
    presigner.close();
}
Also used : S3Presigner(software.amazon.awssdk.services.s3.presigner.S3Presigner) 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