aliyun-log-python-sdk 0.9.26__tar.gz → 0.9.27__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (132) hide show
  1. {aliyun_log_python_sdk-0.9.26/aliyun_log_python_sdk.egg-info → aliyun_log_python_sdk-0.9.27}/PKG-INFO +1 -1
  2. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/logclient.py +60 -3
  3. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/logclient_operator.py +188 -1
  4. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/version.py +1 -1
  5. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27/aliyun_log_python_sdk.egg-info}/PKG-INFO +1 -1
  6. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/LICENSE +0 -0
  7. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/README.md +0 -0
  8. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/__init__.py +0 -0
  9. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/__init__.py +0 -0
  10. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/_proto_py2/__init__.py +0 -0
  11. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/_proto_py2/log_logs_pb2.py +0 -0
  12. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/_proto_py2/log_logs_raw_pb2.py +0 -0
  13. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/acl_config.py +0 -0
  14. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/acl_response.py +0 -0
  15. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/auth.py +0 -0
  16. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/common_response.py +0 -0
  17. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/compress.py +0 -0
  18. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/consumer/__init__.py +0 -0
  19. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/consumer/checkpoint_tracker.py +0 -0
  20. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/consumer/config.py +0 -0
  21. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/consumer/consumer_client.py +0 -0
  22. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/consumer/exceptions.py +0 -0
  23. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/consumer/fetched_log_group.py +0 -0
  24. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/consumer/heart_beat.py +0 -0
  25. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/consumer/shard_worker.py +0 -0
  26. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/consumer/tasks.py +0 -0
  27. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/consumer/worker.py +0 -0
  28. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/consumer_group_request.py +0 -0
  29. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/consumer_group_response.py +0 -0
  30. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/credentials.py +0 -0
  31. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/cursor_response.py +0 -0
  32. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/cursor_time_response.py +0 -0
  33. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/es_migration/__init__.py +0 -0
  34. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/es_migration/doc_logitem_converter.py +0 -0
  35. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/es_migration/index_logstore_mappings.py +0 -0
  36. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/es_migration/mapping_index_converter.py +0 -0
  37. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/es_migration/migration_log.py +0 -0
  38. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/es_migration/migration_manager.py +0 -0
  39. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/es_migration/migration_response.py +0 -0
  40. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/es_migration/migration_task.py +0 -0
  41. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/es_migration/util.py +0 -0
  42. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/etl_config_response.py +0 -0
  43. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/etl_core/__init__.py +0 -0
  44. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/etl_core/config_parser.py +0 -0
  45. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/etl_core/etl_util.py +0 -0
  46. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/etl_core/exceptions.py +0 -0
  47. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/etl_core/restrict_config_parser.py +0 -0
  48. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/etl_core/runner.py +0 -0
  49. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/etl_core/settings.py +0 -0
  50. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/etl_core/trans_comp/__init__.py +0 -0
  51. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/etl_core/trans_comp/trans_base.py +0 -0
  52. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/etl_core/trans_comp/trans_csv.py +0 -0
  53. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/etl_core/trans_comp/trans_json.py +0 -0
  54. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/etl_core/trans_comp/trans_kv.py +0 -0
  55. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/etl_core/trans_comp/trans_lookup.py +0 -0
  56. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/etl_core/trans_comp/trans_mv.py +0 -0
  57. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/etl_core/trans_comp/trans_regex.py +0 -0
  58. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/etl_core/trans_comp/trans_set_field.py +0 -0
  59. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/etl_core/transform/__init__.py +0 -0
  60. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/etl_core/transform/condition_list.py +0 -0
  61. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/etl_core/transform/condition_transform.py +0 -0
  62. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/etl_core/transform/condition_util.py +0 -0
  63. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/etl_core/transform/transform_base.py +0 -0
  64. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/etl_core/transform/transform_list.py +0 -0
  65. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/etl_core/transform/transform_meta.py +0 -0
  66. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/export_response.py +0 -0
  67. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/ext/__init__.py +0 -0
  68. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/ext/jupyter_magic.py +0 -0
  69. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/ext/syslogclient.py +0 -0
  70. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/external_store_config.py +0 -0
  71. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/external_store_config_response.py +0 -0
  72. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/getcontextlogsresponse.py +0 -0
  73. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/gethistogramsrequest.py +0 -0
  74. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/gethistogramsresponse.py +0 -0
  75. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/getlogsrequest.py +0 -0
  76. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/getlogsresponse.py +0 -0
  77. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/histogram.py +0 -0
  78. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/index_config.py +0 -0
  79. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/index_config_response.py +0 -0
  80. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/ingestion_response.py +0 -0
  81. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/job.py +0 -0
  82. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/listlogstoresrequest.py +0 -0
  83. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/listlogstoresresponse.py +0 -0
  84. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/listtopicsrequest.py +0 -0
  85. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/listtopicsresponse.py +0 -0
  86. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/log_logs_pb2.py +0 -0
  87. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/log_logs_raw_pb2.py +0 -0
  88. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/logclient_core.py +0 -0
  89. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/logexception.py +0 -0
  90. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/logger_hanlder.py +0 -0
  91. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/logitem.py +0 -0
  92. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/logrequest.py +0 -0
  93. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/logresponse.py +0 -0
  94. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/logstore_config_response.py +0 -0
  95. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/logtail_config_detail.py +0 -0
  96. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/logtail_config_response.py +0 -0
  97. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/machine_group_detail.py +0 -0
  98. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/machinegroup_response.py +0 -0
  99. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/metering_mode_response.py +0 -0
  100. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/odps_sink.py +0 -0
  101. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/oss_sink.py +0 -0
  102. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/pluralize.py +0 -0
  103. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/project_response.py +0 -0
  104. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/proto.py +0 -0
  105. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/pulllog_response.py +0 -0
  106. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/putlogsrequest.py +0 -0
  107. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/putlogsresponse.py +0 -0
  108. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/queriedlog.py +0 -0
  109. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/rebuild_index_response.py +0 -0
  110. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/resource_params.py +0 -0
  111. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/resource_response.py +0 -0
  112. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/scheduled_sql.py +0 -0
  113. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/scheduled_sql_response.py +0 -0
  114. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/shard_response.py +0 -0
  115. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/shipper_config.py +0 -0
  116. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/shipper_response.py +0 -0
  117. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/sink.py +0 -0
  118. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/sql_instance_response.py +0 -0
  119. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/store_view.py +0 -0
  120. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/store_view_response.py +0 -0
  121. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/substore_config_response.py +0 -0
  122. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/tag_response.py +0 -0
  123. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/topostore_params.py +0 -0
  124. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/topostore_response.py +0 -0
  125. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun/log/util.py +0 -0
  126. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun_log_python_sdk.egg-info/SOURCES.txt +0 -0
  127. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun_log_python_sdk.egg-info/dependency_links.txt +0 -0
  128. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun_log_python_sdk.egg-info/requires.txt +0 -0
  129. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/aliyun_log_python_sdk.egg-info/top_level.txt +0 -0
  130. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/setup.cfg +0 -0
  131. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/setup.py +0 -0
  132. {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.27}/tests/test_alert.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: aliyun-log-python-sdk
