go.chromium.org/luci@v0.0.0-20240309015107-7cdc2e660f33/server/quotabeta/proto/service.proto (about)

     1  // Copyright 2022 The LUCI Authors. All rights reserved.
     2  // Use of this source code is governed under the Apache License, Version 2.0
     3  // that can be found in the LICENSE file.
     4  
     5  syntax = "proto3";
     6  
     7  option go_package = "go.chromium.org/luci/server/quotabeta/proto";
     8  
     9  package proto;
    10  
    11  // A GetRequest is a request to fetch the quota entry for a specfic policy.
    12  message GetRequest {
    13    // The named policy. Valid names depend on the policies enumerated in this
    14    // service's config.proto.
    15    //
    16    // Required.
    17    string policy = 1;
    18  
    19    // The user to fetch the named quota policy for. Must be specified when the
    20    // policy contains the substring "${user}".
    21    string user = 2;
    22  }
    23  
    24  // A SetRequest is a request to set available resources for a specific policy.
    25  message SetRequest {
    26    // The named policy. Valid names depend on the policies enumerated in this
    27    // service's config.proto.
    28    //
    29    // Required.
    30    string policy = 1;
    31  
    32    // The user to fetch the named quota policy for. Must be specified when the
    33    // policy contains the substring "${user}".
    34    string user = 2;
    35  
    36    // The amount of resources that should be available. Must be non-negative.
    37    // Values exceeding the max specified in the policy config will be capped.
    38    int64 resources = 3;
    39  }
    40  
    41  // A QuotaEntry represents a database entry for the named quota entry.
    42  message QuotaEntry {
    43    // The name of this quota entry.
    44    string name = 1;
    45  
    46    // The raw name of this entry in the redis database.
    47    string db_name = 2;
    48  
    49    // The amount of resources available.
    50    int64 resources = 3;
    51  }
    52  
    53  // QuotaAdmin exposes admin endpoints for the quota library.
    54  service QuotaAdmin {
    55    // Get returns the available resources for the given policy.
    56    rpc Get(GetRequest) returns (QuotaEntry);
    57    // Set updates the available resources for the given policy.
    58    rpc Set(SetRequest) returns (QuotaEntry);
    59  }