|
23 | 23 | from .getlogsresponse import GetLogsResponse
|
24 | 24 | from .getcontextlogsresponse import GetContextLogsResponse
|
25 | 25 | from .index_config_response import *
|
| 26 | +from .ingestion_response import * |
26 | 27 | from .listlogstoresresponse import ListLogstoresResponse
|
27 | 28 | from .listtopicsresponse import ListTopicsResponse
|
28 | 29 | from .logclient_core import make_lcrud_methods
|
@@ -2659,6 +2660,163 @@ def disable_alert(self, project_name, job_name):
|
2659 | 2660 | (resp, header) = self._send("PUT", project_name, None, resource, params, headers)
|
2660 | 2661 | return LogResponse(header)
|
2661 | 2662 |
|
| 2663 | + def list_ingestion(self, project_name): |
| 2664 | + """ list ingestion |
| 2665 | + Unsuccessful opertaion will cause an LogException. |
| 2666 | +
|
| 2667 | + :type project_name: string |
| 2668 | + :param project_name: the Project name |
| 2669 | +
|
| 2670 | + :return: ListIngestionResponse |
| 2671 | +
|
| 2672 | + :raise: LogException |
| 2673 | + """ |
| 2674 | + |
| 2675 | + headers = {} |
| 2676 | + params = {} |
| 2677 | + resource = '/jobs' |
| 2678 | + (resp, header) = self._send("GET", project_name, None, resource, params, headers) |
| 2679 | + return ListIngestionResponse(resp, header) |
| 2680 | + |
| 2681 | + def create_ingestion(self, project_name, ingestion_config): |
| 2682 | + """ create ingestion config |
| 2683 | + Unsuccessful opertaion will cause an LogException. |
| 2684 | +
|
| 2685 | + :type project_name: string |
| 2686 | + :param project_name: the Project name |
| 2687 | +
|
| 2688 | + :type ingestion_config: string |
| 2689 | + :param ingestion_config: the ingestion config |
| 2690 | +
|
| 2691 | + :return: CreateIngestionResponse |
| 2692 | +
|
| 2693 | + :raise: LogException |
| 2694 | + """ |
| 2695 | + |
| 2696 | + headers = {} |
| 2697 | + params = {} |
| 2698 | + resource = "/jobs" |
| 2699 | + headers['Content-Type'] = 'application/json' |
| 2700 | + body = six.b(ingestion_config) |
| 2701 | + headers['x-log-bodyrawsize'] = str(len(body)) |
| 2702 | + |
| 2703 | + (resp, header) = self._send("POST", project_name, body, resource, params, headers) |
| 2704 | + return CreateIngestionResponse(header, resp) |
| 2705 | + |
| 2706 | + def update_ingestion(self, project_name, ingestion_name, ingestion_config): |
| 2707 | + """ update ingestion config |
| 2708 | + Unsuccessful opertaion will cause an LogException. |
| 2709 | +
|
| 2710 | + :type project_name: string |
| 2711 | + :param project_name: the Project name |
| 2712 | +
|
| 2713 | + :type ingestion_name: string |
| 2714 | + :param ingestion_name: the ingestion name |
| 2715 | +
|
| 2716 | + :type ingestion_config: string |
| 2717 | + :param ingestion_config: the ingestion config |
| 2718 | +
|
| 2719 | + :return: UpdateIngestionResponse |
| 2720 | +
|
| 2721 | + :raise: LogException |
| 2722 | + """ |
| 2723 | + |
| 2724 | + headers = {} |
| 2725 | + params = {} |
| 2726 | + resource = "/jobs/" + ingestion_name |
| 2727 | + headers['Content-Type'] = 'application/json' |
| 2728 | + body = six.b(ingestion_config) |
| 2729 | + headers['x-log-bodyrawsize'] = str(len(body)) |
| 2730 | + |
| 2731 | + (resp, header) = self._send("PUT", project_name, body, resource, params, headers) |
| 2732 | + return UpdateIngestionResponse(header, resp) |
| 2733 | + |
| 2734 | + def delete_ingestion(self, project_name, ingestion_name): |
| 2735 | + """ delete ingestion config |
| 2736 | + Unsuccessful opertaion will cause an LogException. |
| 2737 | +
|
| 2738 | + :type project_name: string |
| 2739 | + :param project_name: the Project name |
| 2740 | +
|
| 2741 | + :type ingestion_name: string |
| 2742 | + :param ingestion_name: the ingestion name |
| 2743 | +
|
| 2744 | + :return: DeleteIngestionResponse |
| 2745 | +
|
| 2746 | + :raise: LogException |
| 2747 | + """ |
| 2748 | + |
| 2749 | + headers = {} |
| 2750 | + params = {} |
| 2751 | + resource = "/jobs/" + ingestion_name |
| 2752 | + (resp, header) = self._send("DELETE", project_name, None, resource, params, headers) |
| 2753 | + return DeleteIngestionResponse(header, resp) |
| 2754 | + |
| 2755 | + def get_ingestion(self, project_name, ingestion_name): |
| 2756 | + """ get ingestion config detail |
| 2757 | + Unsuccessful opertaion will cause an LogException. |
| 2758 | +
|
| 2759 | + :type project_name: string |
| 2760 | + :param project_name: the Project name |
| 2761 | +
|
| 2762 | + :type ingestion_name: string |
| 2763 | + :param ingestion_name: the ingestion name |
| 2764 | +
|
| 2765 | + :return: GetIngestionResponse |
| 2766 | +
|
| 2767 | + :raise: LogException |
| 2768 | + """ |
| 2769 | + |
| 2770 | + headers = {} |
| 2771 | + params = {} |
| 2772 | + resource = "/jobs/" + ingestion_name |
| 2773 | + (resp, header) = self._send("GET", project_name, None, resource, params, headers) |
| 2774 | + return GetIngestionResponse(resp, header) |
| 2775 | + |
| 2776 | + def start_ingestion(self, project_name, ingestion_name): |
| 2777 | + """ start ingestion |
| 2778 | + Unsuccessful opertaion will cause an LogException. |
| 2779 | +
|
| 2780 | + :type project_name: string |
| 2781 | + :param project_name: the Project name |
| 2782 | +
|
| 2783 | + :type ingestion_name: string |
| 2784 | + :param ingestion_name: the ingestion name |
| 2785 | +
|
| 2786 | + :return: StartIngestionResponse |
| 2787 | +
|
| 2788 | + :raise: LogException |
| 2789 | + """ |
| 2790 | + |
| 2791 | + headers = {} |
| 2792 | + params = {"action":"START"} |
| 2793 | + resource = "/jobs/" + ingestion_name |
| 2794 | + |
| 2795 | + (resp, header) = self._send("PUT", project_name, None, resource, params, headers) |
| 2796 | + return StartIngestionResponse(header, resp) |
| 2797 | + |
| 2798 | + def stop_ingestion(self, project_name, ingestion_name): |
| 2799 | + """ stop ingestion |
| 2800 | + Unsuccessful opertaion will cause an LogException. |
| 2801 | +
|
| 2802 | + :type project_name: string |
| 2803 | + :param project_name: the Project name |
| 2804 | +
|
| 2805 | + :type ingestion_name: string |
| 2806 | + :param ingestion_name: the ingestion name |
| 2807 | +
|
| 2808 | + :return: StopIngestionResponse |
| 2809 | +
|
| 2810 | + :raise: LogException |
| 2811 | + """ |
| 2812 | + |
| 2813 | + headers = {} |
| 2814 | + params = {"action":"STOP"} |
| 2815 | + resource = "/jobs/" + ingestion_name |
| 2816 | + |
| 2817 | + (resp, header) = self._send("PUT", project_name, None, resource, params, headers) |
| 2818 | + return StopIngestionResponse(header, resp) |
| 2819 | + |
2662 | 2820 |
|
2663 | 2821 | make_lcrud_methods(LogClient, 'dashboard', name_field='dashboardName')
|
2664 | 2822 | make_lcrud_methods(LogClient, 'alert', name_field='name', root_resource='/jobs', entities_key='results')
|
|
0 commit comments