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_ListIncidents.rs (line 10)
7
8
9
10
11
12
13
14
15
16
17
18
19
async fn main() {
    let mut configuration = datadog::Configuration::new();
    configuration.set_unstable_operation_enabled("v2.ListIncidents", true);
    let api = IncidentsAPI::with_config(configuration);
    let resp = api
        .list_incidents(ListIncidentsOptionalParams::default())
        .await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}
More examples
Hide additional examples
examples/v2_incidents_DeleteIncident.rs (line 11)
6
7
8
9
10
11
12
13
14
15
16
17
18
async fn main() {
    // there is a valid "incident" in the system
    let incident_data_id = std::env::var("INCIDENT_DATA_ID").unwrap();
    let mut configuration = datadog::Configuration::new();
    configuration.set_unstable_operation_enabled("v2.DeleteIncident", true);
    let api = IncidentsAPI::with_config(configuration);
    let resp = api.delete_incident(incident_data_id.clone()).await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}
examples/v2_incidents_ListIncidentAttachments.rs (line 10)
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
async fn main() {
    let mut configuration = datadog::Configuration::new();
    configuration.set_unstable_operation_enabled("v2.ListIncidentAttachments", true);
    let api = IncidentsAPI::with_config(configuration);
    let resp = api
        .list_incident_attachments(
            "incident_id".to_string(),
            ListIncidentAttachmentsOptionalParams::default(),
        )
        .await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}
examples/v2_incidents_SearchIncidents.rs (line 10)
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
async fn main() {
    let mut configuration = datadog::Configuration::new();
    configuration.set_unstable_operation_enabled("v2.SearchIncidents", true);
    let api = IncidentsAPI::with_config(configuration);
    let resp = api
        .search_incidents(
            "state:(active OR stable OR resolved)".to_string(),
            SearchIncidentsOptionalParams::default(),
        )
        .await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}
examples/v2_incidents_ListIncidentTodos.rs (line 11)
6
7
8
9
10
11
12
13
14
15
16
17
18
async fn main() {
    // there is a valid "incident" in the system
    let incident_data_id = std::env::var("INCIDENT_DATA_ID").unwrap();
    let mut configuration = datadog::Configuration::new();
    configuration.set_unstable_operation_enabled("v2.ListIncidentTodos", true);
    let api = IncidentsAPI::with_config(configuration);
    let resp = api.list_incident_todos(incident_data_id.clone()).await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}