3
- Version: 0.9.26
3
+ Version: 0.9.27
4
4
  Summary: Aliyun log service Python client SDK
5
5
  Home-page: https://github.com/aliyun/aliyun-log-python-sdk
6
6
  Author: Aliyun
@@ -33,7 +33,7 @@ from .sql_instance_response import *
33
33
  from .listlogstoresresponse import ListLogstoresResponse
34
34
  from .listtopicsresponse import ListTopicsResponse
35
35
  from .logclient_operator import copy_project, list_more, query_more, pull_log_dump, copy_logstore, copy_data, \
36
- get_resource_usage, arrange_shard, transform_data
36
+ get_resource_usage, arrange_shard, transform_data, copy_dashboard, copy_alert
37
37
  from .logexception import LogException
38
38
  from .logstore_config_response import *
39
39
  from .substore_config_response import *
@@ -3165,7 +3165,7 @@ class LogClient(object):
3165
3165
  (resp, header) = self._send('POST', project, body_str, resource, params, headers)
3166
3166
  return ConsumerGroupHeartBeatResponse(resp, header)
3167
3167
 
3168
- def copy_project(self, from_project, to_project, to_client=None, copy_machine_group=False):
3168
+ def copy_project(self, from_project, to_project, to_client=None, copy_machine_group=False, copy_dashboards=False, copy_alerts=False):
3169
3169
  """
3170
3170
  copy project, logstore, machine group and logtail config to target project,
3171
3171
  expecting the target project doesn't contain same named logstores as source project
@@ -3182,11 +3182,17 @@ class LogClient(object):
3182
3182
  :type copy_machine_group: bool
3183
3183
  :param copy_machine_group: if copy machine group resources, False by default.
3184
3184
 
3185
+ :type copy_dashboards: bool
3186
+ :param copy_dashboards: if copy dashboard resources, False by default.
3187
+
3188
+ :type copy_alerts: bool
3189
+ :param copy_alerts: if copy alert resources, False by default.
3190
+
3185
3191
  :return: None
3186
3192
  """
