Struct IncidentsAPI

Source
pub struct IncidentsAPI { /* private fields */ }
Expand description

Manage incident response, as well as associated attachments, metadata, and todos. See the Incident Management page for more information.

Implementations§

Source§

impl IncidentsAPI

Source

pub fn new() -> Self

Source

pub fn with_config(config: Configuration) -> Self

Examples found in repository?
examples/v2_incidents_GetIncidentType.rs (line 9)
6async fn main() {
7    let mut configuration = datadog::Configuration::new();
8    configuration.set_unstable_operation_enabled("v2.GetIncidentType", true);
9    let api = IncidentsAPI::with_config(configuration);
10    let resp = api.get_incident_type("incident_type_id".to_string()).await;
11    if let Ok(value) = resp {
12        println!("{:#?}", value);
13    } else {
14        println!("{:#?}", resp.unwrap_err());
15    }
16}
More examples
Hide additional examples
examples/v2_incidents_ListIncidents.rs (line 10)
7async fn main() {
8    let mut configuration = datadog::Configuration::new();
9    configuration.set_unstable_operation_enabled("v2.ListIncidents", true);
10    let api = IncidentsAPI::with_config(configuration);
11    let resp = api
12        .list_incidents(ListIncidentsOptionalParams::default())
13        .await;
14    if let Ok(value) = resp {
15        println!("{:#?}", value);
16    } else {
17        println!("{:#?}", resp.unwrap_err());
18    }
19}
examples/v2_incidents_ListIncidentTypes.rs (line 10)
7async fn main() {
8    let mut configuration = datadog::Configuration::new();
9    configuration.set_unstable_operation_enabled("v2.ListIncidentTypes", true);
10    let api = IncidentsAPI::with_config(configuration);
11    let resp = api
12        .list_incident_types(ListIncidentTypesOptionalParams::default())
13        .await;
14    if let Ok(value) = resp {
15        println!("{:#?}", value);
16    } else {
17        println!("{:#?}", resp.unwrap_err());
18    }
19}
examples/v2_incidents_DeleteIncident.rs (line 11)
6async fn main() {
7    // there is a valid "incident" in the system
8    let incident_data_id = std::env::var("INCIDENT_DATA_ID").unwrap();
9    let mut configuration = datadog::Configuration::new();
10    configuration.set_unstable_operation_enabled("v2.DeleteIncident", true);
11    let api = IncidentsAPI::with_config(configuration);
12    let resp = api.delete_incident(incident_data_id.clone()).await;
13    if let Ok(value) = resp {
14        println!("{:#?}", value);
15    } else {
16        println!("{:#?}", resp.unwrap_err());
17    }
18}
examples/v2_incidents_ListIncidentAttachments.rs (line 10)
7async fn main() {
8    let mut configuration = datadog::Configuration::new();
9    configuration.set_unstable_operation_enabled("v2.ListIncidentAttachments", true);
10    let api = IncidentsAPI::with_config(configuration);
11    let resp = api
12        .list_incident_attachments(
13            "incident_id".to_string(),
14            ListIncidentAttachmentsOptionalParams::default(),
15        )
16        .await;
17    if let Ok(value) = resp {
18        println!("{:#?}", value);
19    } else {
20        println!("{:#?}", resp.unwrap_err());
21    }
22}
examples/v2_incidents_SearchIncidents.rs (line 10)
7async fn main() {
8    let mut configuration = datadog::Configuration::new();
9    configuration.set_unstable_operation_enabled("v2.SearchIncidents", true);
10    let api = IncidentsAPI::with_config(configuration);
11    let resp = api
12        .search_incidents(
13            "state:(active OR stable OR resolved)".to_string(),
14            SearchIncidentsOptionalParams::default(),
15        )
16        .await;
17    if let Ok(value) = resp {
18        println!("{:#?}", value);
19    } else {
20        println!("{:#?}", resp.unwrap_err());
21    }
22}
Source

pub fn with_client_and_config( config: Configuration, client: ClientWithMiddleware, ) -> Self

Source

pub async fn create_incident( &self, body: IncidentCreateRequest, ) -> Result<IncidentResponse, Error<CreateIncidentError>>

Create an incident.

Examples found in repository?
examples/v2_incidents_CreateIncident.rs (line 45)
18async fn main() {
19    // there is a valid "user" in the system
20    let user_data_id = std::env::var("USER_DATA_ID").unwrap();
21    let body = IncidentCreateRequest::new(
22        IncidentCreateData::new(
23            IncidentCreateAttributes::new(false, "Example-Incident".to_string()).fields(
24                BTreeMap::from([(
25                    "state".to_string(),
26                    IncidentFieldAttributes::IncidentFieldAttributesSingleValue(Box::new(
27                        IncidentFieldAttributesSingleValue::new()
28                            .type_(IncidentFieldAttributesSingleValueType::DROPDOWN)
29                            .value(Some("resolved".to_string())),
30                    )),
31                )]),
32            ),
33            IncidentType::INCIDENTS,
34        )
35        .relationships(IncidentCreateRelationships::new(Some(
36            NullableRelationshipToUser::new(Some(NullableRelationshipToUserData::new(
37                user_data_id.clone(),
38                UsersType::USERS,
39            ))),
40        ))),
41    );
42    let mut configuration = datadog::Configuration::new();
43    configuration.set_unstable_operation_enabled("v2.CreateIncident", true);
44    let api = IncidentsAPI::with_config(configuration);
45    let resp = api.create_incident(body).await;
46    if let Ok(value) = resp {
47        println!("{:#?}", value);
48    } else {
49        println!("{:#?}", resp.unwrap_err());
50    }
51}
Source

