apache / incubator-pegasus

Apache Pegasus - A horizontally scalable, strongly consistent and high-performance key-value store
https://pegasus.apache.org/
Apache License 2.0
1.96k stars 310 forks source link

feat(shell): Add JSON format data output to some backup_policy commands #2030

Closed Samunroyu closed 1 month ago

Samunroyu commented 1 month ago

Add JSON output to some backup policy commands to facilitate the writing of automation scripts.

Backup policy commands including:

ls_backup_policy Output example by Tabler format

[p1]
backup_provider_type  : hdfs_service
backup_interval       : 86400s
app_ids               : {3}
start_time            : 03:36
status                : enabled
backup_history_count  : 1

[p2]
backup_provider_type  : hdfs_service
backup_interval       : 86400s
app_ids               : {3}
start_time            : 20:25
status                : enabled
backup_history_count  : 1

ls_backup_policy Output example by JSON format

{
    "p1": {
        "backup_provider_type": "hdfs_service",
        "backup_interval": "86400s",
        "app_ids": "{3}",
        "start_time": "03:36",
        "status": "enabled",
        "backup_history_count": "1"
    },
    "p2": {
        "backup_provider_type": "hdfs_service",
        "backup_interval": "86400s",
        "app_ids": "{3}",
        "start_time": "20:25",
        "status": "enabled",
        "backup_history_count": "1"
    }
}

query_backup_policy Output example by Tabler format

[p1]
backup_provider_type  : hdfs_service
backup_interval       : 86400s
app_ids               : {3}
start_time            : 03:36
status                : enabled
backup_history_count  : 1

[backup_info]
id             start_time           end_time  app_ids
1716781003199  2024-05-27 03:36:43  -         {3}

[p2]
backup_provider_type  : hdfs_service
backup_interval       : 86400s
app_ids               : {3}
start_time            : 20:25
status                : enabled
backup_history_count  : 1

[backup_info]
id             start_time           end_time  app_ids
1716840160297  2024-05-27 20:02:40  -         {3}

query_backup_policy Output example by JSON format

   {
        "p1": {
            "backup_provider_type": "hdfs_service",
            "backup_interval": "86400s",
            "app_ids": "{3}",
            "start_time": "03:36",
            "status": "enabled",
            "backup_history_count": "1"
        },
        "p1_backup_info": {
            "1716781003199": {
                "id": "1716781003199",
                "start_time": "2024-05-27 03:36:43",
                "end_time": "-",
                "app_ids": "{3}"
            }
        },
        "p2": {
            "backup_provider_type": "hdfs_service",
            "backup_interval": "86400s",
            "app_ids": "{3}",
            "start_time": "20:25",
            "status": "enabled",
            "backup_history_count": "1"
        },
        "p2_backup_info": {
            "1716840160297": {
                "id": "1716840160297",
                "start_time": "2024-05-27 20:02:40",
                "end_time": "-",
                "app_ids": "{3}"
            }
        }
    }