github.com/cloudwan/edgelq-sdk@v1.15.4/audit/proto/v1/activity_log.proto (about) 1 syntax = "proto3"; 2 3 package ntt.audit.v1; 4 5 import "edgelq-sdk/audit/proto/v1/common.proto"; 6 import "edgelq-sdk/common/rpc/status.proto"; 7 import "edgelq-sdk/iam/proto/v1/organization.proto"; 8 import "edgelq-sdk/iam/proto/v1/project.proto"; 9 import "google/api/resource.proto"; 10 import "google/protobuf/any.proto"; 11 import "google/protobuf/field_mask.proto"; 12 import "google/protobuf/timestamp.proto"; 13 import "goten-sdk/meta-service/proto/v1/service.proto"; 14 15 option go_package = "github.com/cloudwan/edgelq-sdk/audit/resources/v1/activity_log;activity_log"; 16 option java_multiple_files = true; 17 option java_outer_classname = "ActivityLogProto"; 18 option java_package = "com.ntt.audit.pb.v1"; 19 20 // ActivityLog Resource - describes notification of 21 // activity triggered by a request sent to an API service. 22 // ActivityLog creation is triggered by an API service 23 // when it receives either unary or stream request. 24 // 25 // ActivityLog contains messages exchanged between client 26 // and server within single API call and finally exit status. 27 // ActivityLog is method oriented - service name + method name 28 // (for example IAM/CreateRoleBinding) is a leading information. 29 // 30 // ActivityLog can have N associated ResourceChangeLog objects, 31 // if API call it describes made some changes in a data store. 32 // You can combine ActivityLog and ResourceChangeLog by making 33 // queries with request_id specified in a filter. 34 message ActivityLog { 35 option (google.api.resource) = { 36 type : "audit.edgelq.com/ActivityLog" 37 pattern : "projects/{project}/activityLogs/{activity_log}" 38 pattern : "organizations/{organization}/activityLogs/{activity_log}" 39 pattern : "services/{service}/activityLogs/{activity_log}" 40 }; 41 42 // Name of ActivityLog. It contains scope + ID of the log. 43 // ID is a base64 encoded unique key that identifies tuple: 44 // scope 45 // request_id 46 // authentication.principal 47 // request_metadata.ip_address 48 // request_metadata.user_agent 49 // request_routing.via_region 50 // request_routing.dest_regions 51 // authorization.granted_permissions 52 // authorization.denied_permissions 53 // service.name 54 // service.region_id 55 // service.hostname 56 // method.type 57 // method.version 58 // resource.name 59 // resource.difference.fields 60 // category 61 // labels 62 // 63 // Key is not to be decoded outside of service, but treated as opaque string 64 string name = 1; 65 66 // Contains scope from name field without resource ID. 67 // Used for internal purpose for filtering (logs are using custom store). 68 // Example formats are: 69 // - organization/umbrella 70 // - projects/mars_exploration 71 // - services/devices.edgelq.com 72 string scope = 2; 73 74 // Generated ID of the request. Same ID must be used in ResourceChangeLog 75 // objects associated with this request. 76 uint64 request_id = 3; 77 78 // Authentication data - informs who made a request 79 Authentication authentication = 5; 80 81 // Authorization data - informs what permissions were 82 // granted or denied for associated request 83 Authorization authorization = 6; 84 85 // Information about the service 86 ServiceData service = 7; 87 88 // Information about the method 89 Method method = 8; 90 91 // Request metadata 92 RequestMetadata request_metadata = 13; 93 94 // Request routing 95 RequestRouting request_routing = 14; 96 97 // Primary resource for this activity. 98 Resource resource = 11; 99 100 // Category of the activity log. 101 Category category = 12; 102 103 // List of query-able labels 104 map<string, string> labels = 9; 105 106 // List of events attached to this log 107 repeated Event events = 10; 108 109 // Event associated with activity. 110 message Event { 111 oneof evt { 112 // Client message received event 113 ClientMsgEvent client_message = 1; 114 115 // Server message sent event 116 ServerMsgEvent server_message = 2; 117 118 // Request finished event 119 ExitEvent exit = 3; 120 121 // Server received response from another server (used for split & merge) 122 // which describes PARTIAL result to be sent to the client. 123 RegionalServerMsgEvent regional_server_message = 4; 124 125 // Server received exit code from another server (used for split & merge). 126 // In case it contains error, its likely final exit will contain this too. 127 RegionalServerMsgEvent regional_exit = 5; 128 } 129 130 // Describes client message event 131 message ClientMsgEvent { 132 // Message contents 133 google.protobuf.Any data = 1; 134 135 // Time of a message 136 google.protobuf.Timestamp time = 2; 137 } 138 139 // Describes message received from server in specific region. 140 // This type is used only for requests, which receiving server decided to 141 // split across many regions. Each regional server sends own response and 142 // executing server is responsible for merging all partial results into one. 143 // This type does not show what was sent to the client. 144 // TODO: No use case for now, just placeholder, no server implementation 145 message RegionalServerMsgEvent { 146 // Message contents 147 google.protobuf.Any data = 1; 148 149 // Time of a message 150 google.protobuf.Timestamp time = 2; 151 152 // Region ID where message comes from. 153 string region_id = 3; 154 } 155 156 // Describes server message event 157 message ServerMsgEvent { 158 // Message contents 159 google.protobuf.Any data = 1; 160 161 // Time of a message 162 google.protobuf.Timestamp time = 2; 163 } 164 165 // Describes exit code received from server in specific region. 166 // This type is used only for requests, which receiving server decided to 167 // split across many regions. Each regional server sends own response and 168 // executing server is responsible for merging all partial results into one. 169 // IT does not contain status actually sent to the client. 170 // TODO: No use case for now, just placeholder, no server implementation 171 message RegionalExitEvent { 172 // Final status of a request for given region 173 ntt.rpc.Status status = 1; 174 175 // Time when request finished 176 google.protobuf.Timestamp time = 2; 177 178 // Region ID where status comes from 179 string region_id = 3; 180 } 181 182 // Describes exit event (request finished) 183 message ExitEvent { 184 // Final status of a request 185 ntt.rpc.Status status = 1; 186 187 // Time when request finished 188 google.protobuf.Timestamp time = 2; 189 } 190 } 191 192 // Description of the executed method 193 message Method { 194 // Type name of a method, for example "UpdateRoleBinding". 195 string type = 1; 196 197 // Version in which method was executed. 198 string version = 2; 199 } 200 201 // Additional information about request caller 202 message RequestMetadata { 203 // Source IP from where request came 204 string ip_address = 1; 205 206 // Agent used by the request caller 207 string user_agent = 2; 208 } 209 210 // Additional information regarding request routing. Request can be: 211 // * Received and executed locally 212 // * Received and redirected to another region 213 // * Received, then split across multiple-regions. Responses are merged before 214 // sending back to client 215 message RequestRouting { 216 // ID of a region which originally received request, if redirection or split 217 // & merge was required 218 string via_region = 1; 219 220 // IDs of regions to which request was actually addressed. 221 repeated string dest_regions = 2; 222 } 223 224 // Description of the main resource activity refers to. 225 // For standard, goten-generated actions it's same as resource 226 // assigned to the the method. For custom actions, in some cases, developer 227 // may pick however different resource (it is customizable in proto audit 228 // spec). 229 message Resource { 230 // full name of the resource 231 string name = 1; 232 233 // difference contains update information of the resource. 234 // Left empty if the request described by this activity log did not 235 // update the resource. 236 Difference difference = 2; 237 238 // Describes changes (in database) executed on the resource. 239 message Difference { 240 // List of updated field paths (which are either marked as a state or 241 // spec fields). Proper, actual values are stored in "before" and "after" 242 // fields. Populated only for updating requests. 243 google.protobuf.FieldMask fields = 1; 244 245 // State of the resource before update. 246 // Note that "before" object contains only values of fields present 247 // in "fields". It does not contain whole resource as it was before 248 // the update. 249 google.protobuf.Any before = 2; 250 251 // State of the resource after update. 252 // Note that "after" object contains only values of fields present 253 // in "fields". It does not contain whole resource as it is after 254 // the update. 255 google.protobuf.Any after = 3; 256 } 257 } 258 259 // Activity log category. 260 // Each activity log basically describes read or write action, 261 // optionally describes other "operation" type. 262 enum Category { 263 // Undefined, should never be used 264 Undefined = 0; 265 266 // Describes all requests that involved execution of some special operation, 267 // for example, SSH connection could be put in this category. 268 // It's for requests that cannot be classified clearly as a read or write. 269 Operation = 2; 270 271 // Describes all requests that involved creation of a new resource. 272 Creation = 1; 273 274 // Describes all requests which involved deletion of an existing resource. 275 Deletion = 11; 276 277 // Describes all update requests that changed specification fields in 278 // an existing resource(s). 279 SpecUpdate = 3; 280 281 // Describes all update requests that changed state fields in an existing 282 // resource(s) (but not specification). 283 StateUpdate = 4; 284 285 // Describes all update requests that are neither of SpecUpdate or 286 // StateUpdate type. It is for non-significant updates like modification of 287 // metadata annotations. 288 MetaUpdate = 6; 289 290 // Describes an internal update of the system (like controller creating role 291 // binding for each group member for each role assigned to group). 292 // It includes all CUD requests as long as they are result of an internal 293 // system balancing. 294 Internal = 5; 295 296 // Describes request that has been rejected and therefore no action 297 // has happened. This is result of lack of permission/authentication. 298 Rejected = 7; 299 300 // Describes request that has failed due to client error (like validation 301 // error) 302 ClientError = 8; 303 304 // Describes request that has failed due to server issue. 305 ServerError = 9; 306 307 // Describes any read request (like BatchGet, Get, List, Watch). 308 Read = 10; 309 } 310 }