fastly_api/models/
header.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 Header {
13    /// Accepts a string value.
14    #[serde(rename = "action", skip_serializing_if = "Option::is_none")]
15    pub action: Option<Action>,
16    /// Name of the cache condition controlling when this configuration applies.
17    #[serde(rename = "cache_condition", skip_serializing_if = "Option::is_none")]
18    pub cache_condition: Option<String>,
19    /// Header to set.
20    #[serde(rename = "dst", skip_serializing_if = "Option::is_none")]
21    pub dst: Option<String>,
22    /// A handle to refer to this Header object.
23    #[serde(rename = "name", skip_serializing_if = "Option::is_none")]
24    pub name: Option<String>,
25    /// Regular expression to use. Only applies to `regex` and `regex_repeat` actions.
26    #[serde(rename = "regex", skip_serializing_if = "Option::is_none")]
27    pub regex: Option<String>,
28    /// Condition which, if met, will select this configuration during a request. Optional.
29    #[serde(rename = "request_condition", skip_serializing_if = "Option::is_none")]
30    pub request_condition: Option<String>,
31    /// Optional name of a response condition to apply.
32    #[serde(rename = "response_condition", skip_serializing_if = "Option::is_none")]
33    pub response_condition: Option<Box<String>>,
34    /// Variable to be used as a source for the header content. Does not apply to `delete` action.
35    #[serde(rename = "src", skip_serializing_if = "Option::is_none")]
36    pub src: Option<String>,
37    /// Value to substitute in place of regular expression. Only applies to `regex` and `regex_repeat` actions.
38    #[serde(rename = "substitution", skip_serializing_if = "Option::is_none")]
39    pub substitution: Option<String>,
40    /// Accepts a string value.
41    #[serde(rename = "type", skip_serializing_if = "Option::is_none")]
42    pub _type: Option<Type>,
43    /// Don't add the header if it is added already. Only applies to 'set' action. Numerical value (\"0\" = false, \"1\" = true)
44    #[serde(rename = "ignore_if_set", skip_serializing_if = "Option::is_none")]
45    pub ignore_if_set: Option<String>,
46    /// Priority determines execution order. Lower numbers execute first.
47    #[serde(rename = "priority", skip_serializing_if = "Option::is_none")]
48    pub priority: Option<String>,
49}
50
51impl Header {
52    pub fn new() -> Header {
53        Header {
54            action: None,
55            cache_condition: None,
56            dst: None,
57            name: None,
58            regex: None,
59            request_condition: None,
60            response_condition: None,
61            src: None,
62            substitution: None,
63            _type: None,
64            ignore_if_set: None,
65            priority: None,
66        }
67    }
68}
69
70/// Accepts a string value.
71#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
72pub enum Action {
73    #[serde(rename = "set")]
74    Set,
75    #[serde(rename = "append")]
76    Append,
77    #[serde(rename = "delete")]
78    Delete,
79    #[serde(rename = "regex")]
80    Regex,
81    #[serde(rename = "regex_repeat")]
82    RegexRepeat,
83}
84
85impl Default for Action {
86    fn default() -> Action {
87        Self::Set
88    }
89}
90/// Accepts a string value.
91#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
92pub enum Type {
93    #[serde(rename = "request")]
94    Request,
95    #[serde(rename = "cache")]
96    Cache,
97    #[serde(rename = "response")]
98    Response,
99}
100
101impl Default for Type {
102    fn default() -> Type {
103        Self::Request
104    }
105}
106