Skip to main content

fastly_api/models/
policy.rs

1/*
2 * Fastly API
3 *
4 * Via the Fastly API you can perform any of the operations that are possible within the management console,  including creating services, domains, and backends, configuring rules or uploading your own application code, as well as account operations such as user administration and billing reports. The API is organized into collections of endpoints that allow manipulation of objects related to Fastly services and accounts. For the most accurate and up-to-date API reference content, visit our [Developer Hub](https://www.fastly.com/documentation/reference/api/) 
5 *
6 */
7
8
9
10
11#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
12pub struct Policy {
13    #[serde(rename = "id", skip_serializing_if = "Option::is_none")]
14    pub id: Option<String>,
15    #[serde(rename = "page_id", skip_serializing_if = "Option::is_none")]
16    pub page_id: Option<String>,
17    #[serde(rename = "name", skip_serializing_if = "Option::is_none")]
18    pub name: Option<String>,
19    #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
20    pub description: Option<String>,
21    #[serde(rename = "mode", skip_serializing_if = "Option::is_none")]
22    pub mode: Option<Mode>,
23    #[serde(rename = "directives", skip_serializing_if = "Option::is_none")]
24    pub directives: Option<Vec<crate::models::Directive>>,
25    #[serde(rename = "created_at", skip_serializing_if = "Option::is_none")]
26    pub created_at: Option<String>,
27    #[serde(rename = "updated_at", skip_serializing_if = "Option::is_none")]
28    pub updated_at: Option<String>,
29}
30
31impl Policy {
32    pub fn new() -> Policy {
33        Policy {
34            id: None,
35            page_id: None,
36            name: None,
37            description: None,
38            mode: None,
39            directives: None,
40            created_at: None,
41            updated_at: None,
42        }
43    }
44}
45
46/// 
47#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
48pub enum Mode {
49    #[serde(rename = "report")]
50    Report,
51    #[serde(rename = "enforce")]
52    Enforce,
53}
54
55impl Default for Mode {
56    fn default() -> Mode {
57        Self::Report
58    }
59}
60