全部產品
Search
文件中心

Simple Log Service:CreateETL

更新時間:Sep 15, 2026

在指定 Project 下建立一個資料加工任務。

調試

您可以在OpenAPI Explorer中直接運行該介面,免去您計算簽名的困擾。運行成功後,OpenAPI Explorer可以自動產生SDK程式碼範例。

調試

授權資訊

下表是API對應的授權資訊,可以在RAM權限原則語句的Action元素中使用,用來給RAM使用者或RAM角色授予調用此API的許可權。具體說明如下:

  • 操作:是指具體的許可權點。

  • 存取層級:是指每個操作的存取層級,取值為寫入(Write)、讀取(Read)或列出(List)。

  • 資源類型:是指操作中支援授權的資源類型。具體說明如下:

    • 對於必選的資源類型,用前面加 * 表示。

    • 對於不支援資源級授權的操作,用全部資源表示。

  • 條件關鍵字:是指雲產品自身定義的條件關鍵字。

  • 關聯操作:是指成功執行操作所需要的其他許可權。操作者必須同時具備關聯操作的許可權,操作才能成功。

操作

存取層級

資源類型

條件關鍵字

關聯操作

log:CreateETL

create

*全部資源。

*

無 無

請求文法

POST /etls HTTP/1.1

請求參數

名稱

類型

必填

描述

樣本值

project

string

是

Project 名稱。

ali-test-project

body

object

否

資料加工任務設定。

name

string

是

作業名稱。其命名規則如下:

同一個 Project 下,作業的名稱不可重複。

  • 只能包括小寫字母、數字、短橫線(-)和底線(_)。

  • 必須以小寫字母或數字開頭和結尾。

  • 長度為 2-64 個字元。

etl-123456

displayName

string

是

資料加工任務顯示名稱。

sls-test-etl

description

string

否

資料加工任務描述。

this is ETL

configuration ETLConfiguration

是

資料加工任務詳細設定。

新版加工的建立需要額外補充 lang 以及 datasets 參數,以 Python 程式碼為例

# -*- coding: utf-8 -*-
# This file is auto-generated, don't edit it. Thanks.
import os
import sys

from typing import List

from alibabacloud_sls20201230.client import Client as Sls20201230Client
from alibabacloud_tea_openapi import models as open_api_models
from alibabacloud_sls20201230 import models as sls_20201230_models
from alibabacloud_tea_util import models as util_models
from alibabacloud_tea_util.client import Client as UtilClient


class Sample:
    def __init__(self):
        pass

    @staticmethod
    def create_client() -> Sls20201230Client:
        """
        @return: Client
        @throws Exception
        config = open_api_models.Config(
            access_key_id=os.environ['ALIBABA_CLOUD_ACCESS_KEY_ID'],
            access_key_secret=os.environ['ALIBABA_CLOUD_ACCESS_KEY_SECRET']
        )
        config.endpoint = f'cn-hangzhou.log.aliyuncs.com'
        return Sls20201230Client(config)

    @staticmethod
    def main(
        args: List[str],
    ) -> None:
        client = Sample.create_client()
        etlconfiguration_etlconfiguration_sink_0 = sls_20201230_models.ETLConfigurationSink(
            name='my-test',
            project='my-test',
            endpoint='cn-hangzhou.log.aliyuncs.com',
            logstore='target',
            role_arn='***',
            datasets=["__UNNAMED__"]
        )
        etlconfiguration = sls_20201230_models.ETLConfiguration(
            script='* | where 1 = 1',
            lang='SPL',
            logstore='mock',
            role_arn='***',
            from_time=1729740027,
            to_time=0,
            sinks=[
                etlconfiguration_etlconfiguration_sink_0
            ]
        )
        create_etlrequest = sls_20201230_models.CreateETLRequest(
            name='etl-my-test',
            display_name='my-test',
            configuration=etlconfiguration
        )
        runtime = util_models.RuntimeOptions()
        headers = {}
        try:
            client.create_etlwith_options('my-test', create_etlrequest, headers, runtime)
        except Exception as error:
            print(error.message)
            print(error.data.get("Recommend"))
            UtilClient.assert_as_string(error.message)



if __name__ == '__main__':
    Sample.main(sys.argv[1:])

返回參數

名稱

類型

描述

樣本值

當前API暫無返回參數

樣本

正常返回樣本

JSON格式

{}

錯誤碼

HTTP status code

錯誤碼

錯誤資訊

描述

401 AuthorizationRequired Authorization Required 沒有存取權限,需要進行使用者身份驗證。

訪問錯誤中心查看更多錯誤碼。

變更歷史

更多資訊,參考變更詳情。