1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/*
* API Documentation
*
* Source of truth and network automation platform
*
* The version of the OpenAPI document: 3.1.0 (3.1)
*
* Generated by: https://openapi-generator.tech
*/
/// BulkWritableWebhookRequest : Extends the built-in ModelSerializer to enforce calling full_clean() on a copy of the associated instance during validation. (DRF does not do this by default; see <https://github.com/encode/django-rest-framework/issues/3144>)
#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
pub struct BulkWritableWebhookRequest {
#[serde(rename = "id")]
pub id: uuid::Uuid,
#[serde(rename = "content_types")]
pub content_types: Vec<String>,
#[serde(rename = "name")]
pub name: String,
/// Call this webhook when a matching object is created.
#[serde(rename = "type_create", skip_serializing_if = "Option::is_none")]
pub type_create: Option<bool>,
/// Call this webhook when a matching object is updated.
#[serde(rename = "type_update", skip_serializing_if = "Option::is_none")]
pub type_update: Option<bool>,
/// Call this webhook when a matching object is deleted.
#[serde(rename = "type_delete", skip_serializing_if = "Option::is_none")]
pub type_delete: Option<bool>,
/// A POST will be sent to this URL when the webhook is called.
#[serde(rename = "payload_url")]
pub payload_url: String,
#[serde(rename = "enabled", skip_serializing_if = "Option::is_none")]
pub enabled: Option<bool>,
#[serde(rename = "http_method", skip_serializing_if = "Option::is_none")]
pub http_method: Option<crate::models::HttpMethodEnum>,
/// The complete list of official content types is available here (<https://www.iana.org/assignments/media-types/media-types.xhtml>).
#[serde(rename = "http_content_type", skip_serializing_if = "Option::is_none")]
pub http_content_type: Option<String>,
/// User-supplied HTTP headers to be sent with the request in addition to the HTTP content type. Headers should be defined in the format <code>Name: Value</code>. Jinja2 template processing is supported with the same context as the request body (below).
#[serde(rename = "additional_headers", skip_serializing_if = "Option::is_none")]
pub additional_headers: Option<String>,
/// Jinja2 template for a custom request body. If blank, a JSON object representing the change will be included. Available context data includes: <code>event</code>, <code>model</code>, <code>timestamp</code>, <code>username</code>, <code>request_id</code>, and <code>data</code>.
#[serde(rename = "body_template", skip_serializing_if = "Option::is_none")]
pub body_template: Option<String>,
/// When provided, the request will include a 'X-Hook-Signature' header containing a HMAC hex digest of the payload body using the secret as the key. The secret is not transmitted in the request.
#[serde(rename = "secret", skip_serializing_if = "Option::is_none")]
pub secret: Option<String>,
/// Enable SSL certificate verification. Disable with caution!
#[serde(rename = "ssl_verification", skip_serializing_if = "Option::is_none")]
pub ssl_verification: Option<bool>,
/// The specific CA certificate file to use for SSL verification. Leave blank to use the system defaults.
#[serde(rename = "ca_file_path", skip_serializing_if = "Option::is_none")]
pub ca_file_path: Option<String>,
}
impl BulkWritableWebhookRequest {
/// Extends the built-in ModelSerializer to enforce calling full_clean() on a copy of the associated instance during validation. (DRF does not do this by default; see <https://github.com/encode/django-rest-framework/issues/3144>)
pub fn new(
id: uuid::Uuid,
content_types: Vec<String>,
name: String,
payload_url: String,
) -> BulkWritableWebhookRequest {
BulkWritableWebhookRequest {
id,
content_types,
name,
type_create: None,
type_update: None,
type_delete: None,
payload_url,
enabled: None,
http_method: None,
http_content_type: None,
additional_headers: None,
body_template: None,
secret: None,
ssl_verification: None,
ca_file_path: None,
}
}
}