examples/v2_incidents_ListIncidents_2665616954.rs (line 12)
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
async fn main() {
    let mut configuration = datadog::Configuration::new();
    configuration.set_unstable_operation_enabled("v2.ListIncidents", true);
    let api = IncidentsAPI::with_config(configuration);
    let response =
        api.list_incidents_with_pagination(ListIncidentsOptionalParams::default().page_size(2));
    pin_mut!(response);
    while let Some(resp) = response.next().await {
        if let Ok(value) = resp {
            println!("{:#?}", value);
        } else {
            println!("{:#?}", resp.unwrap_err());
        }
    }
}
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)
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
async fn main() {
    // there is a valid "user" in the system
    let user_data_id = std::env::var("USER_DATA_ID").unwrap();
    let body = IncidentCreateRequest::new(
        IncidentCreateData::new(
            IncidentCreateAttributes::new(false, "Example-Incident".to_string()).fields(
                BTreeMap::from([(
                    "state".to_string(),
                    IncidentFieldAttributes::IncidentFieldAttributesSingleValue(Box::new(
                        IncidentFieldAttributesSingleValue::new()
                            .type_(IncidentFieldAttributesSingleValueType::DROPDOWN)
                            .value(Some("resolved".to_string())),
                    )),
                )]),
            ),
            IncidentType::INCIDENTS,
        )
        .relationships(IncidentCreateRelationships::new(Some(
            NullableRelationshipToUser::new(Some(NullableRelationshipToUserData::new(
                user_data_id.clone(),
                UsersType::USERS,
            ))),
        ))),
    );
    let mut configuration = datadog::Configuration::new();
    configuration.set_unstable_operation_enabled("v2.CreateIncident", true);
    let api = IncidentsAPI::with_config(configuration);
    let resp = api.create_incident(body).await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}
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)
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
async fn main() {
    // there is a valid "incident" in the system
    let incident_data_id = std::env::var("INCIDENT_DATA_ID").unwrap();
    let body =
        IncidentIntegrationMetadataCreateRequest::new(IncidentIntegrationMetadataCreateData::new(
            IncidentIntegrationMetadataAttributes::new(
                1,
                IncidentIntegrationMetadataMetadata::SlackIntegrationMetadata(Box::new(
                    SlackIntegrationMetadata::new(vec![SlackIntegrationMetadataChannelItem::new(
                        "C0123456789".to_string(),
                        "#new-channel".to_string(),
                        "https://slack.com/app_redirect?channel=C0123456789&team=T01234567"
                            .to_string(),
                    )
                    .team_id("T01234567".to_string())]),
                )),
            )
            .incident_id(incident_data_id.clone()),
            IncidentIntegrationMetadataType::INCIDENT_INTEGRATIONS,
        ));
    let mut configuration = datadog::Configuration::new();
    configuration.set_unstable_operation_enabled("v2.CreateIncidentIntegration", true);
    let api = IncidentsAPI::with_config(configuration);
    let resp = api
        .create_incident_integration(incident_data_id.clone(), body)
        .await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}
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)
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
async fn main() {
    // there is a valid "incident" in the system
    let incident_data_id = std::env::var("INCIDENT_DATA_ID").unwrap();
    let body = IncidentTodoCreateRequest::new(IncidentTodoCreateData::new(
        IncidentTodoAttributes::new(
            vec![IncidentTodoAssignee::IncidentTodoAssigneeHandle(
                "@test.user@test.com".to_string(),
            )],
            "Restore lost data.".to_string(),
        ),
        IncidentTodoType::INCIDENT_TODOS,
    ));
    let mut configuration = datadog::Configuration::new();
    configuration.set_unstable_operation_enabled("v2.CreateIncidentTodo", true);
    let api = IncidentsAPI::with_config(configuration);
    let resp = api
        .create_incident_todo(incident_data_id.clone(), body)
        .await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}
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 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)
6
7
8
9
10
11
12
13
14
15
16
17
18
async fn main() {
    // there is a valid "incident" in the system
    let incident_data_id = std::env::var("INCIDENT_DATA_ID").unwrap();
    let mut configuration = datadog::Configuration::new();
    configuration.set_unstable_operation_enabled("v2.DeleteIncident", true);
    let api = IncidentsAPI::with_config(configuration);
    let resp = api.delete_incident(incident_data_id.clone()).await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}
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)
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
async fn main() {
    // there is a valid "incident" in the system
    let incident_data_id = std::env::var("INCIDENT_DATA_ID").unwrap();

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

    // the "incident" has an "incident_todo"
    let incident_todo_data_id = std::env::var("INCIDENT_TODO_DATA_ID").unwrap();
    let mut configuration = datadog::Configuration::new();
    configuration.set_unstable_operation_enabled("v2.DeleteIncidentTodo", true);
    let api = IncidentsAPI::with_config(configuration);
    let resp = api
        .delete_incident_todo(incident_data_id.clone(), incident_todo_data_id.clone())
        .await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}
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 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)
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
async fn main() {
    // there is a valid "incident" in the system
    let incident_data_id = std::env::var("INCIDENT_DATA_ID").unwrap();
    let mut configuration = datadog::Configuration::new();
    configuration.set_unstable_operation_enabled("v2.GetIncident", true);
    let api = IncidentsAPI::with_config(configuration);
    let resp = api
        .get_incident(
            incident_data_id.clone(),
            GetIncidentOptionalParams::default(),
        )
        .await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}
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)
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
async fn main() {
    // there is a valid "incident" in the system
    let incident_data_id = std::env::var("INCIDENT_DATA_ID").unwrap();

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

    // the "incident" has an "incident_todo"
    let incident_todo_data_id = std::env::var("INCIDENT_TODO_DATA_ID").unwrap();
    let mut configuration = datadog::Configuration::new();
    configuration.set_unstable_operation_enabled("v2.GetIncidentTodo", true);
    let api = IncidentsAPI::with_config(configuration);
    let resp = api
        .get_incident_todo(incident_data_id.clone(), incident_todo_data_id.clone())
        .await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}
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 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)
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
async fn main() {
    let mut configuration = datadog::Configuration::new();
    configuration.set_unstable_operation_enabled("v2.ListIncidentAttachments", true);
    let api = IncidentsAPI::with_config(configuration);
    let resp = api
        .list_incident_attachments(
            "incident_id".to_string(),
            ListIncidentAttachmentsOptionalParams::default(),
        )
        .await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}
