github.com/cloudwan/edgelq-sdk@v1.15.4/audit/proto/v1alpha2/activity_log.proto (about)

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