aws:executeAwsApi – 呼叫並執行 AWS API 操作 - AWS Systems Manager

本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。

aws:executeAwsApi – 呼叫並執行 AWS API 操作

呼叫並執行 AWS API 操作。大部分 API 操作均有支援,但並非所有 API 操作都經過測試。不支援串流 API 操作,例如 GetObject 操作。如果不確定想要使用的 API 操作是否為串流操作,請檢閱 Boto3 服務文件,以確定 API 是否需要串流輸入或輸出。我們會定期更新此動作所使用的 Boto3 版本。但在新的 Boto3 版本發布之後,可能需要長達幾週的時間才能在此動作中反映出相關更改。每個 aws:executeAwsApi 動作最多可執行 25 秒。如需有關如何使用此動作的更多範例,請參閱 其他執行手冊範例

輸入

輸入是由您選擇的 API 操作定義。

YAML
action: aws:executeAwsApi inputs: Service: The official namespace of the service Api: The API operation or method name API operation inputs or parameters: A value outputs: # These are user-specified outputs - Name: The name for a user-specified output key Selector: A response object specified by using jsonpath format Type: The data type
JSON
{ "action":"aws:executeAwsApi", "inputs":{ "Service":"The official namespace of the service", "Api":"The API operation or method name", "API operation inputs or parameters":"A value" }, "outputs":[ These are user-specified outputs { "Name":"The name for a user-specified output key", "Selector":"A response object specified by using JSONPath format", "Type":"The data type" } ] }
服務

AWS 服務 命名空間包含了您想要執行的 API 操作。您可以檢視 AWS SDK for Python (Boto3) 的可用服務中的受支援 AWS 服務 命名空間清單。您可以在 Client (用戶端) 區段中找到此命名空間。例如,Systems Manager 的命名空間為 ssm。Amazon Elastic Compute Cloud (Amazon EC2) 的命名空間為 ec2

類型:字串

必要:是

Api

您想要執行的 API 操作之名稱。您可以檢視 API 操作 (也稱為方法),方式是在以下服務參考頁面的左側導覽中選擇一項服務。在您想要呼叫之服務的 Client (用戶端) 部分選擇一個方法。例如,Amazon Relational Database Service (Amazon RDS) 的所有 API 操作 (方法) 均列於以下頁面:Amazon RDS 方法

類型:字串

必要:是

API 操作輸入

一個或多個 API 操作輸入。您可以檢視可用的輸入 (也稱為參數),方式是在以下服務參考頁面的左側導覽中選擇一項服務。在您想要呼叫之服務的 Client (用戶端) 部分選擇一個方法。例如,Amazon RDS 的所有方法均列於以下頁面:Amazon RDS 方法。選擇 describe_db_instances 方法並向下捲動以查看可用的參數,例如 DBInstanceIdentifierNameValues

YAML
inputs: Service: The official namespace of the service Api: The API operation name API input 1: A value API Input 2: A value API Input 3: A value
JSON
"inputs":{ "Service":"The official namespace of the service", "Api":"The API operation name", "API input 1":"A value", "API Input 2":"A value", "API Input 3":"A value" }

類型:由所選的 API 操作決定

必要:是

輸出

輸出由使用者根據所選 API 操作的回應來指定。

名稱

輸出的名稱。

類型:字串

必要:是

選擇器

回應物件中特定屬性的 JSONPath。您可以檢視回應物件,方式是在以下服務參考頁面的左側導覽中選擇一項服務。在您想要呼叫之服務的 Client (用戶端) 部分選擇一個方法。例如,Amazon RDS 的所有方法均列於以下頁面:Amazon RDS 方法。選擇 describe_db_instances 方法並向下捲動至 Response Structure (回應結構) 區段。DBInstances 列為回應物件。

類型:整數、布林值、字串、StringList、StringMap 或 MapList

必要:是

Type

回應元素的資料類型。

類型:Varies

必要:是