Skip to main content

fastly_api/models/
script.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 Script {
13    /// Unique script identifier
14    #[serde(rename = "id", skip_serializing_if = "Option::is_none")]
15    pub id: Option<String>,
16    /// Parent page ID
17    #[serde(rename = "page_id", skip_serializing_if = "Option::is_none")]
18    pub page_id: Option<String>,
19    /// Script source (inline or external URL)
20    #[serde(rename = "source", skip_serializing_if = "Option::is_none")]
21    pub source: Option<String>,
22    /// URLs where this script was observed
23    #[serde(rename = "urls", skip_serializing_if = "Option::is_none")]
24    pub urls: Option<Vec<String>>,
25    #[serde(rename = "first_seen_at", skip_serializing_if = "Option::is_none")]
26    pub first_seen_at: Option<String>,
27    #[serde(rename = "last_seen_at", skip_serializing_if = "Option::is_none")]
28    pub last_seen_at: Option<String>,
29    /// Reason for authorization decision
30    #[serde(rename = "justification", skip_serializing_if = "Option::is_none")]
31    pub justification: Option<String>,
32    /// Current script content hash
33    #[serde(rename = "current_hash", skip_serializing_if = "Option::is_none")]
34    pub current_hash: Option<String>,
35    /// Hash of authorized script content
36    #[serde(rename = "authorized_hash", skip_serializing_if = "Option::is_none")]
37    pub authorized_hash: Option<String>,
38    /// Script authorization status
39    #[serde(rename = "authorization_status", skip_serializing_if = "Option::is_none")]
40    pub authorization_status: Option<AuthorizationStatus>,
41    #[serde(rename = "authorized_at", skip_serializing_if = "Option::is_none")]
42    pub authorized_at: Option<String>,
43}
44
45impl Script {
46    pub fn new() -> Script {
47        Script {
48            id: None,
49            page_id: None,
50            source: None,
51            urls: None,
52            first_seen_at: None,
53            last_seen_at: None,
54            justification: None,
55            current_hash: None,
56            authorized_hash: None,
57            authorization_status: None,
58            authorized_at: None,
59        }
60    }
61}
62
63/// Script authorization status
64#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
65pub enum AuthorizationStatus {
66    #[serde(rename = "authorized")]
67    Authorized,
68    #[serde(rename = "unauthorized")]
69    Unauthorized,
70}
71
72impl Default for AuthorizationStatus {
73    fn default() -> AuthorizationStatus {
74        Self::Authorized
75    }
76}
77