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

     1  syntax = "proto3";
     2  
     3  package ntt.audit.v1;
     4  
     5  import "edgelq-sdk/audit/proto/v1/common.proto";
     6  import "google/api/resource.proto";
     7  import "google/protobuf/any.proto";
     8  import "google/protobuf/field_mask.proto";
     9  import "google/protobuf/timestamp.proto";
    10  import "goten-sdk/types/meta.proto";
    11  
    12  option go_package = "github.com/cloudwan/edgelq-sdk/audit/resources/v1/resource_change_log;resource_change_log";
    13  option java_multiple_files = true;
    14  option java_outer_classname = "ResourceChangeLogProto";
    15  option java_package = "com.ntt.audit.pb.v1";
    16  
    17  // ResourceChangeLog Resource - describes notification
    18  // of resource change. This log is resource oriented -
    19  // it strictly is associated with single resource,
    20  // where service name, resource type and resource name
    21  // are the strongest attributes.
    22  //
    23  // All resource changes are happening via API calls made
    24  // to API services. Therefore, each ResourceChangeLog
    25  // has associated ActivityLog. Relation is 1-N between
    26  // activity and resource change logs, as one API call
    27  // can modify multiple resources.
    28  message ResourceChangeLog {
    29    option (google.api.resource) = {
    30      type : "audit.edgelq.com/ResourceChangeLog"
    31      pattern : "projects/{project}/resourceChangeLogs/{resource_change_log}"
    32      pattern : "organizations/{organization}/resourceChangeLogs/"
    33                "{resource_change_log}"
    34      pattern : "services/{service}/resourceChangeLogs/{resource_change_log}"
    35    };
    36  
    37    // Name of ResourceChangeLog. It contains scope + ID of the log.
    38    // ID is a base64 encoded unique key that identifies tuple:
    39    //   scope
    40    //   request_id
    41    //   authentication.principal
    42    //   service.name
    43    //   service.region_id
    44    //   resource.name
    45    //   resource.type
    46    //   resource.pre.labels
    47    //   resource.post.labels
    48    //
    49    // ID part should not be decoded, but treated as opaque string
    50    string name = 1;
    51  
    52    // Contains scope from name field without resource ID.
    53    // Used for internal purpose for filtering (logs are using custom store).
    54    // Supported formats are:
    55    // - organization/umbrella
    56    // - projects/mars_exploration
    57    // - services/devices.edgelq.com
    58    string scope = 2;
    59  
    60    // Unique identifier of request - it must match the one
    61    // in the associated activity log.
    62    uint64 request_id = 3;
    63  
    64    // Time of the change - equal to request timestamp (activity log)
    65    google.protobuf.Timestamp timestamp = 4;
    66  
    67    // Authentication data - informs who made a change
    68    Authentication authentication = 5;
    69  
    70    // Information about the service
    71    ServiceData service = 6;
    72  
    73    // Describes change on the resource
    74    ResourceChange resource = 7;
    75  
    76    // Describes state of the transaction
    77    TransactionInfo transaction = 8;
    78  
    79    // Description of change on the resource
    80    message ResourceChange {
    81      // Fully qualified name of the resource (eg. "RoleBinding/Public")
    82      // that has changed from this request (if successful)
    83      string name = 1;
    84  
    85      // Name of the resource type for example "RoleBinding".
    86      string type = 2;
    87  
    88      // Action on the resource
    89      Action action = 3;
    90  
    91      // Field mask with different fields, populated only for
    92      // update action types.
    93      google.protobuf.FieldMask updated_fields = 6;
    94  
    95      // Previous values of updated fields. Its populated only
    96      // if update_fields is provided and for those fields only.
    97      // It is skipped for deletes.
    98      google.protobuf.Any previous = 7;
    99  
   100      // Current values of updated fields in case of update. Whole
   101      // resource in case of creation, empty in case of deletion.
   102      google.protobuf.Any current = 8;
   103  
   104      // List of query-able labels. They are taken from
   105      // both before and after resource, but after has higher priority
   106      map<string, string> labels = 9;
   107  
   108      // State of the resource before change.
   109      // It is empty if action is CREATE
   110      // DEPRECATED and not populated for new resources
   111      ObjectState pre = 4;
   112  
   113      // State of the resource after change.
   114      // It is empty if action is DELETE
   115      // DEPRECATED and not populated for new resources
   116      ObjectState post = 5;
   117  
   118      // Type of change
   119      enum Action {
   120        // to avoid blank item when printing logs
   121        UNDEFINED = 0;
   122  
   123        // Resource has been created
   124        CREATE = 1;
   125  
   126        // Resource has been deleted
   127        DELETE = 3;
   128  
   129        // Update contains spec fields
   130        SPEC_UPDATE = 4;
   131  
   132        // Update contains state fields, but not spec
   133        STATE_UPDATE = 5;
   134  
   135        // Update contains neither spec or state fields.
   136        META_UPDATE = 6;
   137  
   138        // UPDATE is deprecated in favor of specific update types.
   139        UPDATE = 2;
   140      }
   141    }
   142  
   143    // Information about transaction where change
   144    // has been executed
   145    message TransactionInfo {
   146      // unique identifier of the transaction.
   147      string identifier = 1;
   148  
   149      // Indicator of try counter. If transaction has been
   150      // concluded at first try, try_counter will be 1. If
   151      // on the second try, then number will be 2 (etc).
   152      int32 try_counter = 2;
   153  
   154      // State of the transaction.
   155      State state = 3;
   156  
   157      // State of the transaction.
   158      enum State {
   159        UNDEFINED = 0; // to avoid blank item when printing logs
   160  
   161        // Indicates that this change did not happen -
   162        // it is just proposal of the change.
   163        // Such a log should be followed by another
   164        // ResourceChangeLog with value COMMITTED
   165        // or ROLLED_BACK.
   166        // If one transaction has been retried
   167        // multiple times, then there may be multiple
   168        // records with PRE_COMMITTED, last record
   169        // should indicate final transaction state.
   170        PRE_COMMITTED = 1;
   171  
   172        // Indicates change has been committed
   173        // successfully.
   174        COMMITTED = 2;
   175  
   176        // Indicates that change did not happen.
   177        // Log of this type should be treated as
   178        // attempt of change.
   179        ROLLED_BACK = 3;
   180      }
   181    }
   182  }