3187
3193
  if to_client is None:
3188
3194
  to_client = self
3189
- return copy_project(self, to_client, from_project, to_project, copy_machine_group)
3195
+ return copy_project(self, to_client, from_project, to_project, copy_machine_group, copy_dashboards, copy_alerts)
3190
3196
 
3191
3197
  def copy_logstore(self, from_project, from_logstore, to_logstore, to_project=None, to_client=None, to_region_endpoint=None, keep_config_name=False):
3192
3198
  """
@@ -3214,6 +3220,57 @@ class LogClient(object):
3214
3220
  :return:
3215
3221
  """
3216
3222
  return copy_logstore(self, from_project, from_logstore, to_logstore, to_project=to_project, to_client=to_client, to_region_endpoint=to_region_endpoint, keep_config_name=keep_config_name)
3223
+
3224
+
3225
+ def copy_dashboard(self, from_project, from_dashboard_name, to_project=None, to_dashboard_name=None, to_client=None, to_region_endpoint=None):
3226
+ """
3227
+ copy dashboard from one project to another project
3228
+ if to_dashboard_name is not None, the dashboard will be created with the name
3229
+
3230
+ :type from_project: string
3231
+ :param from_project: project name
3232
+
3233
+ :type from_dashboard_name: string
3234
+ :param from_dashboard_name: dashboard name
3235
+
3236
+ :type to_project: string
3237
+ :param to_project: project name, copy dashboard to same project if not being specified
3238
+
3239
+ :type to_dashboard_name: string
3240
+ :param to_dashboard_name: target dashboard name, if not being specified, will use from_dashboard_name as to_dashboard_name. If to_project is None, to_dashboard_name must be specified with a different name.
3241
+
3242
+ :type to_client: LogClient
3243
+ :param to_client: logclient instance
3244
+
3245
+ :type to_region_endpoint: string
3246
+ :param to_region_endpoint: target region, use it to operate on the "to_project" while "to_client" not be specified
3247
+ """
3248
+ return copy_dashboard(self, from_project, from_dashboard_name, to_project=to_project, to_dashboard_name=to_dashboard_name, to_client=to_client, to_region_endpoint=to_region_endpoint)
3249
+
3250
+ def copy_alert(self, from_project, from_alert_name, to_project=None, to_alert_name=None, to_client=None, to_region_endpoint=None):
3251
+ """
3252
+ copy alert from one project to another project
3253
+ if to_alert_name is not None, the alert will be created with the name
3254
+
3255
+ :type from_project: string
3256
+ :param from_project: project name
3257
+
3258
+ :type from_alert_name: string
3259
+ :param from_alert_name: alert name
3260
+
3261
+ :type to_project: string
3262
+ :param to_project: project name, copy alert to same project if not being specified
3263
+
3264
+ :type to_alert_name: string
3265
+ :param to_alert_name: target alert name, if not being specified, will use from_alert_name as to_alert_name. If to_project is None, to_alert_name must be specified with a different name.
3266
+
3267
+ :type to_client: LogClient
3268
+ :param to_client: logclient instance
3269
+
3270
+ :type to_region_endpoint: string
3271
+ :param to_region_endpoint: target region, use it to operate on the "to_project" while "to_client" not be specified
3272
+ """
3273
+ return copy_alert(self, from_project, from_alert_name, to_project=to_project, to_alert_name=to_alert_name, to_client=to_client, to_region_endpoint=to_region_endpoint)
3217
3274
 
3218
3275
  def list_project(self, offset=0, size=100, project_name_pattern=None, resource_group_id=''):
3219
3276
  """ list the project
@@ -25,7 +25,8 @@ MAX_INIT_SHARD_COUNT = 100
25
25
  logger = logging.getLogger(__name__)
26
26
 
27
27
 
28
- def copy_project(from_client, to_client, from_project, to_project, copy_machine_group=False):
28
+ # type: (LogClient, LogClient, str, str, bool, bool, bool) -> None
29
+ def copy_project(from_client, to_client, from_project, to_project, copy_machine_group=False, copy_dashboards=False, copy_alerts=False):
29
30
  """
30
31
  copy project, logstore, machine group and logtail config to target project,
31
32
  will create the target project if it doesn't exist