pub async fn create_incident_with_http_info( &self, body: IncidentCreateRequest, ) -> Result<ResponseContent<IncidentResponse>, Error<CreateIncidentError>>

Create an incident.

Source

pub async fn create_incident_integration( &self, incident_id: String, body: IncidentIntegrationMetadataCreateRequest, ) -> Result<IncidentIntegrationMetadataResponse, Error<CreateIncidentIntegrationError>>

Create an incident integration metadata.

Examples found in repository?
examples/v2_incidents_CreateIncidentIntegration.rs (line 37)
13async fn main() {
14    // there is a valid "incident" in the system
15    let incident_data_id = std::env::var("INCIDENT_DATA_ID").unwrap();
16    let body =
17        IncidentIntegrationMetadataCreateRequest::new(IncidentIntegrationMetadataCreateData::new(
18            IncidentIntegrationMetadataAttributes::new(
19                1,
20                IncidentIntegrationMetadataMetadata::SlackIntegrationMetadata(Box::new(
21                    SlackIntegrationMetadata::new(vec![SlackIntegrationMetadataChannelItem::new(
22                        "C0123456789".to_string(),
23                        "#new-channel".to_string(),
24                        "https://slack.com/app_redirect?channel=C0123456789&team=T01234567"
25                            .to_string(),
26                    )
27                    .team_id("T01234567".to_string())]),
28                )),
29            )
30            .incident_id(incident_data_id.clone()),
31            IncidentIntegrationMetadataType::INCIDENT_INTEGRATIONS,
32        ));
33    let mut configuration = datadog::Configuration::new();
34    configuration.set_unstable_operation_enabled("v2.CreateIncidentIntegration", true);
35    let api = IncidentsAPI::with_config(configuration);
36    let resp = api
37        .create_incident_integration(incident_data_id.clone(), body)
38        .await;
39    if let Ok(value) = resp {
40        println!("{:#?}", value);
41    } else {
42        println!("{:#?}", resp.unwrap_err());
43    }
44}
Source

pub async fn create_incident_integration_with_http_info( &self, incident_id: String, body: IncidentIntegrationMetadataCreateRequest, ) -> Result<ResponseContent<IncidentIntegrationMetadataResponse>, Error<CreateIncidentIntegrationError>>

Create an incident integration metadata.

Source

pub async fn create_incident_todo( &self, incident_id: String, body: IncidentTodoCreateRequest, ) -> Result<IncidentTodoResponse, Error<CreateIncidentTodoError>>

Create an incident todo.

Examples found in repository?
examples/v2_incidents_CreateIncidentTodo.rs (line 27)
11async fn main() {
12    // there is a valid "incident" in the system
13    let incident_data_id = std::env::var("INCIDENT_DATA_ID").unwrap();
14    let body = IncidentTodoCreateRequest::new(IncidentTodoCreateData::new(
15        IncidentTodoAttributes::new(
16            vec![IncidentTodoAssignee::IncidentTodoAssigneeHandle(
17                "@test.user@test.com".to_string(),
18            )],
19            "Restore lost data.".to_string(),
20        ),
21        IncidentTodoType::INCIDENT_TODOS,
22    ));
23    let mut configuration = datadog::Configuration::new();
24    configuration.set_unstable_operation_enabled("v2.CreateIncidentTodo", true);
25    let api = IncidentsAPI::with_config(configuration);
26    let resp = api
27        .create_incident_todo(incident_data_id.clone(), body)
28        .await;
29    if let Ok(value) = resp {
30        println!("{:#?}", value);
31    } else {
32        println!("{:#?}", resp.unwrap_err());
33    }
34}
Source

pub async fn create_incident_todo_with_http_info( &self, incident_id: String, body: IncidentTodoCreateRequest, ) -> Result<ResponseContent<IncidentTodoResponse>, Error<CreateIncidentTodoError>>

Create an incident todo.

Source

pub async fn create_incident_type( &self, body: IncidentTypeCreateRequest, ) -> Result<IncidentTypeResponse, Error<CreateIncidentTypeError>>

Create an incident type.

Examples found in repository?
examples/v2_incidents_CreateIncidentType.rs (line 25)
10async fn main() {
11    let body =
12        IncidentTypeCreateRequest::new(
13            IncidentTypeCreateData::new(
14                IncidentTypeAttributes::new("Security Incident".to_string())
15                    .description(
16                        "Any incidents that harm (or have the potential to) the confidentiality, integrity, or availability of our data.".to_string(),
17                    )
18                    .is_default(false),
19                IncidentTypeType::INCIDENT_TYPES,
20            ),
21        );
22    let mut configuration = datadog::Configuration::new();
23    configuration.set_unstable_operation_enabled("v2.CreateIncidentType", true);
24    let api = IncidentsAPI::with_config(configuration);
25    let resp = api.create_incident_type(body).await;
26    if let Ok(value) = resp {
27        println!("{:#?}", value);
28    } else {
29        println!("{:#?}", resp.unwrap_err());
30    }
31}
Source

pub async fn create_incident_type_with_http_info( &self, body: IncidentTypeCreateRequest, ) -> Result<ResponseContent<IncidentTypeResponse>, Error<CreateIncidentTypeError>>

Create an incident type.

Source

pub async fn delete_incident( &self, incident_id: String, ) -> Result<(), Error<DeleteIncidentError>>

Deletes an existing incident from the users organization.

