

终止支持通知：2025 年 11 月 13 日， AWS 我们将停止对亚马逊 Elastic Transcoder 的支持。2025 年 11 月 13 日之后，您将无法再访问 Elastic Transcoder 控制台或 Elastic Transcoder 资源。

有关过渡到的更多信息 AWS Elemental MediaConvert，请访问此[博客文章](https://aws.amazon.com/blogs/media/how-to-migrate-workflows-from-amazon-elastic-transcoder-to-aws-elemental-mediaconvert/)。

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# 测试角色
<a name="test-pipeline-role"></a>

**Topics**
+ [描述](#test-pipeline-role-description)
+ [请求](#test-pipeline-role-requests)
+ [响应](#test-pipeline-role-responses)
+ [错误](#test-pipeline-role-response-errors)
+ [示例](#test-pipeline-role-examples)

## 描述
<a name="test-pipeline-role-description"></a>

要测试管道的设置以确保 Elastic Transcoder 可以创建和处理任务，请将 POST 请求发送到 `/2012-09-25/roleTests` 资源。

## 请求
<a name="test-pipeline-role-requests"></a>

### 语法
<a name="test-pipeline-role-request-syntax"></a>

```
POST /2012-09-25/roleTests HTTP/1.1
Content-Type: application/json; charset=UTF-8
Accept: */*
Host: elastictranscoder.Elastic Transcoder endpoint.amazonaws.com:443
x-amz-date: 20130114T174952Z
Authorization: AWS4-HMAC-SHA256 
               Credential=AccessKeyID/request-date/Elastic Transcoder endpoint/elastictranscoder/aws4_request,
               SignedHeaders=host;x-amz-date;x-amz-target,
               Signature=calculated-signature
Content-Length: number of characters in the JSON string
{
   "InputBucket":"Amazon S3 bucket that contains files to transcode",
   "OutputBucket":"Amazon S3 bucket in which to save transcoded files",
   "Role":"IAM ARN for the role to test",
   "Topics": [
      "ARN of SNS topic to test"
   ]
}
```

### 请求参数
<a name="test-pipeline-role-request-parameters"></a>

此操作不使用请求参数。

### 请求标头
<a name="test-pipeline-role-request-headers"></a>

此操作仅使用所有操作通用的请求标头。有关通用请求标头的信息，请参阅 [HTTP 标头内容](making-http-requests.md#http-request-header)。

### 请求正文
<a name="test-pipeline-role-request-body"></a>

请求正文中的 JSON 字符串包含以下对象。

**InputBucket**  
其中保存您要转码的媒体文件的 Amazon S3 存储桶。`Test Role` 尝试从此存储桶读取。

**OutputBucket**  
您希望 Elastic Transcoder 将已转码文件保存到其中的 Amazon S3 存储桶。`Test Role` 尝试从此存储桶读取。

** 角色**  
您希望 Elastic Transcoder 用于转码任务的角色的 IAM Amazon 资源名称 (ARN)。`Test Role` 将尝试代入指定角色。

** 主题**  
您`Test Role`要向 ARNs 其发送测试通知的一个或多个亚马逊简单通知服务 (Amazon SNS) Simple Notification Service 主题。如果不使用 Amazon SNS 通知，您可以指定空列表。

## 响应
<a name="test-pipeline-role-responses"></a>

### 语法
<a name="test-pipeline-role-response-syntax"></a>

```
Status: 200 OK
x-amzn-RequestId: c321ec43-378e-11e2-8e4c-4d5b971203e9
Content-Type: application/json
Content-Length: number of characters in the response
Date: Mon, 14 Jan 2013 06:01:47 GMT

{
   "Messages": [
      "error messages, if any"
   ],
   "Success": "true | false"
}
```

### 响应标头
<a name="test-pipeline-role-response-headers"></a>

此操作仅使用大多数响应通用的响应标头。有关通用响应标头的信息，请参阅 [HTTP 响应](making-http-requests.md#http-response-header)。

### 响应正文
<a name="test-pipeline-role-response-body"></a>

测试管道设置时，Elastic Transcoder 将返回以下值。

** 消息**  
如果 `Success` 的值为 `false`，`Messages` 会包含一条或多条消息的数组，说明哪些测试失败。

** 成功**  
如果操作成功，则此值为 `true`；否则，该值为 `false`。

## 错误
<a name="test-pipeline-role-response-errors"></a>

有关 Elastic Transcoder 异常和错误消息的信息，请参阅 [处理 Elastic Transcoder 中的错误](error-handling.md)。

## 示例
<a name="test-pipeline-role-examples"></a>

### 示例请求
<a name="test-pipeline-role-examples-sample-request"></a>

```
POST /2012-09-25/roleTests HTTP/1.1
Content-Type: application/json; charset=UTF-8
Accept: */*
Host: elastictranscoder.Elastic Transcoder endpoint.amazonaws.com:443
x-amz-date: 20130114T174952Z
Authorization: AWS4-HMAC-SHA256 
               Credential=AccessKeyID/request-date/Elastic Transcoder endpoint/elastictranscoder/aws4_request,
               SignedHeaders=host;x-amz-date;x-amz-target,
               Signature=calculated-signature
Content-Length: number of characters in the JSON string
{
   "InputBucket":"salesoffice.example.com-source",
   "OutputBucket":"salesoffice.example.com-public-promos",
   "Role":"arn:aws:iam::123456789012:role/transcode-service",
   "Topics": 
      ["arn:aws:sns:us-east-1:111222333444:ETS_Errors", 
       "arn:aws:sns:us-east-1:111222333444:ETS_Progressing"]
}
```

### 示例响应
<a name="test-pipeline-role-examples-sample-response"></a>

```
Status: 201 Created
x-amzn-RequestId: c321ec43-378e-11e2-8e4c-4d5b971203e9
Content-Type: application/json
Content-Length: number of characters in the response
Date: Mon, 14 Jan 2013 06:01:47 GMT
{
   "Messages":[
      "The role arn:aws:iam::123456789012:role/transcode-service does not have access to the bucket: salesoffice.example.com-source",
      "The role arn:aws:iam::123456789012:role/transcode-service does not have access to the topic: arn:aws:sns:us-east-1:111222333444:ETS_Errors"
   ], 
   "Success": "false"
}
```