@@ -45,6 +46,12 @@ def copy_project(from_client, to_client, from_project, to_project, copy_machine_
45
46
  :type copy_machine_group: bool
46
47
  :param copy_machine_group: if copy machine group resources, False by default.
47
48
 
49
+ :type copy_dashboards: bool
50
+ :param copy_dashboards: if copy dashboard resources, False by default.
51
+
52
+ :type copy_alerts: bool
53
+ :param copy_alerts: if copy alert resources, False by default.
54
+
48
55
  :return:
49
56
  """
50
57
 
@@ -184,6 +191,33 @@ def copy_project(from_client, to_client, from_project, to_project, copy_machine_
184
191
  offset += count
185
192
  if count < size or offset >= total:
186
193
  break
194
+
195
+ offset, size = 0, default_fetch_size
196
+ while copy_dashboards:
197
+ ret = from_client.list_dashboard(from_project, offset=offset, size=size)
198
+ count = ret.get_count()
199
+ total = ret.get_total()
200
+ names = ret.get_dashboards()
201
+ for dashboard_name in names:
202
+ copy_dashboard(from_client, from_project, dashboard_name, to_project, to_client=to_client)
203
+
204
+ offset += count
205
+ if count < size or offset >= total:
206
+ break
207
+
208
+ offset, size = 0, default_fetch_size
209
+ while copy_alerts:
210
+ ret = from_client.list_alert(from_project, offset=offset, size=size)
211
+ count = ret.get_count()
212
+ total = ret.get_total()
213
+ alerts = ret.get_alerts()
214
+ for alert in alerts:
215
+ copy_alert(from_client, from_project, alert["name"], to_project, to_client=to_client)
216
+
217
+ offset += count
218
+ if count < size or offset >= total:
219
+ break
220
+
187
221
 
188
222
 
189
223
  def copy_logstore(from_client, from_project, from_logstore, to_logstore, to_project=None, to_client=None, to_region_endpoint=None, keep_config_name=False):
@@ -956,3 +990,156 @@ def transform_data(from_client, from_project, from_logstore, from_time,
956
990
  worker.join(timeout=120)
957
991
 
958
992
  return LogResponse({}, result)
993
+
994
+
995
+ def _rebind_dashboard_query(dashboard, project_name):
996
+ new_dashboard = copy.deepcopy(dashboard)
997
+ if "charts" not in dashboard:
998
+ return new_dashboard
999
+
1000
+ for chart in new_dashboard["charts"]:
1001
+ # replace project in chartQueries
1002
+ if "search" in chart and "chartQueries" in chart["search"]:
1003
+ for query in chart["search"]["chartQueries"]:
1004
+ if "project" in query and query["project"] != project_name:
1005
+ query["project"] = project_name
1006
+
1007
+ # replace project in events
1008
+ if "display" in chart and "actionOptions" in chart["display"]:
1009
+ for action in chart["display"]["actionOptions"]:
1010
+ if "events" not in action:
1011
+ continue
1012
+ for event in action["events"]:
1013
+ if "values" in event and "project" in event["values"] and event["values"]["project"] != project_name:
1014
+ event["values"]["project"] = project_name
1015
+ return new_dashboard
1016
+
1017
+ def copy_dashboard(from_client, from_project, from_dashboard_name, to_project=None, to_dashboard_name=None, to_client=None, to_region_endpoint=None):
1018
+ """
1019
+ copy dashboard from one project to another project
1020
+ if to_dashboard_name is not None, the dashboard will be created with the name
1021
+
1022
+ :type from_client: LogClient
1023
+ :param from_client: logclient instance
1024
+
1025
+ :type from_project: string
1026
+ :param from_project: project name
1027
+
1028
+ :type from_dashboard_name: string
1029
+ :param from_dashboard_name: dashboard name
1030
+
1031
+ :type to_project: string
1032
+ :param to_project: project name, copy dashboard to same project if not being specified
1033
+
1034
+ :type to_dashboard_name: string
1035
+ :param to_dashboard_name: target dashboard name, if not being specified, will use from_dashboard_name as to_dashboard_name. If to_project is None, to_dashboard_name must be specified with a different name.
1036
+
1037
+ :type to_client: LogClient
1038
+ :param to_client: logclient instance, use it to operate on the "to_project" if being specified
1039
+
1040
+ :type to_region_endpoint: string
1041
+ :param to_region_endpoint: target region, use it to operate on the "to_project" while "to_client" not be specified
1042
+ """
1043
+
1044
+ if to_region_endpoint is not None and to_client is None:
1045
+ to_client = copy.deepcopy(from_client)
1046
+ to_client.set_endpoint(to_region_endpoint)
1047
+ else:
1048
+ to_client = to_client or from_client
1049
+
1050
+ to_project = to_project or from_project
1051
+ to_dashboard_name = to_dashboard_name or from_dashboard_name
1052
+
1053
+ from_dashboard_resp = from_client.get_dashboard(from_project, from_dashboard_name)
1054
+
1055
+ if from_project != to_project:
1056
+ to_dashboard = _rebind_dashboard_query(from_dashboard_resp.get_body(), to_project)
1057
+ else:
1058
+ to_dashboard = copy.deepcopy(from_dashboard_resp.get_body())
1059
+ to_dashboard["dashboardName"] = to_dashboard_name
1060
+
1061
+ try:
1062
+ to_dashboard = to_client.create_dashboard(to_project, to_dashboard)
1063
+ except LogException as ex:
1064
+ if ex.get_error_code() == 'ParameterInvalid' and 'already exists' in ex.get_error_message().lower():
1065
+ pass
1066
+ else:
1067
+ raise
1068
+
1069
+
1070
+ def _rebind_alert_query(alert, project_name):
1071
+ new_alert = copy.deepcopy(alert)
1072
+ for field in ['scheduleId', 'createTime', 'lastModifiedTime', 'lastModifiedBy']:
1073
+ if field in new_alert:
1074
+ del new_alert[field]
1075
+
1076
+ if "configuration" not in new_alert:
1077
+ return new_alert
1078
+
1079
+ if "queryList" in new_alert["configuration"]:
1080
+ for query in new_alert["configuration"]["queryList"]:
1081
+ if "project" in query and query["project"] != project_name:
1082
+ query["project"] = project_name
1083
+
1084
+ if "templateConfiguration" in new_alert["configuration"] and \
1085
+ "tokens" in new_alert["configuration"]["templateConfiguration"] and\
1086
+ "default.project" in new_alert["configuration"]["templateConfiguration"]["tokens"]:
1087
+ if new_alert["configuration"]["templateConfiguration"]["tokens"]["default.project"] != project_name:
1088
+ new_alert["configuration"]["templateConfiguration"]["tokens"]["default.project"] = project_name
1089
+
1090
+ return new_alert
1091
+
1092
+ def copy_alert(from_client, from_project, from_alert_name, to_project=None, to_alert_name=None, to_client=None, to_region_endpoint=None):
1093
+ """
1094
+ copy alert from one project to another project
1095
+ if to_alert_name is not None, the alert will be created with the name
1096
+
1097
+ :type from_client: LogClient
1098
+ :param from_client: logclient instance
1099
+
1100
+ :type from_project: string
1101
+ :param from_project: project name
1102
+
1103
+ :type from_alert_name: string
1104
+ :param from_alert_name: alert name
1105
+
1106
+ :type to_project: string
1107
+ :param to_project: project name, copy alert to same project if not being specified
1108
+
1109
+ :type to_alert_name: string
1110
+ :param to_alert_name: target alert name, if not being specified, will use from_alert_name as to_alert_name. If to_project is None, to_alert_name must be specified with a different name.
1111
+
1112
+ :type to_client: LogClient
1113
+ :param to_client: logclient instance, use it to operate on the "to_project" if being specified
1114
+
1115
+ :type to_region_endpoint: string
1116
+ :param to_region_endpoint: target region, use it to operate on the "to_project" while "to_client" not be specified
1117
+ """
1118
+
1119
+ if to_region_endpoint is not None and to_client is None:
1120
+ to_client = copy.deepcopy(from_client)
1121
+ to_client.set_endpoint(to_region_endpoint)
1122
+ else:
1123
+ to_client = to_client or from_client
1124
+
1125
+ to_project = to_project or from_project
1126
+ to_alert_name = to_alert_name or from_alert_name
1127
+
1128
+ from_alert_resp = from_client.get_alert(from_project, from_alert_name)
1129
+
1130
+ if from_project != to_project:
1131
+ to_alert = _rebind_alert_query(from_alert_resp.get_body(), to_project)
1132
+ else:
1133
+ to_alert = copy.deepcopy(from_alert_resp.get_body())
1134
+
1135
+ to_alert["name"] = to_alert_name
1136
+
1137
+ try:
1138
+ to_alert = to_client.create_alert(to_project, to_alert)
1139
+ except LogException as ex:
1140
+ if ex.get_error_code() == 'JobAlreadyExist':
1141
+ pass
1142
+ else:
1143
+ raise
1144
+
1145
+
@@ -1,4 +1,4 @@
1
- __version__ = '0.9.26'
1
+ __version__ = '0.9.27'
2
2
 
3
3
  import sys
4
4
  OS_VERSION = str(sys.platform)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: aliyun-log-python-sdk
3
- Version: 0.9.26
3
+ Version: 0.9.27
4
4
  Summary: Aliyun log service Python client SDK
5
5
  Home-page: https://github.com/aliyun/aliyun-log-python-sdk
6
6
  Author: Aliyun