Examples found in repository?
examples/v2_incidents_DeleteIncident.rs (line 12)
6async fn main() {
7    // there is a valid "incident" in the system
8    let incident_data_id = std::env::var("INCIDENT_DATA_ID").unwrap();
9    let mut configuration = datadog::Configuration::new();
10    configuration.set_unstable_operation_enabled("v2.DeleteIncident", true);
11    let api = IncidentsAPI::with_config(configuration);
12    let resp = api.delete_incident(incident_data_id.clone()).await;
13    if let Ok(value) = resp {
14        println!("{:#?}", value);
15    } else {
16        println!("{:#?}", resp.unwrap_err());
17    }
18}
Source

pub async fn delete_incident_with_http_info( &self, incident_id: String, ) -> Result<ResponseContent<()>, Error<DeleteIncidentError>>

Deletes an existing incident from the users organization.

Source

pub async fn delete_incident_integration( &self, incident_id: String, integration_metadata_id: String, ) -> Result<(), Error<DeleteIncidentIntegrationError>>

Delete an incident integration metadata.

Examples found in repository?
examples/v2_incidents_DeleteIncidentIntegration.rs (lines 17-20)
6async fn main() {
7    // there is a valid "incident" in the system
8    let incident_data_id = std::env::var("INCIDENT_DATA_ID").unwrap();
9
10    // the "incident" has an "incident_integration_metadata"
11    let incident_integration_metadata_data_id =
12        std::env::var("INCIDENT_INTEGRATION_METADATA_DATA_ID").unwrap();
13    let mut configuration = datadog::Configuration::new();
14    configuration.set_unstable_operation_enabled("v2.DeleteIncidentIntegration", true);
15    let api = IncidentsAPI::with_config(configuration);
16    let resp = api
17        .delete_incident_integration(
18            incident_data_id.clone(),
19            incident_integration_metadata_data_id.clone(),
20        )
21        .await;
22    if let Ok(value) = resp {
23        println!("{:#?}", value);
24    } else {
25        println!("{:#?}", resp.unwrap_err());
26    }
27}
Source

pub async fn delete_incident_integration_with_http_info( &self, incident_id: String, integration_metadata_id: String, ) -> Result<ResponseContent<()>, Error<DeleteIncidentIntegrationError>>

Delete an incident integration metadata.

Source

pub async fn delete_incident_todo( &self, incident_id: String, todo_id: String, ) -> Result<(), Error<DeleteIncidentTodoError>>

Delete an incident todo.

Examples found in repository?
examples/v2_incidents_DeleteIncidentTodo.rs (line 16)
6async fn main() {
7    // there is a valid "incident" in the system
8    let incident_data_id = std::env::var("INCIDENT_DATA_ID").unwrap();
9
10    // the "incident" has an "incident_todo"
11    let incident_todo_data_id = std::env::var("INCIDENT_TODO_DATA_ID").unwrap();
12    let mut configuration = datadog::Configuration::new();
13    configuration.set_unstable_operation_enabled("v2.DeleteIncidentTodo", true);
14    let api = IncidentsAPI::with_config(configuration);
15    let resp = api
16        .delete_incident_todo(incident_data_id.clone(), incident_todo_data_id.clone())
17        .await;
18    if let Ok(value) = resp {
19        println!("{:#?}", value);
20    } else {
21        println!("{:#?}", resp.unwrap_err());
22    }
23}
Source

pub async fn delete_incident_todo_with_http_info( &self, incident_id: String, todo_id: String, ) -> Result<ResponseContent<()>, Error<DeleteIncidentTodoError>>

Delete an incident todo.

Source

pub async fn delete_incident_type( &self, incident_type_id: String, ) -> Result<(), Error<DeleteIncidentTypeError>>

Delete an incident type.

Examples found in repository?
examples/v2_incidents_DeleteIncidentType.rs (line 13)
6async fn main() {
7    // there is a valid "incident_type" in the system
8    let incident_type_data_id = std::env::var("INCIDENT_TYPE_DATA_ID").unwrap();
9    let mut configuration = datadog::Configuration::new();
10    configuration.set_unstable_operation_enabled("v2.DeleteIncidentType", true);
11    let api = IncidentsAPI::with_config(configuration);
12    let resp = api
13        .delete_incident_type(incident_type_data_id.clone())
14        .await;
15    if let Ok(value) = resp {
16        println!("{:#?}", value);
17    } else {
18        println!("{:#?}", resp.unwrap_err());
19    }
20}
Source

pub async fn delete_incident_type_with_http_info( &self, incident_type_id: String, ) -> Result<ResponseContent<()>, Error<DeleteIncidentTypeError>>

Delete an incident type.

Source

pub async fn get_incident( &self, incident_id: String, params: GetIncidentOptionalParams, ) -> Result<IncidentResponse, Error<GetIncidentError>>

Get the details of an incident by incident_id.

Examples found in repository?
examples/v2_incidents_GetIncident.rs (lines 14-17)
7async fn main() {
8    // there is a valid "incident" in the system
9    let incident_data_id = std::env::var("INCIDENT_DATA_ID").unwrap();
10    let mut configuration = datadog::Configuration::new();
11    configuration.set_unstable_operation_enabled("v2.GetIncident", true);
12    let api = IncidentsAPI::with_config(configuration);
13    let resp = api
14        .get_incident(
15            incident_data_id.clone(),
16            GetIncidentOptionalParams::default(),
17        )
18        .await;
19    if let Ok(value) = resp {
20        println!("{:#?}", value);
21    } else {
22        println!("{:#?}", resp.unwrap_err());
23    }
24}
Source

pub async fn get_incident_with_http_info( &self, incident_id: String, params: GetIncidentOptionalParams, ) -> Result<ResponseContent<IncidentResponse>, Error<GetIncidentError>>

Get the details of an incident by incident_id.

