Skip to main content

slack_web_api/api/
admin_audit.rs

1// このファイルは codegen/generate.py が生成する。手で編集しない
2
3#![allow(unused_imports)]
4
5use crate::objects::*;
6use crate::{
7    CursorPaginated, NextCursor, ResponseMetadata, SlackApiMethod, SlackClient, SlackError,
8};
9use serde::{Deserialize, Serialize};
10
11/// Arguments for the Slack Web API method [`admin.audit.anomaly.allow.getItem`](https://docs.slack.dev/reference/methods/admin.audit.anomaly.allow.getItem): API to allow Enterprise org admins to read the allow list of IP blocks and ASNs from the enterprise configuration.
12///
13/// Send it with [`SlackClient::admin_audit_anomaly_allow_get_item`].
14#[doc(alias = "admin.audit.anomaly.allow.getItem")]
15#[derive(Debug, Clone, PartialEq, Serialize, Default)]
16#[non_exhaustive]
17pub struct AdminAuditAnomalyAllowGetItemRequest {}
18
19impl AdminAuditAnomalyAllowGetItemRequest {
20    pub fn new() -> Self {
21        Self {}
22    }
23}
24
25impl SlackApiMethod for AdminAuditAnomalyAllowGetItemRequest {
26    const METHOD: &'static str = "admin.audit.anomaly.allow.getItem";
27    type Response = AdminAuditAnomalyAllowGetItemResponse;
28}
29
30/// Successful response of the Slack Web API method [`admin.audit.anomaly.allow.getItem`](https://docs.slack.dev/reference/methods/admin.audit.anomaly.allow.getItem).
31#[doc(alias = "admin.audit.anomaly.allow.getItem")]
32#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
33pub struct AdminAuditAnomalyAllowGetItemResponse {
34    /// Fields returned by Slack. This method has no documented response example.
35    #[serde(flatten)]
36    pub extra: serde_json::Map<String, serde_json::Value>,
37    #[serde(
38        default,
39        deserialize_with = "crate::de::opt_object",
40        skip_serializing_if = "Option::is_none"
41    )]
42    pub response_metadata: Option<ResponseMetadata>,
43    #[serde(
44        default,
45        deserialize_with = "crate::de::opt_string",
46        skip_serializing_if = "Option::is_none"
47    )]
48    pub warning: Option<String>,
49}
50
51/// Arguments for the Slack Web API method [`admin.audit.anomaly.allow.updateItem`](https://docs.slack.dev/reference/methods/admin.audit.anomaly.allow.updateItem): API to allow Enterprise org admins to write/overwrite the allow list of IP blocks and ASNs from the enterprise configuration.
52///
53/// Send it with [`SlackClient::admin_audit_anomaly_allow_update_item`].
54#[doc(alias = "admin.audit.anomaly.allow.updateItem")]
55#[derive(Debug, Clone, PartialEq, Serialize, Default)]
56#[non_exhaustive]
57pub struct AdminAuditAnomalyAllowUpdateItemRequest {
58    /// allow list of IPv4 addresses using cidr notation in the Enterprise organization configuration
59    #[serde(
60        skip_serializing_if = "Option::is_none",
61        serialize_with = "crate::form::as_json"
62    )]
63    pub trusted_cidr: Option<Vec<serde_json::Value>>,
64    /// allow list of Autonomous System Numbers (ASN) in the Enterprise organization configuration
65    #[serde(
66        skip_serializing_if = "Option::is_none",
67        serialize_with = "crate::form::as_json"
68    )]
69    pub trusted_asns: Option<Vec<serde_json::Value>>,
70}
71
72impl AdminAuditAnomalyAllowUpdateItemRequest {
73    pub fn new() -> Self {
74        Self {
75            trusted_cidr: None,
76            trusted_asns: None,
77        }
78    }
79
80    pub fn trusted_cidr(mut self, trusted_cidr: Vec<serde_json::Value>) -> Self {
81        self.trusted_cidr = Some(trusted_cidr);
82        self
83    }
84
85    pub fn trusted_asns(mut self, trusted_asns: Vec<serde_json::Value>) -> Self {
86        self.trusted_asns = Some(trusted_asns);
87        self
88    }
89}
90
91impl SlackApiMethod for AdminAuditAnomalyAllowUpdateItemRequest {
92    const METHOD: &'static str = "admin.audit.anomaly.allow.updateItem";
93    type Response = AdminAuditAnomalyAllowUpdateItemResponse;
94}
95
96/// Successful response of the Slack Web API method [`admin.audit.anomaly.allow.updateItem`](https://docs.slack.dev/reference/methods/admin.audit.anomaly.allow.updateItem).
97#[doc(alias = "admin.audit.anomaly.allow.updateItem")]
98#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
99pub struct AdminAuditAnomalyAllowUpdateItemResponse {
100    /// Fields returned by Slack. This method has no documented response example.
101    #[serde(flatten)]
102    pub extra: serde_json::Map<String, serde_json::Value>,
103    #[serde(
104        default,
105        deserialize_with = "crate::de::opt_object",
106        skip_serializing_if = "Option::is_none"
107    )]
108    pub response_metadata: Option<ResponseMetadata>,
109    #[serde(
110        default,
111        deserialize_with = "crate::de::opt_string",
112        skip_serializing_if = "Option::is_none"
113    )]
114    pub warning: Option<String>,
115}
116
117impl SlackClient {
118    /// Calls the Slack Web API method [`admin.audit.anomaly.allow.getItem`](https://docs.slack.dev/reference/methods/admin.audit.anomaly.allow.getItem): API to allow Enterprise org admins to read the allow list of IP blocks and ASNs from the enterprise configuration.
119    ///
120    /// Required scopes:
121    ///
122    /// - user token: `admin`
123    ///
124    /// Rate limit: Tier 2 (<https://docs.slack.dev/apis/web-api/rate-limits>).
125    ///
126    /// # Errors
127    ///
128    /// Returns [`SlackError::Api`] when Slack answers `"ok": false`; see [`SlackClient::call`] for the other cases.
129    #[doc(alias = "admin.audit.anomaly.allow.getItem")]
130    pub async fn admin_audit_anomaly_allow_get_item(
131        &self,
132        request: &AdminAuditAnomalyAllowGetItemRequest,
133    ) -> Result<AdminAuditAnomalyAllowGetItemResponse, SlackError> {
134        self.call(request).await
135    }
136
137    /// Calls the Slack Web API method [`admin.audit.anomaly.allow.updateItem`](https://docs.slack.dev/reference/methods/admin.audit.anomaly.allow.updateItem): API to allow Enterprise org admins to write/overwrite the allow list of IP blocks and ASNs from the enterprise configuration.
138    ///
139    /// Required scopes:
140    ///
141    /// - user token: `admin`
142    ///
143    /// Rate limit: Tier 2 (<https://docs.slack.dev/apis/web-api/rate-limits>).
144    ///
145    /// # Errors
146    ///
147    /// Returns [`SlackError::Api`] when Slack answers `"ok": false`; see [`SlackClient::call`] for the other cases.
148    #[doc(alias = "admin.audit.anomaly.allow.updateItem")]
149    pub async fn admin_audit_anomaly_allow_update_item(
150        &self,
151        request: &AdminAuditAnomalyAllowUpdateItemRequest,
152    ) -> Result<AdminAuditAnomalyAllowUpdateItemResponse, SlackError> {
153        self.call(request).await
154    }
155}