fastly_api/models/
header_response.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 HeaderResponse {
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    #[serde(rename = "service_id", skip_serializing_if = "Option::is_none")]
50    pub service_id: Option<Box<String>>,
51    #[serde(rename = "version", skip_serializing_if = "Option::is_none")]
52    pub version: Option<Box<String>>,
53    /// Date and time in ISO 8601 format.
54    #[serde(rename = "created_at", skip_serializing_if = "Option::is_none")]
55    pub created_at: Option<String>,
56    /// Date and time in ISO 8601 format.
57    #[serde(rename = "deleted_at", skip_serializing_if = "Option::is_none")]
58    pub deleted_at: Option<String>,
59    /// Date and time in ISO 8601 format.
60    #[serde(rename = "updated_at", skip_serializing_if = "Option::is_none")]
61    pub updated_at: Option<String>,
62}
63
64impl HeaderResponse {
65    pub fn new() -> HeaderResponse {
66        HeaderResponse {
67            action: None,
68            cache_condition: None,
69            dst: None,
70            name: None,
71            regex: None,
72            request_condition: None,
73            response_condition: None,
74            src: None,
75            substitution: None,
76            _type: None,
77            ignore_if_set: None,
78            priority: None,
79            service_id: None,
80            version: None,
81            created_at: None,
82            deleted_at: None,
83            updated_at: None,
84        }
85    }
86}
87
88/// Accepts a string value.
89#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
90pub enum Action {
91    #[serde(rename = "set")]
92    Set,
93    #[serde(rename = "append")]
94    Append,
95    #[serde(rename = "delete")]
96    Delete,
97    #[serde(rename = "regex")]
98    Regex,
99    #[serde(rename = "regex_repeat")]
100    RegexRepeat,
101}
102
103impl Default for Action {
104    fn default() -> Action {
105        Self::Set
106    }
107}
108/// Accepts a string value.
109#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
110pub enum Type {
111    #[serde(rename = "request")]
112    Request,
113    #[serde(rename = "cache")]
114    Cache,
115    #[serde(rename = "response")]
116    Response,
117}
118
119impl Default for Type {
120    fn default() -> Type {
121        Self::Request
122    }
123}
124