Source

pub async fn get_incident_integration( &self, incident_id: String, integration_metadata_id: String, ) -> Result<IncidentIntegrationMetadataResponse, Error<GetIncidentIntegrationError>>

Get incident integration metadata details.

Examples found in repository?
examples/v2_incidents_GetIncidentIntegration.rs (lines 17-20)
6async fn main() {
7    // there is a valid "incident" in the system
8    let incident_data_id = std::env::var("INCIDENT_DATA_ID").unwrap();
9
10    // the "incident" has an "incident_integration_metadata"
11    let incident_integration_metadata_data_id =
12        std::env::var("INCIDENT_INTEGRATION_METADATA_DATA_ID").unwrap();
13    let mut configuration = datadog::Configuration::new();
14    configuration.set_unstable_operation_enabled("v2.GetIncidentIntegration", true);
15    let api = IncidentsAPI::with_config(configuration);
16    let resp = api
17        .get_incident_integration(
18            incident_data_id.clone(),
19            incident_integration_metadata_data_id.clone(),
20        )
21        .await;
22    if let Ok(value) = resp {
23        println!("{:#?}", value);
24    } else {
25        println!("{:#?}", resp.unwrap_err());
26    }
27}
Source

pub async fn get_incident_integration_with_http_info( &self, incident_id: String, integration_metadata_id: String, ) -> Result<ResponseContent<IncidentIntegrationMetadataResponse>, Error<GetIncidentIntegrationError>>

Get incident integration metadata details.

Source

pub async fn get_incident_todo( &self, incident_id: String, todo_id: String, ) -> Result<IncidentTodoResponse, Error<GetIncidentTodoError>>

Get incident todo details.

Examples found in repository?
examples/v2_incidents_GetIncidentTodo.rs (line 16)
6async fn main() {
7    // there is a valid "incident" in the system
8    let incident_data_id = std::env::var("INCIDENT_DATA_ID").unwrap();
9
10    // the "incident" has an "incident_todo"
11    let incident_todo_data_id = std::env::var("INCIDENT_TODO_DATA_ID").unwrap();
12    let mut configuration = datadog::Configuration::new();
13    configuration.set_unstable_operation_enabled("v2.GetIncidentTodo", true);
14    let api = IncidentsAPI::with_config(configuration);
15    let resp = api
16        .get_incident_todo(incident_data_id.clone(), incident_todo_data_id.clone())
17        .await;
18    if let Ok(value) = resp {
19        println!("{:#?}", value);
20    } else {
21        println!("{:#?}", resp.unwrap_err());
22    }
23}
Source

pub async fn get_incident_todo_with_http_info( &self, incident_id: String, todo_id: String, ) -> Result<ResponseContent<IncidentTodoResponse>, Error<GetIncidentTodoError>>

Get incident todo details.

Source

pub async fn get_incident_type( &self, incident_type_id: String, ) -> Result<IncidentTypeResponse, Error<GetIncidentTypeError>>

Get incident type details.

Examples found in repository?
examples/v2_incidents_GetIncidentType.rs (line 10)
6async fn main() {
7    let mut configuration = datadog::Configuration::new();
8    configuration.set_unstable_operation_enabled("v2.GetIncidentType", true);
9    let api = IncidentsAPI::with_config(configuration);
10    let resp = api.get_incident_type("incident_type_id".to_string()).await;
11    if let Ok(value) = resp {
12        println!("{:#?}", value);
13    } else {
14        println!("{:#?}", resp.unwrap_err());
15    }
16}
Source

pub async fn get_incident_type_with_http_info( &self, incident_type_id: String, ) -> Result<ResponseContent<IncidentTypeResponse>, Error<GetIncidentTypeError>>

Get incident type details.

Source

pub async fn list_incident_attachments( &self, incident_id: String, params: ListIncidentAttachmentsOptionalParams, ) -> Result<IncidentAttachmentsResponse, Error<ListIncidentAttachmentsError>>

Get all attachments for a given incident.

Examples found in repository?
examples/v2_incidents_ListIncidentAttachments.rs (lines 12-15)
7async fn main() {
8    let mut configuration = datadog::Configuration::new();
9    configuration.set_unstable_operation_enabled("v2.ListIncidentAttachments", true);
10    let api = IncidentsAPI::with_config(configuration);
11    let resp = api
12        .list_incident_attachments(
13            "incident_id".to_string(),
14            ListIncidentAttachmentsOptionalParams::default(),
15        )
16        .await;
17    if let Ok(value) = resp {
18        println!("{:#?}", value);
19    } else {
20        println!("{:#?}", resp.unwrap_err());
21    }
22}
More examples
Hide additional examples
examples/v2_incidents_ListIncidentAttachments_2457735435.rs (lines 14-17)
7async fn main() {
8    // there is a valid "incident" in the system
9    let incident_data_id = std::env::var("INCIDENT_DATA_ID").unwrap();
10    let mut configuration = datadog::Configuration::new();
11    configuration.set_unstable_operation_enabled("v2.ListIncidentAttachments", true);
12    let api = IncidentsAPI::with_config(configuration);
13    let resp = api
14        .list_incident_attachments(
15            incident_data_id.clone(),
16            ListIncidentAttachmentsOptionalParams::default(),
17        )
18        .await;
19    if let Ok(value) = resp {
20        println!("{:#?}", value);
21    } else {
22        println!("{:#?}", resp.unwrap_err());
23    }
24}
Source

pub async fn list_incident_attachments_with_http_info( &self, incident_id: String, params: ListIncidentAttachmentsOptionalParams, ) -> Result<ResponseContent<IncidentAttachmentsResponse>, Error<ListIncidentAttachmentsError>>

