|
| 1 | +(* |
| 2 | + * Copyright (C) 2023 Cloud Software Group |
| 3 | + * |
| 4 | + * This program is free software; you can redistribute it and/or modify |
| 5 | + * it under the terms of the GNU Lesser General Public License as published |
| 6 | + * by the Free Software Foundation; version 2.1 only. with the special |
| 7 | + * exception on linking described in file LICENSE. |
| 8 | + * |
| 9 | + * This program is distributed in the hope that it will be useful, |
| 10 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | + * GNU Lesser General Public License for more details. |
| 13 | + *) |
| 14 | + |
| 15 | +open Datamodel_types |
| 16 | +open Datamodel_common |
| 17 | +open Datamodel_roles |
| 18 | + |
| 19 | +let lifecycle = [] |
| 20 | + |
| 21 | +let t = |
| 22 | + create_obj ~name:_rate_limit ~descr:"Rate limiting policy for a XAPI client" |
| 23 | + ~doccomments:[] ~gen_constructor_destructor:true ~gen_events:true |
| 24 | + ~in_db:true ~lifecycle:[] ~persist:PersistEverything ~in_oss_since:None |
| 25 | + ~messages_default_allowed_roles:_R_POOL_ADMIN |
| 26 | + ~contents: |
| 27 | + ([uid _rate_limit ~lifecycle] |
| 28 | + @ [ |
| 29 | + field ~qualifier:StaticRO ~ty:String ~lifecycle "client_id" |
| 30 | + "An identifier for the rate limited client" ~ignore_foreign_key:true |
| 31 | + ~default_value:(Some (VString "")) |
| 32 | + ; field ~qualifier:StaticRO ~ty:Float ~lifecycle "burst_size" |
| 33 | + "Amount of tokens that can be consumed in one burst" |
| 34 | + ~ignore_foreign_key:true ~default_value:(Some (VFloat 0.)) |
| 35 | + ; field ~qualifier:StaticRO ~ty:Float ~lifecycle "fill_rate" |
| 36 | + "Tokens added to token bucket per second" ~ignore_foreign_key:true |
| 37 | + ~default_value:(Some (VFloat 0.)) |
| 38 | + ] |
| 39 | + ) |
| 40 | + ~messages:[] () |
0 commit comments