Creates a data transformation job in a project.
Debugging
Authorization information
There is currently no authorization information disclosed in the API.
Request syntax
POST /etls HTTP/1.1
Request parameters
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
| project | string | Yes | Project name. | ali-test-project |
| body | object | No | The configurations of the job. | |
| name | string | Yes | The name of the job (unique within a project). | etl-123456 |
| displayName | string | Yes | The display name of the job. | sls-test-etl |
| description | string | No | The description of the job. | this is ETL |
| configuration | ETLConfiguration | Yes | The detailed configuration of the job. |
When you create a data transformation job of the new version, you must add the lang and datasets parameters. In this topic, Python code is used as an example.
# -*- 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:])
Response parameters
Examples
Sample success responses
JSONformat
{}Error codes
| HTTP status code | Error code | Error message |
|---|---|---|
| 401 | AuthorizationRequired | Authorization Required |
For a list of error codes, visit the Service error codes.