Get all attachments for a given incident.

Source

pub async fn list_incident_integrations( &self, incident_id: String, ) -> Result<IncidentIntegrationMetadataListResponse, Error<ListIncidentIntegrationsError>>

Get all integration metadata for an incident.

Examples found in repository?
examples/v2_incidents_ListIncidentIntegrations.rs (line 13)
6async fn main() {
7    // there is a valid "incident" in the system
8    let incident_data_id = std::env::var("INCIDENT_DATA_ID").unwrap();
9    let mut configuration = datadog::Configuration::new();
10    configuration.set_unstable_operation_enabled("v2.ListIncidentIntegrations", true);
11    let api = IncidentsAPI::with_config(configuration);
12    let resp = api
13        .list_incident_integrations(incident_data_id.clone())
14        .await;
15    if let Ok(value) = resp {
16        println!("{:#?}", value);
17    } else {
18        println!("{:#?}", resp.unwrap_err());
19    }
20}
Source

pub async fn list_incident_integrations_with_http_info( &self, incident_id: String, ) -> Result<ResponseContent<IncidentIntegrationMetadataListResponse>, Error<ListIncidentIntegrationsError>>

Get all integration metadata for an incident.

Source

pub async fn list_incident_todos( &self, incident_id: String, ) -> Result<IncidentTodoListResponse, Error<ListIncidentTodosError>>

Get all todos for an incident.

Examples found in repository?
examples/v2_incidents_ListIncidentTodos.rs (line 12)
6async fn main() {
7    // there is a valid "incident" in the system
8    let incident_data_id = std::env::var("INCIDENT_DATA_ID").unwrap();
9    let mut configuration = datadog::Configuration::new();
10    configuration.set_unstable_operation_enabled("v2.ListIncidentTodos", true);
11    let api = IncidentsAPI::with_config(configuration);
12    let resp = api.list_incident_todos(incident_data_id.clone()).await;
13    if let Ok(value) = resp {
14        println!("{:#?}", value);
15    } else {
16        println!("{:#?}", resp.unwrap_err());
17    }
18}
Source

pub async fn list_incident_todos_with_http_info( &self, incident_id: String, ) -> Result<ResponseContent<IncidentTodoListResponse>, Error<ListIncidentTodosError>>

Get all todos for an incident.

Source

pub async fn list_incident_types( &self, params: ListIncidentTypesOptionalParams, ) -> Result<IncidentTypeListResponse, Error<ListIncidentTypesError>>

Get all incident types.

Examples found in repository?
examples/v2_incidents_ListIncidentTypes.rs (line 12)
7async fn main() {
8    let mut configuration = datadog::Configuration::new();
9    configuration.set_unstable_operation_enabled("v2.ListIncidentTypes", true);
10    let api = IncidentsAPI::with_config(configuration);
11    let resp = api
12        .list_incident_types(ListIncidentTypesOptionalParams::default())
13        .await;
14    if let Ok(value) = resp {
15        println!("{:#?}", value);
16    } else {
17        println!("{:#?}", resp.unwrap_err());
18    }
19}
Source

pub async fn list_incident_types_with_http_info( &self, params: ListIncidentTypesOptionalParams, ) -> Result<ResponseContent<IncidentTypeListResponse>, Error<ListIncidentTypesError>>

Get all incident types.

Source

pub async fn list_incidents( &self, params: ListIncidentsOptionalParams, ) -> Result<IncidentsResponse, Error<ListIncidentsError>>

Get all incidents for the user’s organization.

Examples found in repository?
examples/v2_incidents_ListIncidents.rs (line 12)
7async fn main() {
8    let mut configuration = datadog::Configuration::new();
9    configuration.set_unstable_operation_enabled("v2.ListIncidents", true);
10    let api = IncidentsAPI::with_config(configuration);
11    let resp = api
12        .list_incidents(ListIncidentsOptionalParams::default())
13        .await;
14    if let Ok(value) = resp {
15        println!("{:#?}", value);
16    } else {
17        println!("{:#?}", resp.unwrap_err());
18    }
19}
Source

pub fn list_incidents_with_pagination( &self, params: ListIncidentsOptionalParams, ) -> impl Stream<Item = Result<IncidentResponseData, Error<ListIncidentsError>>> + '_

Examples found in repository?
examples/v2_incidents_ListIncidents_2665616954.rs (line 14)
9async fn main() {
10    let mut configuration = datadog::Configuration::new();
11    configuration.set_unstable_operation_enabled("v2.ListIncidents", true);
12    let api = IncidentsAPI::with_config(configuration);
13    let response =
14        api.list_incidents_with_pagination(ListIncidentsOptionalParams::default().page_size(2));
15    pin_mut!(response);
16    while let Some(resp) = response.next().await {
17        if let Ok(value) = resp {
18            println!("{:#?}", value);
19        } else {
20            println!("{:#?}", resp.unwrap_err());
21        }
22    }
23}
Source

pub async fn list_incidents_with_http_info( &self, params: ListIncidentsOptionalParams, ) -> Result<ResponseContent<IncidentsResponse>, Error<ListIncidentsError>>

Get all incidents for the user’s organization.

Source

pub async fn search_incidents( &self, query: String, params: SearchIncidentsOptionalParams, ) -> Result<IncidentSearchResponse, Error<SearchIncidentsError>>

Search for incidents matching a certain query.

