Skip to main content

hanzo_client/models/
allowance.rs

1/*
2 * Hanzo Cloud API
3 *
4 * The Hanzo Cloud API as a customer calls it: every operation under /v1/ except the operator's admin product, relay routes, legacy spellings and capabilities still reached by flag. Tagged by product: the first path segment after /v1/.
5 *
6 * The version of the OpenAPI document: v1
7 * 
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
15pub struct Allowance {
16    /// calls the plan allows per period; 0 = unbounded
17    #[serde(rename = "limit", skip_serializing_if = "Option::is_none")]
18    pub limit: Option<i32>,
19    /// the tier the limit came from
20    #[serde(rename = "plan", skip_serializing_if = "Option::is_none")]
21    pub plan: Option<String>,
22    /// unix seconds; when THAT window starts again
23    #[serde(rename = "resets", skip_serializing_if = "Option::is_none")]
24    pub resets: Option<i32>,
25    /// the subject is at the limit
26    #[serde(rename = "spent", skip_serializing_if = "Option::is_none")]
27    pub spent: Option<bool>,
28    /// Used is how many zero-priced calls this subject has been SERVED in the period ending at Resets — the UTC calendar day. Only a served call counts, so an admission check, a refusal, or a vendor that never answered leaves it where it stood. It stops AT Limit rather than climbing past it, so Limit-Used is what remains and never goes negative.
29    #[serde(rename = "used", skip_serializing_if = "Option::is_none")]
30    pub used: Option<i32>,
31    /// Window is which ceiling these numbers describe — \"hour\" or \"day\" — because a caller is held to both and only one of them is the answer. It is the window that REFUSED where one did, and otherwise the one with least left, so Limit-Used is always the number that will actually stop them next. Empty where no window bounds the subject at all.
32    #[serde(rename = "window", skip_serializing_if = "Option::is_none")]
33    pub window: Option<String>,
34}
35
36impl Allowance {
37    pub fn new() -> Allowance {
38        Allowance {
39            limit: None,
40            plan: None,
41            resets: None,
42            spent: None,
43            used: None,
44            window: None,
45        }
46    }
47}
48