

支援終止通知：2025 年 11 月 13 日， AWS 將停止對 Amazon 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` 會嘗試從此儲存貯體讀取。

**Role**  
您希望 Elastic Transcoder 用來轉碼任務之角色的 IAM Amazon Resource Name (ARN)。 `Test Role` 會嘗試擔任指定的角色。

**主題**  
`Test Role` 您要傳送測試通知的一或多個 Amazon Simple Notification Service (Amazon SNS) 主題的 ARNs。如果您未使用 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` 會包含一個或多個訊息的陣列，說明哪些測試失敗。

**Success**  
若操作成功，此值為 `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"
}
```