Examples found in repository?
examples/v2_incidents_SearchIncidents.rs (lines 12-15)
7async fn main() {
8    let mut configuration = datadog::Configuration::new();
9    configuration.set_unstable_operation_enabled("v2.SearchIncidents", true);
10    let api = IncidentsAPI::with_config(configuration);
11    let resp = api
12        .search_incidents(
13            "state:(active OR stable OR resolved)".to_string(),
14            SearchIncidentsOptionalParams::default(),
15        )
16        .await;
17    if let Ok(value) = resp {
18        println!("{:#?}", value);
19    } else {
20        println!("{:#?}", resp.unwrap_err());
21    }
22}
Source

pub fn search_incidents_with_pagination( &self, query: String, params: SearchIncidentsOptionalParams, ) -> impl Stream<Item = Result<IncidentSearchResponseIncidentsData, Error<SearchIncidentsError>>> + '_

Examples found in repository?
examples/v2_incidents_SearchIncidents_1931679109.rs (lines 13-16)
9async fn main() {
10    let mut configuration = datadog::Configuration::new();
11    configuration.set_unstable_operation_enabled("v2.SearchIncidents", true);
12    let api = IncidentsAPI::with_config(configuration);
13    let response = api.search_incidents_with_pagination(
14        "state:(active OR stable OR resolved)".to_string(),
15        SearchIncidentsOptionalParams::default().page_size(2),
16    );
17    pin_mut!(response);
18    while let Some(resp) = response.next().await {
19        if let Ok(value) = resp {
20            println!("{:#?}", value);
21        } else {
22            println!("{:#?}", resp.unwrap_err());
23        }
24    }
25}
Source

pub async fn search_incidents_with_http_info( &self, query: String, params: SearchIncidentsOptionalParams, ) -> Result<ResponseContent<IncidentSearchResponse>, Error<SearchIncidentsError>>

Search for incidents matching a certain query.

Source

pub async fn update_incident( &self, incident_id: String, body: IncidentUpdateRequest, params: UpdateIncidentOptionalParams, ) -> Result<IncidentResponse, Error<UpdateIncidentError>>

Updates an incident. Provide only the attributes that should be updated as this request is a partial update.

Examples found in repository?
examples/v2_incidents_UpdateIncident_1009194038.rs (lines 25-29)
12async fn main() {
13    // there is a valid "incident" in the system
14    let incident_data_id = std::env::var("INCIDENT_DATA_ID").unwrap();
15    let body = IncidentUpdateRequest::new(
16        IncidentUpdateData::new(incident_data_id.clone(), IncidentType::INCIDENTS).relationships(
17            IncidentUpdateRelationships::new()
18                .commander_user(Some(NullableRelationshipToUser::new(None))),
19        ),
20    );
21    let mut configuration = datadog::Configuration::new();
22    configuration.set_unstable_operation_enabled("v2.UpdateIncident", true);
23    let api = IncidentsAPI::with_config(configuration);
24    let resp = api
25        .update_incident(
26            incident_data_id.clone(),
27            body,
28            UpdateIncidentOptionalParams::default(),
29        )
30        .await;
31    if let Ok(value) = resp {
32        println!("{:#?}", value);
33    } else {
34        println!("{:#?}", resp.unwrap_err());
35    }
36}
More examples
Hide additional examples
examples/v2_incidents_UpdateIncident_3369341440.rs (lines 34-38)
14async fn main() {
15    // there is a valid "incident" in the system
16    let incident_data_id = std::env::var("INCIDENT_DATA_ID").unwrap();
17
18    // there is a valid "user" in the system
19    let user_data_id = std::env::var("USER_DATA_ID").unwrap();
20    let body = IncidentUpdateRequest::new(
21        IncidentUpdateData::new(incident_data_id.clone(), IncidentType::INCIDENTS).relationships(
22            IncidentUpdateRelationships::new().commander_user(Some(
23                NullableRelationshipToUser::new(Some(NullableRelationshipToUserData::new(
24                    user_data_id.clone(),
25                    UsersType::USERS,
26                ))),
27            )),
28        ),
29    );
30    let mut configuration = datadog::Configuration::new();
31    configuration.set_unstable_operation_enabled("v2.UpdateIncident", true);
32    let api = IncidentsAPI::with_config(configuration);
33    let resp = api
34        .update_incident(
35            incident_data_id.clone(),
36            body,
37            UpdateIncidentOptionalParams::default(),
38        )
39        .await;
40    if let Ok(value) = resp {
41        println!("{:#?}", value);
42    } else {
43        println!("{:#?}", resp.unwrap_err());
44    }
45}
examples/v2_incidents_UpdateIncident.rs (lines 36-40)
15async fn main() {
16    // there is a valid "incident" in the system
17    let incident_data_id = std::env::var("INCIDENT_DATA_ID").unwrap();
18    let body = IncidentUpdateRequest::new(
19        IncidentUpdateData::new(incident_data_id.clone(), IncidentType::INCIDENTS).attributes(
20            IncidentUpdateAttributes::new()
21                .fields(BTreeMap::from([(
22                    "state".to_string(),
23                    IncidentFieldAttributes::IncidentFieldAttributesSingleValue(Box::new(
24                        IncidentFieldAttributesSingleValue::new()
25                            .type_(IncidentFieldAttributesSingleValueType::DROPDOWN)
26                            .value(Some("resolved".to_string())),
27                    )),
28                )]))
29                .title("A test incident title-updated".to_string()),
30        ),
31    );
32    let mut configuration = datadog::Configuration::new();
33    configuration.set_unstable_operation_enabled("v2.UpdateIncident", true);
34    let api = IncidentsAPI::with_config(configuration);
35    let resp = api
36        .update_incident(
37            incident_data_id.clone(),
38            body,
39            UpdateIncidentOptionalParams::default(),
40        )
41        .await;
42    if let Ok(value) = resp {
43        println!("{:#?}", value);
44    } else {
45        println!("{:#?}", resp.unwrap_err());
46    }
47}
Source

