go.chromium.org/luci@v0.0.0-20240309015107-7cdc2e660f33/tree_status/proto/v1/tree_status.proto (about)

     1  // Copyright 2023 The LUCI Authors.
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //      http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  syntax = "proto3";
    16  
    17  package luci.tree_status.v1;
    18  
    19  import "google/api/field_behavior.proto";
    20  import "google/protobuf/timestamp.proto";
    21  
    22  option go_package = "go.chromium.org/luci/tree_status/proto/v1";
    23  
    24  service TreeStatus {
    25    // List all status values for a tree in reverse chronological order.
    26    rpc ListStatus(ListStatusRequest) returns (ListStatusResponse) {};
    27  
    28    // Get a status for a tree.
    29    // Use the resource alias 'latest' to get just the current status.
    30    rpc GetStatus(GetStatusRequest) returns (Status) {};
    31  
    32    // Create a new status update for the tree.
    33    rpc CreateStatus(CreateStatusRequest) returns (Status) {};
    34  }
    35  
    36  message GetStatusRequest {
    37    // The status value to get.
    38    //
    39    // You can use 'latest' as the id to get the latest status for a tree,
    40    // i.e. set the name to 'trees/{tree}/status/latest'.
    41    //
    42    // If you request the 'latest' status and no status updates are in the
    43    // database (possibly due to the 140 day TTL), a fallback status will
    44    // be returned with general_state OPEN.  You can tell that the fallback
    45    // status was returned by checking the name which will be
    46    // 'trees/{tree}/status/fallback', which is otherwise not a valid name.
    47    //
    48    // Format: trees/{tree}/status/{id}
    49    string name = 1;
    50  }
    51  
    52  // GeneralState are the possible states for a tree to be in.
    53  enum GeneralState {
    54    // GeneralState was not specified.
    55    // This should not be used, it is the default value for an unset field.
    56    GENERAL_STATE_UNSPECIFIED = 0;
    57  
    58    // The tree is open and accepting new commits.
    59    OPEN = 1;
    60    // The tree is closed, no new commits are currently being accepted.
    61    CLOSED = 2;
    62    // The tree is throttled.  The meaning of this state can vary by project,
    63    // but generally it is between the open and closed states.
    64    THROTTLED = 3;
    65    // The tree is in maintenance.  Generally CLs will not be accepted while the
    66    // tree is in this state.
    67    MAINTENANCE = 4;
    68  }
    69  
    70  // The Status of a tree for an interval of time.
    71  message Status {
    72    // The name of this status.
    73    // Format: trees/{tree}/status/{id}
    74    string name = 1 [
    75      (google.api.field_behavior) = OUTPUT_ONLY,
    76      (google.api.field_behavior) = IMMUTABLE
    77    ];
    78    // The general state of the tree.  Possible values are open, closed, throttled
    79    // and maintenance.
    80    GeneralState general_state = 2;
    81    // The message explaining details about the status.  This may contain HTML,
    82    // it is the responsibility of the caller to sanitize the HTML before display.
    83    // Maximum length of 1024 bytes.  Must be a valid UTF-8 string in normalized form
    84    // C without any non-printable runes.
    85    string message = 3;
    86    // The email address of the user who added this.  May be empty if
    87    // the reader does not have permission to see personal data.  Will also be
    88    // set to 'user' after the user data TTL (of 30 days).
    89    string create_user = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
    90    // The time the status update was made.
    91    google.protobuf.Timestamp create_time = 5
    92        [(google.api.field_behavior) = OUTPUT_ONLY];
    93  }
    94  
    95  message ListStatusRequest {
    96    // The parent tree which the status values belongs to.
    97    // Format: trees/{tree}/status
    98    string parent = 1;
    99  
   100    // The maximum number of status values to return. The service may return fewer
   101    // than this value. If unspecified, at most 50 status values will be returned.
   102    // The maximum value is 1000; values above 1000 will be coerced to 1000.
   103    int32 page_size = 2;
   104  
   105    // A page token, received from a previous `ListStatus` call.
   106    // Provide this to retrieve the subsequent page.
   107    //
   108    // When paginating, all other parameters provided to `ListStatus` must match
   109    // the call that provided the page token.
   110    string page_token = 3;
   111  }
   112  
   113  message ListStatusResponse {
   114    // The status values of the tree.
   115    repeated Status status = 1;
   116  
   117    // A token, which can be sent as `page_token` to retrieve the next page.
   118    // If this field is omitted, there are no subsequent pages.
   119    string next_page_token = 2;
   120  }
   121  
   122  message CreateStatusRequest {
   123    // The parent tree which the status values belongs to.
   124    // Format: trees/{tree}/status
   125    string parent = 1;
   126  
   127    // The status to create.
   128    // Only the general state and message fields can be provided, the current date
   129    // will be used for the date and the RPC caller will be used for the username.
   130    Status status = 2;
   131  }