netbox_openapi/models/
patched_webhook_request.rs

1/*
2 * NetBox REST API
3 *
4 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5 *
6 * The version of the OpenAPI document: 4.4.2-Docker-3.4.1 (4.4)
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11/// PatchedWebhookRequest : Adds support for custom fields and tags.
12
13#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
14pub struct PatchedWebhookRequest {
15    #[serde(rename = "name", skip_serializing_if = "Option::is_none")]
16    pub name: Option<String>,
17    #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
18    pub description: Option<String>,
19    /// This URL will be called using the HTTP method defined when the webhook is called. Jinja2 template processing is supported with the same context as the request body.
20    #[serde(rename = "payload_url", skip_serializing_if = "Option::is_none")]
21    pub payload_url: Option<String>,
22    /// * `GET` - GET * `POST` - POST * `PUT` - PUT * `PATCH` - PATCH * `DELETE` - DELETE
23    #[serde(rename = "http_method", skip_serializing_if = "Option::is_none")]
24    pub http_method: Option<HttpMethod>,
25    /// The complete list of official content types is available here (<https://www.iana.org/assignments/media-types/media-types.xhtml>).
26    #[serde(rename = "http_content_type", skip_serializing_if = "Option::is_none")]
27    pub http_content_type: Option<String>,
28    /// 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).
29    #[serde(rename = "additional_headers", skip_serializing_if = "Option::is_none")]
30    pub additional_headers: Option<String>,
31    /// 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>.
32    #[serde(rename = "body_template", skip_serializing_if = "Option::is_none")]
33    pub body_template: Option<String>,
34    /// When provided, the request will include a <code>X-Hook-Signature</code> header containing a HMAC hex digest of the payload body using the secret as the key. The secret is not transmitted in the request.
35    #[serde(rename = "secret", skip_serializing_if = "Option::is_none")]
36    pub secret: Option<String>,
37    /// Enable SSL certificate verification. Disable with caution!
38    #[serde(rename = "ssl_verification", skip_serializing_if = "Option::is_none")]
39    pub ssl_verification: Option<bool>,
40    /// The specific CA certificate file to use for SSL verification. Leave blank to use the system defaults.
41    #[serde(
42        rename = "ca_file_path",
43        default,
44        with = "::serde_with::rust::double_option",
45        skip_serializing_if = "Option::is_none"
46    )]
47    pub ca_file_path: Option<Option<String>>,
48    #[serde(rename = "custom_fields", skip_serializing_if = "Option::is_none")]
49    pub custom_fields: Option<::std::collections::HashMap<String, serde_json::Value>>,
50    #[serde(rename = "tags", skip_serializing_if = "Option::is_none")]
51    pub tags: Option<Vec<crate::models::NestedTagRequest>>,
52}
53
54impl PatchedWebhookRequest {
55    /// Adds support for custom fields and tags.
56    pub fn new() -> PatchedWebhookRequest {
57        PatchedWebhookRequest {
58            name: None,
59            description: None,
60            payload_url: None,
61            http_method: None,
62            http_content_type: None,
63            additional_headers: None,
64            body_template: None,
65            secret: None,
66            ssl_verification: None,
67            ca_file_path: None,
68            custom_fields: None,
69            tags: None,
70        }
71    }
72}
73
74/// * `GET` - GET * `POST` - POST * `PUT` - PUT * `PATCH` - PATCH * `DELETE` - DELETE
75#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
76pub enum HttpMethod {
77    #[serde(rename = "GET")]
78    Get,
79    #[serde(rename = "POST")]
80    Post,
81    #[serde(rename = "PUT")]
82    Put,
83    #[serde(rename = "PATCH")]
84    Patch,
85    #[serde(rename = "DELETE")]
86    Delete,
87}
88
89impl Default for HttpMethod {
90    fn default() -> HttpMethod {
91        Self::Get
92    }
93}