pub async fn update_incident_with_http_info( &self, incident_id: String, body: IncidentUpdateRequest, params: UpdateIncidentOptionalParams, ) -> Result<ResponseContent<IncidentResponse>, Error<UpdateIncidentError>>

Updates an incident. Provide only the attributes that should be updated as this request is a partial update.

Source

pub async fn update_incident_attachments( &self, incident_id: String, body: IncidentAttachmentUpdateRequest, params: UpdateIncidentAttachmentsOptionalParams, ) -> Result<IncidentAttachmentUpdateResponse, Error<UpdateIncidentAttachmentsError>>

The bulk update endpoint for creating, updating, and deleting attachments for a given incident.

Examples found in repository?
examples/v2_incidents_UpdateIncidentAttachments_3881702075.rs (lines 35-39)
14async fn main() {
15    // there is a valid "incident" in the system
16    let incident_data_id = std::env::var("INCIDENT_DATA_ID").unwrap();
17    let body = IncidentAttachmentUpdateRequest::new(vec![IncidentAttachmentUpdateData::new(
18        IncidentAttachmentType::INCIDENT_ATTACHMENTS,
19    )
20    .attributes(
21        IncidentAttachmentUpdateAttributes::IncidentAttachmentLinkAttributes(Box::new(
22            IncidentAttachmentLinkAttributes::new(
23                IncidentAttachmentLinkAttributesAttachmentObject::new(
24                    "https://www.example.com/doc".to_string(),
25                    "Example-Incident".to_string(),
26                ),
27                IncidentAttachmentLinkAttachmentType::LINK,
28            ),
29        )),
30    )]);
31    let mut configuration = datadog::Configuration::new();
32    configuration.set_unstable_operation_enabled("v2.UpdateIncidentAttachments", true);
33    let api = IncidentsAPI::with_config(configuration);
34    let resp = api
35        .update_incident_attachments(
36            incident_data_id.clone(),
37            body,
38            UpdateIncidentAttachmentsOptionalParams::default(),
39        )
40        .await;
41    if let Ok(value) = resp {
42        println!("{:#?}", value);
43    } else {
44        println!("{:#?}", resp.unwrap_err());
45    }
46}
More examples
Hide additional examples
examples/v2_incidents_UpdateIncidentAttachments.rs (lines 50-54)
17async fn main() {
18    let body = IncidentAttachmentUpdateRequest::new(vec![
19        IncidentAttachmentUpdateData::new(IncidentAttachmentType::INCIDENT_ATTACHMENTS)
20            .attributes(
21                IncidentAttachmentUpdateAttributes::IncidentAttachmentPostmortemAttributes(
22                    Box::new(IncidentAttachmentPostmortemAttributes::new(
23                        IncidentAttachmentsPostmortemAttributesAttachmentObject::new(
24                            "https://app.datadoghq.com/notebook/123".to_string(),
25                            "Postmortem IR-123".to_string(),
26                        ),
27                        IncidentAttachmentPostmortemAttachmentType::POSTMORTEM,
28                    )),
29                ),
30            )
31            .id("00000000-abcd-0002-0000-000000000000".to_string()),
32        IncidentAttachmentUpdateData::new(IncidentAttachmentType::INCIDENT_ATTACHMENTS).attributes(
33            IncidentAttachmentUpdateAttributes::IncidentAttachmentLinkAttributes(Box::new(
34                IncidentAttachmentLinkAttributes::new(
35                    IncidentAttachmentLinkAttributesAttachmentObject::new(
36                        "https://www.example.com/webstore-failure-runbook".to_string(),
37                        "Runbook for webstore service failures".to_string(),
38                    ),
39                    IncidentAttachmentLinkAttachmentType::LINK,
40                ),
41            )),
42        ),
43        IncidentAttachmentUpdateData::new(IncidentAttachmentType::INCIDENT_ATTACHMENTS)
44            .id("00000000-abcd-0003-0000-000000000000".to_string()),
45    ]);
46    let mut configuration = datadog::Configuration::new();
47    configuration.set_unstable_operation_enabled("v2.UpdateIncidentAttachments", true);
48    let api = IncidentsAPI::with_config(configuration);
49    let resp = api
50        .update_incident_attachments(
51            "incident_id".to_string(),
52            body,
53            UpdateIncidentAttachmentsOptionalParams::default(),
54        )
55        .await;
56    if let Ok(value) = resp {
57        println!("{:#?}", value);
58    } else {
59        println!("{:#?}", resp.unwrap_err());
60    }
61}
Source

pub async fn update_incident_attachments_with_http_info( &self, incident_id: String, body: IncidentAttachmentUpdateRequest, params: UpdateIncidentAttachmentsOptionalParams, ) -> Result<ResponseContent<IncidentAttachmentUpdateResponse>, Error<UpdateIncidentAttachmentsError>>

The bulk update endpoint for creating, updating, and deleting attachments for a given incident.

Source

pub async fn update_incident_integration( &self, incident_id: String, integration_metadata_id: String, body: IncidentIntegrationMetadataPatchRequest, ) -> Result<IncidentIntegrationMetadataResponse, Error<UpdateIncidentIntegrationError>>

Update an existing incident integration metadata.

