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

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