Amazon Elastic Transcoder - How to get the preset using name

Viewed 320

I need to get the Preset from the List (System Presets). If I get the Preset with name like the following, it will returns the first Preset. But I need to get PresetId with name "System preset: Generic 320x240".

BasicAWSCredentials creds = new BasicAWSCredentials(accessKey, secretKey);
AmazonS3 s3Client = AmazonS3ClientBuilder.standard()
                                .withCredentials(new AWSStaticCredentialsProvider(creds)).build();
AmazonElasticTranscoder amazonElasticTranscoder = AmazonElasticTranscoderClientBuilder.standard()
                                .withCredentials(new AWSStaticCredentialsProvider(creds)).withRegion(s3Client.getRegionName())
                                .build();
List<Preset> presets = amazonElasticTranscoder.listPresets().getPresets();
String presetId = presets.iterator().next().withName("System preset: Generic 320x240").getId();

The above code returns "1351620000001-000001" instead of "1351620000001-000061"

my pom.xml,

        <parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.5.7.RELEASE</version>
</parent>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <start-class>com.xxx.Application</start-class>
    <java.version>1.8</java.version>
    <aws.version>1.11.194</aws.version>
    <aws.messaging.version>1.0.4</aws.messaging.version>

</properties>

<dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>com.amazonaws</groupId>
            <artifactId>aws-java-sdk-s3</artifactId>
            <version>${aws.version}</version>
        </dependency>

        <dependency>
            <groupId>com.amazonaws</groupId>
            <artifactId>aws-java-sdk-elastictranscoder</artifactId>
            <version>${aws.version}</version>
        </dependency>

        <dependency>
            <groupId>com.amazonaws</groupId>
            <artifactId>aws-java-sdk-sqs</artifactId>
            <version>${aws.version}</version>
        </dependency>

        <dependency>
            <groupId>com.amazonaws</groupId>
            <artifactId>amazon-sqs-java-messaging-lib</artifactId>
            <version>${aws.messaging.version}</version>
        </dependency>

I am trying to get the all Presets from AWS Elastic Transcoder but the following code returns only 50 out of 62

List<Preset> presets = amazonElasticTranscoder.listPresets().getPresets();

How to get the Preset dynamically using java? How to get all the Presets (include Custom presets) as well.

1 Answers
Related