Examples found in repository?
examples/v2_incidents_UpdateIncidentIntegration.rs (lines 41-45)
13async fn main() {
14    // there is a valid "incident" in the system
15    let incident_data_id = std::env::var("INCIDENT_DATA_ID").unwrap();
16
17    // the "incident" has an "incident_integration_metadata"
18    let incident_integration_metadata_data_id =
19        std::env::var("INCIDENT_INTEGRATION_METADATA_DATA_ID").unwrap();
20    let body =
21        IncidentIntegrationMetadataPatchRequest::new(IncidentIntegrationMetadataPatchData::new(
22            IncidentIntegrationMetadataAttributes::new(
23                1,
24                IncidentIntegrationMetadataMetadata::SlackIntegrationMetadata(Box::new(
25                    SlackIntegrationMetadata::new(vec![SlackIntegrationMetadataChannelItem::new(
26                        "C0123456789".to_string(),
27                        "#updated-channel-name".to_string(),
28                        "https://slack.com/app_redirect?channel=C0123456789&team=T01234567"
29                            .to_string(),
30                    )
31                    .team_id("T01234567".to_string())]),
32                )),
33            )
34            .incident_id(incident_data_id.clone()),
35            IncidentIntegrationMetadataType::INCIDENT_INTEGRATIONS,
36        ));
37    let mut configuration = datadog::Configuration::new();
38    configuration.set_unstable_operation_enabled("v2.UpdateIncidentIntegration", true);
39    let api = IncidentsAPI::with_config(configuration);
40    let resp = api
41        .update_incident_integration(
42            incident_data_id.clone(),
43            incident_integration_metadata_data_id.clone(),
44            body,
45        )
46        .await;
47    if let Ok(value) = resp {
48        println!("{:#?}", value);
49    } else {
50        println!("{:#?}", resp.unwrap_err());
51    }
52}
Source

pub async fn update_incident_integration_with_http_info( &self, incident_id: String, integration_metadata_id: String, body: IncidentIntegrationMetadataPatchRequest, ) -> Result<ResponseContent<IncidentIntegrationMetadataResponse>, Error<UpdateIncidentIntegrationError>>

Update an existing incident integration metadata.

Source

pub async fn update_incident_todo( &self, incident_id: String, todo_id: String, body: IncidentTodoPatchRequest, ) -> Result<IncidentTodoResponse, Error<UpdateIncidentTodoError>>

Update an incident todo.

Examples found in repository?
examples/v2_incidents_UpdateIncidentTodo.rs (lines 32-36)
11async fn main() {
12    // there is a valid "incident" in the system
13    let incident_data_id = std::env::var("INCIDENT_DATA_ID").unwrap();
14
15    // the "incident" has an "incident_todo"
16    let incident_todo_data_id = std::env::var("INCIDENT_TODO_DATA_ID").unwrap();
17    let body = IncidentTodoPatchRequest::new(IncidentTodoPatchData::new(
18        IncidentTodoAttributes::new(
19            vec![IncidentTodoAssignee::IncidentTodoAssigneeHandle(
20                "@test.user@test.com".to_string(),
21            )],
22            "Restore lost data.".to_string(),
23        )
24        .completed(Some("2023-03-06T22:00:00.000000+00:00".to_string()))
25        .due_date(Some("2023-07-10T05:00:00.000000+00:00".to_string())),
26        IncidentTodoType::INCIDENT_TODOS,
27    ));
28    let mut configuration = datadog::Configuration::new();
29    configuration.set_unstable_operation_enabled("v2.UpdateIncidentTodo", true);
30    let api = IncidentsAPI::with_config(configuration);
31    let resp = api
32        .update_incident_todo(
33            incident_data_id.clone(),
34            incident_todo_data_id.clone(),
35            body,
36        )
37        .await;
38    if let Ok(value) = resp {
39        println!("{:#?}", value);
40    } else {
41        println!("{:#?}", resp.unwrap_err());
42    }
43}
Source

pub async fn update_incident_todo_with_http_info( &self, incident_id: String, todo_id: String, body: IncidentTodoPatchRequest, ) -> Result<ResponseContent<IncidentTodoResponse>, Error<UpdateIncidentTodoError>>

Update an incident todo.

Source

pub async fn update_incident_type( &self, incident_type_id: String, body: IncidentTypePatchRequest, ) -> Result<IncidentTypeResponse, Error<UpdateIncidentTypeError>>

Update an incident type.

Examples found in repository?
examples/v2_incidents_UpdateIncidentType.rs (line 22)
10async fn main() {
11    // there is a valid "incident_type" in the system
12    let incident_type_data_id = std::env::var("INCIDENT_TYPE_DATA_ID").unwrap();
13    let body = IncidentTypePatchRequest::new(IncidentTypePatchData::new(
14        IncidentTypeUpdateAttributes::new().name("Security Incident-updated".to_string()),
15        incident_type_data_id.clone(),
16        IncidentTypeType::INCIDENT_TYPES,
17    ));
18    let mut configuration = datadog::Configuration::new();
19    configuration.set_unstable_operation_enabled("v2.UpdateIncidentType", true);
20    let api = IncidentsAPI::with_config(configuration);
21    let resp = api
22        .update_incident_type(incident_type_data_id.clone(), body)
23        .await;
24    if let Ok(value) = resp {
25        println!("{:#?}", value);
26    } else {
27        println!("{:#?}", resp.unwrap_err());
28    }
29}
Source

pub async fn update_incident_type_with_http_info( &self, incident_type_id: String, body: IncidentTypePatchRequest, ) -> Result<ResponseContent<IncidentTypeResponse>, Error<UpdateIncidentTypeError>>

Update an incident type.

Trait Implementations§

Source§

impl Clone for IncidentsAPI

Source§

fn clone(&self) -> IncidentsAPI

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for IncidentsAPI

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for IncidentsAPI

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,