More examples
Hide additional examples
examples/v2_incidents_ListIncidentAttachments_2457735435.rs (lines 14-17)
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
async fn main() {
    // there is a valid "incident" in the system
    let incident_data_id = std::env::var("INCIDENT_DATA_ID").unwrap();
    let mut configuration = datadog::Configuration::new();
    configuration.set_unstable_operation_enabled("v2.ListIncidentAttachments", true);
    let api = IncidentsAPI::with_config(configuration);
    let resp = api
        .list_incident_attachments(
            incident_data_id.clone(),
            ListIncidentAttachmentsOptionalParams::default(),
        )
        .await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}
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)
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
async fn main() {
    // there is a valid "incident" in the system
    let incident_data_id = std::env::var("INCIDENT_DATA_ID").unwrap();
    let mut configuration = datadog::Configuration::new();
    configuration.set_unstable_operation_enabled("v2.ListIncidentIntegrations", true);
    let api = IncidentsAPI::with_config(configuration);
    let resp = api
        .list_incident_integrations(incident_data_id.clone())
        .await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}
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)
6
7
8
9
10
11
12
13
14
15
16
17
18
async fn main() {
    // there is a valid "incident" in the system
    let incident_data_id = std::env::var("INCIDENT_DATA_ID").unwrap();
    let mut configuration = datadog::Configuration::new();
    configuration.set_unstable_operation_enabled("v2.ListIncidentTodos", true);
    let api = IncidentsAPI::with_config(configuration);
    let resp = api.list_incident_todos(incident_data_id.clone()).await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}
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_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)
7
8
9
10
11
12
13
14
15
16
17
18
19
async fn main() {
    let mut configuration = datadog::Configuration::new();
    configuration.set_unstable_operation_enabled("v2.ListIncidents", true);
    let api = IncidentsAPI::with_config(configuration);
    let resp = api
        .list_incidents(ListIncidentsOptionalParams::default())
        .await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}
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)
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
async fn main() {
    let mut configuration = datadog::Configuration::new();
    configuration.set_unstable_operation_enabled("v2.ListIncidents", true);
    let api = IncidentsAPI::with_config(configuration);
    let response =
        api.list_incidents_with_pagination(ListIncidentsOptionalParams::default().page_size(2));
    pin_mut!(response);
    while let Some(resp) = response.next().await {
        if let Ok(value) = resp {
            println!("{:#?}", value);
        } else {
            println!("{:#?}", resp.unwrap_err());
        }
    }
}
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)
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
async fn main() {
    let mut configuration = datadog::Configuration::new();
    configuration.set_unstable_operation_enabled("v2.SearchIncidents", true);
    let api = IncidentsAPI::with_config(configuration);
    let resp = api
        .search_incidents(
            "state:(active OR stable OR resolved)".to_string(),
            SearchIncidentsOptionalParams::default(),
        )
        .await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}
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)
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
async fn main() {
    let mut configuration = datadog::Configuration::new();
    configuration.set_unstable_operation_enabled("v2.SearchIncidents", true);
    let api = IncidentsAPI::with_config(configuration);
    let response = api.search_incidents_with_pagination(
        "state:(active OR stable OR resolved)".to_string(),
        SearchIncidentsOptionalParams::default().page_size(2),
    );
    pin_mut!(response);
    while let Some(resp) = response.next().await {
        if let Ok(value) = resp {
            println!("{:#?}", value);
        } else {
            println!("{:#?}", resp.unwrap_err());
        }
    }
}
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)
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
async fn main() {
    // there is a valid "incident" in the system
    let incident_data_id = std::env::var("INCIDENT_DATA_ID").unwrap();
    let body = IncidentUpdateRequest::new(
        IncidentUpdateData::new(incident_data_id.clone(), IncidentType::INCIDENTS).relationships(
            IncidentUpdateRelationships::new()
                .commander_user(Some(NullableRelationshipToUser::new(None))),
        ),
    );
    let mut configuration = datadog::Configuration::new();
    configuration.set_unstable_operation_enabled("v2.UpdateIncident", true);
    let api = IncidentsAPI::with_config(configuration);
    let resp = api
        .update_incident(
            incident_data_id.clone(),
            body,
            UpdateIncidentOptionalParams::default(),
        )
        .await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}
