|
41 | 41 | from .logstore_config_response import * |
42 | 42 | from .substore_config_response import * |
43 | 43 | from .logtail_config_response import * |
| 44 | +from .logtail_pipeline_config_response import * |
44 | 45 | from .machinegroup_response import * |
45 | 46 | from .rebuild_index_response import * |
46 | 47 | from .project_response import * |
@@ -2328,6 +2329,132 @@ def list_logtail_config(self, project_name, logstore=None, config=None, offset=0 |
2328 | 2329 | (resp, header) = self._send("GET", project_name, None, resource, params, headers) |
2329 | 2330 | return ListLogtailConfigResponse(resp, header) |
2330 | 2331 |
|
| 2332 | + def create_logtail_pipeline_config(self, project_name, config_detail): |
| 2333 | + """ create logtail pipeline config in a project |
| 2334 | + Unsuccessful operation will cause an LogException. |
| 2335 | +
|
| 2336 | + :type project_name: string |
| 2337 | + :param project_name: the Project name |
| 2338 | +
|
| 2339 | + :type config_detail: LogtailPipelineConfigDetail |
| 2340 | + :param config_detail: the logtail pipeline config detail |
| 2341 | +
|
| 2342 | + :return: CreateLogtailPipelineConfigResponse |
| 2343 | +
|
| 2344 | + :raise: LogException |
| 2345 | + """ |
| 2346 | + headers = {} |
| 2347 | + params = {} |
| 2348 | + resource = "/pipelineconfigs" |
| 2349 | + headers['Content-Type'] = 'application/json' |
| 2350 | + body = six.b(json.dumps(config_detail.to_json())) |
| 2351 | + headers['x-log-bodyrawsize'] = str(len(body)) |
| 2352 | + (resp, headers) = self._send("POST", project_name, body, resource, params, headers) |
| 2353 | + return CreateLogtailPipelineConfigResponse(headers, resp) |
| 2354 | + |
| 2355 | + def update_logtail_pipeline_config(self, project_name, config_detail): |
| 2356 | + """ update logtail pipeline config in a project |
| 2357 | + Unsuccessful operation will cause an LogException. |
| 2358 | +
|
| 2359 | + :type project_name: string |
| 2360 | + :param project_name: the Project name |
| 2361 | +
|
| 2362 | + :type config_detail: LogtailPipelineConfigDetail |
| 2363 | + :param config_detail: the logtail pipeline config detail |
| 2364 | +
|
| 2365 | + :return: UpdateLogtailPipelineConfigResponse |
| 2366 | +
|
| 2367 | + :raise: LogException |
| 2368 | + """ |
| 2369 | + headers = {} |
| 2370 | + params = {} |
| 2371 | + resource = "/pipelineconfigs/" + config_detail.config_name |
| 2372 | + headers['Content-Type'] = 'application/json' |
| 2373 | + body = six.b(json.dumps(config_detail.to_json())) |
| 2374 | + headers['x-log-bodyrawsize'] = str(len(body)) |
| 2375 | + (resp, headers) = self._send("PUT", project_name, body, resource, params, headers) |
| 2376 | + return UpdateLogtailPipelineConfigResponse(headers, resp) |
| 2377 | + |
| 2378 | + def delete_logtail_pipeline_config(self, project_name, config_name): |
| 2379 | + """ delete logtail pipeline config in a project |
| 2380 | + Unsuccessful operation will cause an LogException. |
| 2381 | +
|
| 2382 | + :type project_name: string |
| 2383 | + :param project_name: the Project name |
| 2384 | +
|
| 2385 | + :type config_name: string |
| 2386 | + :param config_name: the logtail pipeline config name |
| 2387 | +
|
| 2388 | + :return: DeleteLogtailPipelineConfigResponse |
| 2389 | +
|
| 2390 | + :raise: LogException |
| 2391 | + """ |
| 2392 | + headers = {} |
| 2393 | + params = {} |
| 2394 | + resource = "/pipelineconfigs/" + config_name |
| 2395 | + (resp, headers) = self._send("DELETE", project_name, None, resource, params, headers) |
| 2396 | + return DeleteLogtailPipelineConfigResponse(headers, resp) |
| 2397 | + |
| 2398 | + def get_logtail_pipeline_config(self, project_name, config_name): |
| 2399 | + """ get logtail pipeline config in a project |
| 2400 | + Unsuccessful operation will cause an LogException. |
| 2401 | +
|
| 2402 | + :type project_name: string |
| 2403 | + :param project_name: the Project name |
| 2404 | +
|
| 2405 | + :type config_name: string |
| 2406 | + :param config_name: the logtail pipeline config name |
| 2407 | +
|
| 2408 | + :return: GetLogtailPipelineConfigResponse |
| 2409 | +
|
| 2410 | + :raise: LogException |
| 2411 | + """ |
| 2412 | + headers = {} |
| 2413 | + params = {} |
| 2414 | + resource = "/pipelineconfigs/" + config_name |
| 2415 | + (resp, headers) = self._send("GET", project_name, None, resource, params, headers) |
| 2416 | + return GetLogtailPipelineConfigResponse(resp, headers) |
| 2417 | + |
| 2418 | + def list_logtail_pipeline_config(self, project_name, config_name=None, logstore_name=None, offset=0, size=100): |
| 2419 | + """ list logtail pipeline config names in a project |
| 2420 | + Unsuccessful operation will cause an LogException. |
| 2421 | +
|
| 2422 | + :type project_name: string |
| 2423 | + :param project_name: the Project name |
| 2424 | +
|
| 2425 | + :type config_name: string |
| 2426 | + :param config_name: config name to filter |
| 2427 | +
|
| 2428 | + :type logstore_name: string |
| 2429 | + :param logstore_name: logstore name to filter |
| 2430 | +
|
| 2431 | + :type offset: int |
| 2432 | + :param offset: the offset of all config names |
| 2433 | +
|
| 2434 | + :type size: int |
| 2435 | + :param size: the max return names count, -1 means all |
| 2436 | +
|
| 2437 | + :return: ListLogtailPipelineConfigResponse |
| 2438 | +
|
| 2439 | + :raise: LogException |
| 2440 | + """ |
| 2441 | + # need to use extended method to get more |
| 2442 | + if int(size) == -1 or int(size) > MAX_LIST_PAGING_SIZE: |
| 2443 | + return list_more(self.list_logtail_pipeline_config, int(offset), int(size), MAX_LIST_PAGING_SIZE, |
| 2444 | + project_name, config_name, logstore_name) |
| 2445 | + |
| 2446 | + headers = {} |
| 2447 | + params = {} |
| 2448 | + resource = "/pipelineconfigs" |
| 2449 | + params['offset'] = str(offset) |
| 2450 | + params['size'] = str(size) |
| 2451 | + if config_name: |
| 2452 | + params['configName'] = config_name |
| 2453 | + if logstore_name: |
| 2454 | + params['logstoreName'] = logstore_name |
| 2455 | + (resp, header) = self._send("GET", project_name, None, resource, params, headers) |
| 2456 | + return ListLogtailPipelineConfigResponse(resp, header) |
| 2457 | + |
2331 | 2458 | def create_machine_group(self, project_name, group_detail): |
2332 | 2459 | """ create machine group in a project |
2333 | 2460 | Unsuccessful operation will cause an LogException. |
|
0 commit comments