sendgrid_api/settings_enforced_tls.rs
1use crate::Client;
2use crate::ClientResult;
3
4pub struct SettingsEnforcedTls {
5 pub client: Client,
6}
7
8impl SettingsEnforcedTls {
9 #[doc(hidden)]
10 pub fn new(client: Client) -> Self {
11 SettingsEnforcedTls { client }
12 }
13
14 /**
15 * Retrieve current Enforced TLS settings.
16 *
17 * This function performs a `GET` to the `/user/settings/enforced_tls` endpoint.
18 *
19 * **This endpoint allows you to retrieve your current Enforced TLS settings.**
20 *
21 * The Enforced TLS settings specify whether or not the recipient is required to support TLS or have a valid certificate.
22 *
23 * If either `require_tls` or `require_valid_cert` is set to `true`, the recipient must support TLS 1.1 or higher or have a valid certificate. If these conditions are not met, Twilio SendGrid will drop the message and send a block event with “TLS required but not supported” as the description.
24 *
25 * **Parameters:**
26 *
27 * * `on_behalf_of: &str` -- The license key provided with your New Relic account.
28 */
29 pub async fn get_user(
30 &self,
31 ) -> ClientResult<crate::Response<crate::types::EnforcedTlsRequestResponse>> {
32 let url = self.client.url("/user/settings/enforced_tls", None);
33 self.client
34 .get(
35 &url,
36 crate::Message {
37 body: None,
38 content_type: None,
39 },
40 )
41 .await
42 }
43 /**
44 * Update Enforced TLS settings.
45 *
46 * This function performs a `PATCH` to the `/user/settings/enforced_tls` endpoint.
47 *
48 * **This endpoint allows you to update your Enforced TLS settings.**
49 *
50 * To require TLS from recipients, set `require_tls` to `true`. If either `require_tls` or `require_valid_cert` is set to `true`, the recipient must support TLS 1.1 or higher or have a valid certificate. If these conditions are not met, Twilio SendGrid will drop the message and send a block event with “TLS required but not supported” as the description.
51 *
52 * > Twilio SendGrid supports TLS 1.1 and higher and does not support older versions of TLS due to security vulnerabilities.
53 *
54 * **Parameters:**
55 *
56 * * `on_behalf_of: &str` -- The license key provided with your New Relic account.
57 */
58 pub async fn patch_user(
59 &self,
60 body: &crate::types::EnforcedTlsRequestResponse,
61 ) -> ClientResult<crate::Response<crate::types::EnforcedTlsRequestResponse>> {
62 let url = self.client.url("/user/settings/enforced_tls", None);
63 self.client
64 .patch(
65 &url,
66 crate::Message {
67 body: Some(reqwest::Body::from(serde_json::to_vec(body)?)),
68 content_type: Some("application/json".to_string()),
69 },
70 )
71 .await
72 }
73}