Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/366.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Amazon弹性转码器-如何使用名称获取预设_Java_Amazon Web Services_Amazon S3_Amazon Elastic Transcoder - Fatal编程技术网

Java Amazon弹性转码器-如何使用名称获取预设

Java Amazon弹性转码器-如何使用名称获取预设,java,amazon-web-services,amazon-s3,amazon-elastic-transcoder,Java,Amazon Web Services,Amazon S3,Amazon Elastic Transcoder,我需要从列表()中获取预设。如果我得到如下名称的预设,它将返回第一个预设。但我需要获得名为“系统预设:通用320x240”的预设ID BasicAWSCredentials creds=新的BasicAWSCredentials(accessKey,secretKey); AmazonS3 s3Client=AmazonS3ClientBuilder.standard() .具有凭据(新AWSStaticCredentialsProvider(creds)).build(); AmazonEla

我需要从列表()中获取预设。如果我得到如下名称的预设,它将返回第一个预设。但我需要获得名为“系统预设:通用320x240”的预设ID

BasicAWSCredentials creds=新的BasicAWSCredentials(accessKey,secretKey);
AmazonS3 s3Client=AmazonS3ClientBuilder.standard()
.具有凭据(新AWSStaticCredentialsProvider(creds)).build();
AmazonElasticTranscoder AmazonElasticTranscoder=AmazonElasticTranscoderClientBuilder.standard()
.withCredentials(新的AWSStaticCredentialsProvider(creds)).withRegion(s3Client.getRegionName())
.build();
列表预设=amazonElasticTranscoder.listPresets().getPresets();
字符串presetId=presets.迭代器().next().withName(“系统预设:通用320x240”).getId();
上述代码返回“1351620000001-000001”而不是“1351620000001-000061”

我的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>

org.springframework.boot
spring启动程序父级
1.5.7.1发布
UTF-8
com.xxx.com应用程序
1.8
1.11.194
1.0.4
org.springframework.boot
SpringBootStarterWeb
亚马逊网站
aws-java-sdk-s3
${aws.version}
亚马逊网站
aws java sdk弹性转码器
${aws.version}
亚马逊网站
aws java sdk sqs
${aws.version}
亚马逊网站
AmazonSQSJava消息传递库
${aws.messaging.version}
我试图从AWS弹性转码器获得所有预设,但下面的代码只返回62个预设中的50个

List<Preset> presets = amazonElasticTranscoder.listPresets().getPresets();
List presets=amazonElasticTranscoder.listPresets().getPresets();
如何使用java动态获取预置?
如何获取所有预设(包括自定义预设)。

我更熟悉Python SDK(而不是Java人士),但这种行为似乎只获得API调用结果的第一页(50个结果)——您需要实现分页以获取所有结果

调查

PageToken
When Elastic Transcoder returns more than one page of results, use PageToken in subsequent GET requests to get each successive page of results.

伪代码示例: 对listPresets()的初始调用应获取NextPageToken,然后继续迭代该请求,直到NextPageToken为null,同时将结果附加到局部变量

PageToken
When Elastic Transcoder returns more than one page of results, use PageToken in subsequent GET requests to get each successive page of results.
NextPageToken
A value that you use to access the second and subsequent pages of results, if any. When the presets fit on one page or when you've reached the last page of results, the value of NextPageToken is null.