diff --git a/aliyun/log/__init__.py b/aliyun/log/__init__.py index ff2691d..3075e20 100755 --- a/aliyun/log/__init__.py +++ b/aliyun/log/__init__.py @@ -48,6 +48,8 @@ from .metering_mode_response import GetLogStoreMeteringModeResponse, \ GetMetricStoreMeteringModeResponse, \ UpdateLogStoreMeteringModeResponse, UpdateMetricStoreMeteringModeResponse +from .multimodal_config_response import GetLogStoreMultimodalConfigurationResponse, \ + PutLogStoreMultimodalConfigurationResponse from .object_response import PutObjectResponse, GetObjectResponse from .store_view import StoreView, StoreViewStore diff --git a/aliyun/log/logclient.py b/aliyun/log/logclient.py index 84bf9fa..172d7f9 100644 --- a/aliyun/log/logclient.py +++ b/aliyun/log/logclient.py @@ -76,6 +76,8 @@ from .metering_mode_response import GetLogStoreMeteringModeResponse, \ GetMetricStoreMeteringModeResponse, UpdateLogStoreMeteringModeResponse, \ UpdateMetricStoreMeteringModeResponse +from .multimodal_config_response import GetLogStoreMultimodalConfigurationResponse, \ + PutLogStoreMultimodalConfigurationResponse from .object_response import PutObjectResponse, GetObjectResponse from .util import require_python3, object_name_encode @@ -1833,6 +1835,61 @@ def update_logstore_metering_mode(self, project_name, logstore_name, metering_mo (resp, header) = self._send("PUT", project_name, body_str, resource, params, headers) return UpdateLogStoreMeteringModeResponse(header, resp) + def get_logstore_multimodal_configuration(self, project_name, logstore_name): + """ Get the multimodal configuration of the logstore + Unsuccessful operation will cause an LogException. + + :type project_name: string + :param project_name: the Project name + + :type logstore_name: string + :param logstore_name: the logstore name + + :return: GetLogStoreMultimodalConfigurationResponse + + :raise: LogException + """ + params = {} + resource = "/logstores/" + logstore_name + "/multimodalconfiguration" + headers = {} + + (resp, header) = self._send("GET", project_name, None, resource, params, headers) + return GetLogStoreMultimodalConfigurationResponse(resp, header) + + def put_logstore_multimodal_configuration(self, project_name, logstore_name, status, anonymous_write=None): + """ Put the multimodal configuration of the logstore + Unsuccessful operation will cause an LogException. + + :type project_name: string + :param project_name: the Project name + + :type logstore_name: string + :param logstore_name: the logstore name + + :type status: string + :param status: the status of multimodal configuration, required (e.g., "Enabled" or "Disabled") + + :type anonymous_write: string + :param anonymous_write: the anonymous write setting, optional (e.g., "Enabled" or "Disabled") + + :return: PutLogStoreMultimodalConfigurationResponse + + :raise: LogException + """ + params = {} + resource = "/logstores/" + logstore_name + "/multimodalconfiguration" + headers = {"x-log-bodyrawsize": '0', "Content-Type": "application/json"} + body = { + "status": status + } + if anonymous_write is not None: + body["anonymousWrite"] = anonymous_write + + body_str = six.b(json.dumps(body)) + + (resp, header) = self._send("PUT", project_name, body_str, resource, params, headers) + return PutLogStoreMultimodalConfigurationResponse(header, resp) + def get_metric_store_metering_mode(self, project_name, metric_store_name): """ Get the metering mode of the metric store Unsuccessful operation will cause an LogException. diff --git a/aliyun/log/multimodal_config_response.py b/aliyun/log/multimodal_config_response.py new file mode 100644 index 0000000..2f4c6fb --- /dev/null +++ b/aliyun/log/multimodal_config_response.py @@ -0,0 +1,61 @@ +#!/usr/bin/env python +# encoding: utf-8 + +# Copyright (C) Alibaba Cloud Computing +# All rights reserved. + +from .util import Util +from .logresponse import LogResponse + + +class GetLogStoreMultimodalConfigurationResponse(LogResponse): + """ The response of the get_logstore_multimodal_configuration API from log. + + :type header: dict + :param header: GetLogStoreMultimodalConfigurationResponse HTTP response header + + :type resp: dict + :param resp: the HTTP response body + """ + + def __init__(self, resp, header): + LogResponse.__init__(self, header, resp) + self.status = Util.convert_unicode_to_str(resp["status"]) + self.anonymous_write = None + if "anonymousWrite" in resp: + self.anonymous_write = Util.convert_unicode_to_str(resp["anonymousWrite"]) + + def get_status(self): + """ + :return: string, the status of the multimodal configuration + """ + return self.status + + def get_anonymous_write(self): + """ + :return: string, the anonymous write setting, or None if not set + """ + return self.anonymous_write + + def log_print(self): + print('GetLogStoreMultimodalConfigurationResponse') + print('headers:', self.get_all_headers()) + print('status:', self.status) + if self.anonymous_write is not None: + print('anonymousWrite:', self.anonymous_write) + + +class PutLogStoreMultimodalConfigurationResponse(LogResponse): + """ The response of the put_logstore_multimodal_configuration API from log. + + :type header: dict + :param header: PutLogStoreMultimodalConfigurationResponse HTTP response header + """ + + def __init__(self, header, resp=''): + LogResponse.__init__(self, header, resp) + + def log_print(self): + print('PutLogStoreMultimodalConfigurationResponse:') + print('headers:', self.get_all_headers()) + diff --git a/aliyun/log/version.py b/aliyun/log/version.py index 3cb5462..9133d17 100644 --- a/aliyun/log/version.py +++ b/aliyun/log/version.py @@ -1,4 +1,4 @@ -__version__ = '0.9.39' +__version__ = '0.9.40' import sys OS_VERSION = str(sys.platform)