More examples
Hide additional examples
examples/v2_incidents_UpdateIncident_3369341440.rs (lines 34-38)
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
async fn main() {
    // there is a valid "incident" in the system
    let incident_data_id = std::env::var("INCIDENT_DATA_ID").unwrap();

    // there is a valid "user" in the system
    let user_data_id = std::env::var("USER_DATA_ID").unwrap();
    let body = IncidentUpdateRequest::new(
        IncidentUpdateData::new(incident_data_id.clone(), IncidentType::INCIDENTS).relationships(
            IncidentUpdateRelationships::new().commander_user(Some(
                NullableRelationshipToUser::new(Some(NullableRelationshipToUserData::new(
                    user_data_id.clone(),
                    UsersType::USERS,
                ))),
            )),
        ),
    );
    let mut configuration = datadog::Configuration::new();
    configuration.set_unstable_operation_enabled("v2.UpdateIncident", true);
    let api = IncidentsAPI::with_config(configuration);
    let resp = api
        .update_incident(
            incident_data_id.clone(),
            body,
            UpdateIncidentOptionalParams::default(),
        )
        .await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}
examples/v2_incidents_UpdateIncident.rs (lines 36-40)
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
async fn main() {
    // there is a valid "incident" in the system
    let incident_data_id = std::env::var("INCIDENT_DATA_ID").unwrap();
    let body = IncidentUpdateRequest::new(
        IncidentUpdateData::new(incident_data_id.clone(), IncidentType::INCIDENTS).attributes(
            IncidentUpdateAttributes::new()
                .fields(BTreeMap::from([(
                    "state".to_string(),
                    IncidentFieldAttributes::IncidentFieldAttributesSingleValue(Box::new(
                        IncidentFieldAttributesSingleValue::new()
                            .type_(IncidentFieldAttributesSingleValueType::DROPDOWN)
                            .value(Some("resolved".to_string())),
                    )),
                )]))
                .title("A test incident title-updated".to_string()),
        ),
    );
    let mut configuration = datadog::Configuration::new();
    configuration.set_unstable_operation_enabled("v2.UpdateIncident", true);
    let api = IncidentsAPI::with_config(configuration);
    let resp = api
        .update_incident(
            incident_data_id.clone(),
            body,
            UpdateIncidentOptionalParams::default(),
        )
        .await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}
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)
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
async fn main() {
    // there is a valid "incident" in the system
    let incident_data_id = std::env::var("INCIDENT_DATA_ID").unwrap();
    let body = IncidentAttachmentUpdateRequest::new(vec![IncidentAttachmentUpdateData::new(
        IncidentAttachmentType::INCIDENT_ATTACHMENTS,
    )
    .attributes(
        IncidentAttachmentUpdateAttributes::IncidentAttachmentLinkAttributes(Box::new(
            IncidentAttachmentLinkAttributes::new(
                IncidentAttachmentLinkAttributesAttachmentObject::new(
                    "https://www.example.com/doc".to_string(),
                    "Example-Incident".to_string(),
                ),
                IncidentAttachmentLinkAttachmentType::LINK,
            ),
        )),
    )]);
    let mut configuration = datadog::Configuration::new();
    configuration.set_unstable_operation_enabled("v2.UpdateIncidentAttachments", true);
    let api = IncidentsAPI::with_config(configuration);
    let resp = api
        .update_incident_attachments(
            incident_data_id.clone(),
            body,
            UpdateIncidentAttachmentsOptionalParams::default(),
        )
        .await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}
