fastly_api/models/
logging_s3_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 LoggingS3Response {
13    /// The name for the real-time logging configuration.
14    #[serde(rename = "name", skip_serializing_if = "Option::is_none")]
15    pub name: Option<String>,
16    /// Where in the generated VCL the logging call should be placed. If not set, endpoints with `format_version` of 2 are placed in `vcl_log` and those with `format_version` of 1 are placed in `vcl_deliver`. 
17    #[serde(rename = "placement", skip_serializing_if = "Option::is_none")]
18    pub placement: Option<Placement>,
19    /// The name of an existing condition in the configured endpoint, or leave blank to always execute.
20    #[serde(rename = "response_condition", skip_serializing_if = "Option::is_none")]
21    pub response_condition: Option<String>,
22    /// A Fastly [log format string](https://docs.fastly.com/en/guides/custom-log-formats).
23    #[serde(rename = "format", skip_serializing_if = "Option::is_none")]
24    pub format: Option<String>,
25    /// The version of the custom logging format used for the configured endpoint. The logging call gets placed by default in `vcl_log` if `format_version` is set to `2` and in `vcl_deliver` if `format_version` is set to `1`. 
26    #[serde(rename = "format_version", skip_serializing_if = "Option::is_none")]
27    pub format_version: Option<FormatVersion>,
28    /// How the message should be formatted.
29    #[serde(rename = "message_type", skip_serializing_if = "Option::is_none")]
30    pub message_type: Option<MessageType>,
31    /// A timestamp format
32    #[serde(rename = "timestamp_format", skip_serializing_if = "Option::is_none")]
33    pub timestamp_format: Option<String>,
34    /// The codec used for compressing your logs. Valid values are `zstd`, `snappy`, and `gzip`. Specifying both `compression_codec` and `gzip_level` in the same API request will result in an error.
35    #[serde(rename = "compression_codec", skip_serializing_if = "Option::is_none")]
36    pub compression_codec: Option<CompressionCodec>,
37    /// How frequently log files are finalized so they can be available for reading (in seconds).
38    #[serde(rename = "period", skip_serializing_if = "Option::is_none")]
39    pub period: Option<String>,
40    /// The level of gzip encoding when sending logs (default `0`, no compression). Specifying both `compression_codec` and `gzip_level` in the same API request will result in an error.
41    #[serde(rename = "gzip_level", skip_serializing_if = "Option::is_none")]
42    pub gzip_level: Option<String>,
43    /// Date and time in ISO 8601 format.
44    #[serde(rename = "created_at", skip_serializing_if = "Option::is_none")]
45    pub created_at: Option<String>,
46    /// Date and time in ISO 8601 format.
47    #[serde(rename = "deleted_at", skip_serializing_if = "Option::is_none")]
48    pub deleted_at: Option<String>,
49    /// Date and time in ISO 8601 format.
50    #[serde(rename = "updated_at", skip_serializing_if = "Option::is_none")]
51    pub updated_at: Option<String>,
52    #[serde(rename = "service_id", skip_serializing_if = "Option::is_none")]
53    pub service_id: Option<Box<String>>,
54    #[serde(rename = "version", skip_serializing_if = "Option::is_none")]
55    pub version: Option<Box<String>>,
56    /// The access key for your S3 account. Not required if `iam_role` is provided.
57    #[serde(rename = "access_key", skip_serializing_if = "Option::is_none")]
58    pub access_key: Option<String>,
59    /// The access control list (ACL) specific request header. See the AWS documentation for [Access Control List (ACL) Specific Request Headers](https://docs.aws.amazon.com/AmazonS3/latest/API/mpUploadInitiate.html#initiate-mpu-acl-specific-request-headers) for more information.
60    #[serde(rename = "acl", skip_serializing_if = "Option::is_none")]
61    pub acl: Option<String>,
62    /// The bucket name for S3 account.
63    #[serde(rename = "bucket_name", skip_serializing_if = "Option::is_none")]
64    pub bucket_name: Option<String>,
65    /// The domain of the Amazon S3 endpoint.
66    #[serde(rename = "domain", skip_serializing_if = "Option::is_none")]
67    pub domain: Option<String>,
68    /// The Amazon Resource Name (ARN) for the IAM role granting Fastly access to S3. Not required if `access_key` and `secret_key` are provided.
69    #[serde(rename = "iam_role", skip_serializing_if = "Option::is_none")]
70    pub iam_role: Option<String>,
71    /// The path to upload logs to.
72    #[serde(rename = "path", skip_serializing_if = "Option::is_none")]
73    pub path: Option<String>,
74    /// A PGP public key that Fastly will use to encrypt your log files before writing them to disk.
75    #[serde(rename = "public_key", skip_serializing_if = "Option::is_none")]
76    pub public_key: Option<String>,
77    /// The S3 redundancy level.
78    #[serde(rename = "redundancy", skip_serializing_if = "Option::is_none")]
79    pub redundancy: Option<String>,
80    /// The secret key for your S3 account. Not required if `iam_role` is provided.
81    #[serde(rename = "secret_key", skip_serializing_if = "Option::is_none")]
82    pub secret_key: Option<String>,
83    /// Optional server-side KMS Key Id. Must be set if `server_side_encryption` is set to `aws:kms` or `AES256`.
84    #[serde(rename = "server_side_encryption_kms_key_id", skip_serializing_if = "Option::is_none")]
85    pub server_side_encryption_kms_key_id: Option<String>,
86    /// Set this to `AES256` or `aws:kms` to enable S3 Server Side Encryption.
87    #[serde(rename = "server_side_encryption", skip_serializing_if = "Option::is_none")]
88    pub server_side_encryption: Option<String>,
89    /// The maximum number of bytes for each uploaded file. A value of 0 can be used to indicate there is no limit on the size of uploaded files, otherwise the minimum value is 1048576 bytes (1 MiB.)
90    #[serde(rename = "file_max_bytes", skip_serializing_if = "Option::is_none")]
91    pub file_max_bytes: Option<i32>,
92}
93
94impl LoggingS3Response {
95    pub fn new() -> LoggingS3Response {
96        LoggingS3Response {
97            name: None,
98            placement: None,
99            response_condition: None,
100            format: None,
101            format_version: None,
102            message_type: None,
103            timestamp_format: None,
104            compression_codec: None,
105            period: None,
106            gzip_level: None,
107            created_at: None,
108            deleted_at: None,
109            updated_at: None,
110            service_id: None,
111            version: None,
112            access_key: None,
113            acl: None,
114            bucket_name: None,
115            domain: None,
116            iam_role: None,
117            path: None,
118            public_key: None,
119            redundancy: None,
120            secret_key: None,
121            server_side_encryption_kms_key_id: None,
122            server_side_encryption: None,
123            file_max_bytes: None,
124        }
125    }
126}
127
128/// Where in the generated VCL the logging call should be placed. If not set, endpoints with `format_version` of 2 are placed in `vcl_log` and those with `format_version` of 1 are placed in `vcl_deliver`. 
129#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
130pub enum Placement {
131    #[serde(rename = "none")]
132    None,
133    #[serde(rename = "null")]
134    Null,
135}
136
137impl Default for Placement {
138    fn default() -> Placement {
139        Self::None
140    }
141}
142/// The version of the custom logging format used for the configured endpoint. The logging call gets placed by default in `vcl_log` if `format_version` is set to `2` and in `vcl_deliver` if `format_version` is set to `1`. 
143#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
144pub enum FormatVersion {
145    #[serde(rename = "1")]
146    V1,
147    #[serde(rename = "2")]
148    V2,
149}
150
151impl Default for FormatVersion {
152    fn default() -> FormatVersion {
153        Self::V1
154    }
155}
156/// How the message should be formatted.
157#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
158pub enum MessageType {
159    #[serde(rename = "classic")]
160    Classic,
161    #[serde(rename = "loggly")]
162    Loggly,
163    #[serde(rename = "logplex")]
164    Logplex,
165    #[serde(rename = "blank")]
166    Blank,
167}
168
169impl Default for MessageType {
170    fn default() -> MessageType {
171        Self::Classic
172    }
173}
174/// The codec used for compressing your logs. Valid values are `zstd`, `snappy`, and `gzip`. Specifying both `compression_codec` and `gzip_level` in the same API request will result in an error.
175#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
176pub enum CompressionCodec {
177    #[serde(rename = "zstd")]
178    Zstd,
179    #[serde(rename = "snappy")]
180    Snappy,
181    #[serde(rename = "gzip")]
182    Gzip,
183}
184
185impl Default for CompressionCodec {
186    fn default() -> CompressionCodec {
187        Self::Zstd
188    }
189}
190