From 5068ad87eb9c46a891de2e6cdcbc7314b7e27a78 Mon Sep 17 00:00:00 2001 From: SnhrK Date: Fri, 8 Dec 2023 17:24:15 +0900 Subject: [PATCH] chore(admin): add audit log rpc --- admin/v1/admin.proto | 22 ++++++++++++++++++++++ api/audit.proto | 22 ++++++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 api/audit.proto diff --git a/admin/v1/admin.proto b/admin/v1/admin.proto index 49fffa03..f539650f 100644 --- a/admin/v1/admin.proto +++ b/admin/v1/admin.proto @@ -4,6 +4,7 @@ package blueapi.admin.v1; import "api/accountgroup.proto"; import "api/notification.proto"; +import "api/audit.proto"; import "protos/operation.proto"; import "google/api/annotations.proto"; import "google/protobuf/empty.proto"; @@ -200,6 +201,14 @@ service Admin { }; } + // WORK-IN-PROGRESS: Exports audit logs for login user's organization. + rpc ExportAuditLogs(ExportAuditLogsRequest) returns (api.AuditExport) { + option (google.api.http) = { + post: "/admin/v1/auditlogs:export" + body: "*" + }; + } + } // Request message for the Admin.ListAccountGroups rpc. @@ -557,4 +566,17 @@ message ProformaCur { string timeCreated = 7; +} + + +// Request message for the ExportAuditLogs rpc. +message ExportAuditLogsRequest { + // Required. At the moment, `CSV`,`JSON` is supported. + string format = 1; + + // Required. The UTC date to start data from. If not set, the first day of the current year will be used. Format: `yyyymmdd`. + string startTime = 2; + + // Required. The UTC date to end data from. If not set, the first day of the current year will be used. Format: `yyyymmdd`. + string endTime = 3; } \ No newline at end of file diff --git a/api/audit.proto b/api/audit.proto new file mode 100644 index 00000000..e86e92ab --- /dev/null +++ b/api/audit.proto @@ -0,0 +1,22 @@ +syntax = "proto3"; + +package blueapi.api; + +option go_package = "github.com/alphauslabs/blue-sdk-go/api"; +option java_package = "cloud.alphaus.blueapi.api"; +option java_outer_classname = "ApiAuditProto"; + +// AuditExport resource definition. +message AuditExport { + AuditExportData data = 1; +} + +// AuditExportData resource definition. +message AuditExportData { + // Encoded value + string content = 1; + // Downloaded content lines. + int64 downloadedRows = 2; + // Total of content lines. + int64 totalRows = 3; +} \ No newline at end of file