More examples
Hide additional examples
examples/v2_incidents_UpdateIncidentAttachments.rs (lines 50-54)
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
async fn main() {
    let body = IncidentAttachmentUpdateRequest::new(vec![
        IncidentAttachmentUpdateData::new(IncidentAttachmentType::INCIDENT_ATTACHMENTS)
            .attributes(
                IncidentAttachmentUpdateAttributes::IncidentAttachmentPostmortemAttributes(
                    Box::new(IncidentAttachmentPostmortemAttributes::new(
                        IncidentAttachmentsPostmortemAttributesAttachmentObject::new(
                            "https://app.datadoghq.com/notebook/123".to_string(),
                            "Postmortem IR-123".to_string(),
                        ),
                        IncidentAttachmentPostmortemAttachmentType::POSTMORTEM,
                    )),
                ),
            )
            .id("00000000-abcd-0002-0000-000000000000".to_string()),
        IncidentAttachmentUpdateData::new(IncidentAttachmentType::INCIDENT_ATTACHMENTS).attributes(
            IncidentAttachmentUpdateAttributes::IncidentAttachmentLinkAttributes(Box::new(
                IncidentAttachmentLinkAttributes::new(
                    IncidentAttachmentLinkAttributesAttachmentObject::new(
                        "https://www.example.com/webstore-failure-runbook".to_string(),
                        "Runbook for webstore service failures".to_string(),
                    ),
                    IncidentAttachmentLinkAttachmentType::LINK,
                ),
            )),
        ),
        IncidentAttachmentUpdateData::new(IncidentAttachmentType::INCIDENT_ATTACHMENTS)
            .id("00000000-abcd-0003-0000-000000000000".to_string()),
    ]);
    let mut configuration = datadog::Configuration::new();
    configuration.set_unstable_operation_enabled("v2.UpdateIncidentAttachments", true);
    let api = IncidentsAPI::with_config(configuration);
    let resp = api
        .update_incident_attachments(
            "incident_id".to_string(),
            body,
            UpdateIncidentAttachmentsOptionalParams::default(),
        )
        .await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}
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)
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
async fn main() {
    // there is a valid "incident" in the system
    let incident_data_id = std::env::var("INCIDENT_DATA_ID").unwrap();

    // the "incident" has an "incident_integration_metadata"
    let incident_integration_metadata_data_id =
        std::env::var("INCIDENT_INTEGRATION_METADATA_DATA_ID").unwrap();
    let body =
        IncidentIntegrationMetadataPatchRequest::new(IncidentIntegrationMetadataPatchData::new(
            IncidentIntegrationMetadataAttributes::new(
                1,
                IncidentIntegrationMetadataMetadata::SlackIntegrationMetadata(Box::new(
                    SlackIntegrationMetadata::new(vec![SlackIntegrationMetadataChannelItem::new(
                        "C0123456789".to_string(),
                        "#updated-channel-name".to_string(),
                        "https://slack.com/app_redirect?channel=C0123456789&team=T01234567"
                            .to_string(),
                    )
                    .team_id("T01234567".to_string())]),
                )),
            )
            .incident_id(incident_data_id.clone()),
            IncidentIntegrationMetadataType::INCIDENT_INTEGRATIONS,
        ));
    let mut configuration = datadog::Configuration::new();
    configuration.set_unstable_operation_enabled("v2.UpdateIncidentIntegration", true);
    let api = IncidentsAPI::with_config(configuration);
    let resp = api
        .update_incident_integration(
            incident_data_id.clone(),
            incident_integration_metadata_data_id.clone(),
            body,
        )
        .await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}
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)
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
async fn main() {
    // there is a valid "incident" in the system
    let incident_data_id = std::env::var("INCIDENT_DATA_ID").unwrap();

    // the "incident" has an "incident_todo"
    let incident_todo_data_id = std::env::var("INCIDENT_TODO_DATA_ID").unwrap();
    let body = IncidentTodoPatchRequest::new(IncidentTodoPatchData::new(
        IncidentTodoAttributes::new(
            vec![IncidentTodoAssignee::IncidentTodoAssigneeHandle(
                "@test.user@test.com".to_string(),
            )],
            "Restore lost data.".to_string(),
        )
        .completed(Some("2023-03-06T22:00:00.000000+00:00".to_string()))
        .due_date(Some("2023-07-10T05:00:00.000000+00:00".to_string())),
        IncidentTodoType::INCIDENT_TODOS,
    ));
    let mut configuration = datadog::Configuration::new();
    configuration.set_unstable_operation_enabled("v2.UpdateIncidentTodo", true);
    let api = IncidentsAPI::with_config(configuration);
    let resp = api
        .update_incident_todo(
            incident_data_id.clone(),
            incident_todo_data_id.clone(),
            body,
        )
        .await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}
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.

Trait Implementations§

source§

impl Clone for IncidentsAPI

source§

fn clone(&self) -> IncidentsAPI

Returns a copy 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, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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