Struct datadog_api_client::datadogV2::api::api_incidents::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
impl IncidentsAPI
pub fn new() -> Self
sourcepub fn with_config(config: Configuration) -> Self
pub fn with_config(config: Configuration) -> Self
Examples found in repository?
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
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());
}
}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());
}
}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());
}
}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());
}
}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());
}
}
}- examples/v2_incidents_ListIncidentIntegrations.rs
- examples/v2_incidents_GetIncident.rs
- examples/v2_incidents_SearchIncidents_1931679109.rs
- examples/v2_incidents_ListIncidentAttachments_2457735435.rs
- examples/v2_incidents_GetIncidentTodo.rs
- examples/v2_incidents_DeleteIncidentTodo.rs
- examples/v2_incidents_GetIncidentIntegration.rs
- examples/v2_incidents_DeleteIncidentIntegration.rs
- examples/v2_incidents_CreateIncidentTodo.rs
- examples/v2_incidents_UpdateIncident_1009194038.rs
- examples/v2_incidents_UpdateIncident_3369341440.rs
- examples/v2_incidents_UpdateIncidentTodo.rs
- examples/v2_incidents_UpdateIncidentAttachments_3881702075.rs
- examples/v2_incidents_UpdateIncident.rs
- examples/v2_incidents_CreateIncident.rs
- examples/v2_incidents_CreateIncidentIntegration.rs
- examples/v2_incidents_UpdateIncidentIntegration.rs
- examples/v2_incidents_UpdateIncidentAttachments.rs
pub fn with_client_and_config( config: Configuration, client: ClientWithMiddleware, ) -> Self
sourcepub async fn create_incident(
&self,
body: IncidentCreateRequest,
) -> Result<IncidentResponse, Error<CreateIncidentError>>
pub async fn create_incident( &self, body: IncidentCreateRequest, ) -> Result<IncidentResponse, Error<CreateIncidentError>>
Create an incident.
Examples found in repository?
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());
}
}sourcepub async fn create_incident_with_http_info(
&self,
body: IncidentCreateRequest,
) -> Result<ResponseContent<IncidentResponse>, Error<CreateIncidentError>>
pub async fn create_incident_with_http_info( &self, body: IncidentCreateRequest, ) -> Result<ResponseContent<IncidentResponse>, Error<CreateIncidentError>>
Create an incident.
sourcepub async fn create_incident_integration(
&self,
incident_id: String,
body: IncidentIntegrationMetadataCreateRequest,
) -> Result<IncidentIntegrationMetadataResponse, Error<CreateIncidentIntegrationError>>
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?
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());
}
}sourcepub async fn create_incident_integration_with_http_info(
&self,
incident_id: String,
body: IncidentIntegrationMetadataCreateRequest,
) -> Result<ResponseContent<IncidentIntegrationMetadataResponse>, Error<CreateIncidentIntegrationError>>
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.
sourcepub async fn create_incident_todo(
&self,
incident_id: String,
body: IncidentTodoCreateRequest,
) -> Result<IncidentTodoResponse, Error<CreateIncidentTodoError>>
pub async fn create_incident_todo( &self, incident_id: String, body: IncidentTodoCreateRequest, ) -> Result<IncidentTodoResponse, Error<CreateIncidentTodoError>>
Create an incident todo.
Examples found in repository?
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());
}
}sourcepub async fn create_incident_todo_with_http_info(
&self,
incident_id: String,
body: IncidentTodoCreateRequest,
) -> Result<ResponseContent<IncidentTodoResponse>, Error<CreateIncidentTodoError>>
pub async fn create_incident_todo_with_http_info( &self, incident_id: String, body: IncidentTodoCreateRequest, ) -> Result<ResponseContent<IncidentTodoResponse>, Error<CreateIncidentTodoError>>
Create an incident todo.
sourcepub async fn delete_incident(
&self,
incident_id: String,
) -> Result<(), Error<DeleteIncidentError>>
pub async fn delete_incident( &self, incident_id: String, ) -> Result<(), Error<DeleteIncidentError>>
Deletes an existing incident from the users organization.
Examples found in repository?
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());
}
}sourcepub async fn delete_incident_with_http_info(
&self,
incident_id: String,
) -> Result<ResponseContent<()>, Error<DeleteIncidentError>>
pub async fn delete_incident_with_http_info( &self, incident_id: String, ) -> Result<ResponseContent<()>, Error<DeleteIncidentError>>
Deletes an existing incident from the users organization.
sourcepub async fn delete_incident_integration(
&self,
incident_id: String,
integration_metadata_id: String,
) -> Result<(), Error<DeleteIncidentIntegrationError>>
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?
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());
}
}sourcepub async fn delete_incident_integration_with_http_info(
&self,
incident_id: String,
integration_metadata_id: String,
) -> Result<ResponseContent<()>, Error<DeleteIncidentIntegrationError>>
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.
sourcepub async fn delete_incident_todo(
&self,
incident_id: String,
todo_id: String,
) -> Result<(), Error<DeleteIncidentTodoError>>
pub async fn delete_incident_todo( &self, incident_id: String, todo_id: String, ) -> Result<(), Error<DeleteIncidentTodoError>>
Delete an incident todo.
Examples found in repository?
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());
}
}sourcepub async fn delete_incident_todo_with_http_info(
&self,
incident_id: String,
todo_id: String,
) -> Result<ResponseContent<()>, Error<DeleteIncidentTodoError>>
pub async fn delete_incident_todo_with_http_info( &self, incident_id: String, todo_id: String, ) -> Result<ResponseContent<()>, Error<DeleteIncidentTodoError>>
Delete an incident todo.
sourcepub async fn get_incident(
&self,
incident_id: String,
params: GetIncidentOptionalParams,
) -> Result<IncidentResponse, Error<GetIncidentError>>
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?
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());
}
}sourcepub async fn get_incident_with_http_info(
&self,
incident_id: String,
params: GetIncidentOptionalParams,
) -> Result<ResponseContent<IncidentResponse>, Error<GetIncidentError>>
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.
sourcepub async fn get_incident_integration(
&self,
incident_id: String,
integration_metadata_id: String,
) -> Result<IncidentIntegrationMetadataResponse, Error<GetIncidentIntegrationError>>
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?
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());
}
}sourcepub async fn get_incident_integration_with_http_info(
&self,
incident_id: String,
integration_metadata_id: String,
) -> Result<ResponseContent<IncidentIntegrationMetadataResponse>, Error<GetIncidentIntegrationError>>
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.
sourcepub async fn get_incident_todo(
&self,
incident_id: String,
todo_id: String,
) -> Result<IncidentTodoResponse, Error<GetIncidentTodoError>>
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?
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());
}
}sourcepub async fn get_incident_todo_with_http_info(
&self,
incident_id: String,
todo_id: String,
) -> Result<ResponseContent<IncidentTodoResponse>, Error<GetIncidentTodoError>>
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.
sourcepub async fn list_incident_attachments(
&self,
incident_id: String,
params: ListIncidentAttachmentsOptionalParams,
) -> Result<IncidentAttachmentsResponse, Error<ListIncidentAttachmentsError>>
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?
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
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());
}
}sourcepub async fn list_incident_attachments_with_http_info(
&self,
incident_id: String,
params: ListIncidentAttachmentsOptionalParams,
) -> Result<ResponseContent<IncidentAttachmentsResponse>, Error<ListIncidentAttachmentsError>>
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.
sourcepub async fn list_incident_integrations(
&self,
incident_id: String,
) -> Result<IncidentIntegrationMetadataListResponse, Error<ListIncidentIntegrationsError>>
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?
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());
}
}sourcepub async fn list_incident_integrations_with_http_info(
&self,
incident_id: String,
) -> Result<ResponseContent<IncidentIntegrationMetadataListResponse>, Error<ListIncidentIntegrationsError>>
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.
sourcepub async fn list_incident_todos(
&self,
incident_id: String,
) -> Result<IncidentTodoListResponse, Error<ListIncidentTodosError>>
pub async fn list_incident_todos( &self, incident_id: String, ) -> Result<IncidentTodoListResponse, Error<ListIncidentTodosError>>
Get all todos for an incident.
Examples found in repository?
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());
}
}sourcepub async fn list_incident_todos_with_http_info(
&self,
incident_id: String,
) -> Result<ResponseContent<IncidentTodoListResponse>, Error<ListIncidentTodosError>>
pub async fn list_incident_todos_with_http_info( &self, incident_id: String, ) -> Result<ResponseContent<IncidentTodoListResponse>, Error<ListIncidentTodosError>>
Get all todos for an incident.
sourcepub async fn list_incidents(
&self,
params: ListIncidentsOptionalParams,
) -> Result<IncidentsResponse, Error<ListIncidentsError>>
pub async fn list_incidents( &self, params: ListIncidentsOptionalParams, ) -> Result<IncidentsResponse, Error<ListIncidentsError>>
Get all incidents for the user’s organization.
Examples found in repository?
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());
}
}sourcepub fn list_incidents_with_pagination(
&self,
params: ListIncidentsOptionalParams,
) -> impl Stream<Item = Result<IncidentResponseData, Error<ListIncidentsError>>> + '_
pub fn list_incidents_with_pagination( &self, params: ListIncidentsOptionalParams, ) -> impl Stream<Item = Result<IncidentResponseData, Error<ListIncidentsError>>> + '_
Examples found in repository?
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());
}
}
}sourcepub async fn list_incidents_with_http_info(
&self,
params: ListIncidentsOptionalParams,
) -> Result<ResponseContent<IncidentsResponse>, Error<ListIncidentsError>>
pub async fn list_incidents_with_http_info( &self, params: ListIncidentsOptionalParams, ) -> Result<ResponseContent<IncidentsResponse>, Error<ListIncidentsError>>
Get all incidents for the user’s organization.
sourcepub async fn search_incidents(
&self,
query: String,
params: SearchIncidentsOptionalParams,
) -> Result<IncidentSearchResponse, Error<SearchIncidentsError>>
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?
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());
}
}sourcepub fn search_incidents_with_pagination(
&self,
query: String,
params: SearchIncidentsOptionalParams,
) -> impl Stream<Item = Result<IncidentSearchResponseIncidentsData, Error<SearchIncidentsError>>> + '_
pub fn search_incidents_with_pagination( &self, query: String, params: SearchIncidentsOptionalParams, ) -> impl Stream<Item = Result<IncidentSearchResponseIncidentsData, Error<SearchIncidentsError>>> + '_
Examples found in repository?
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());
}
}
}sourcepub async fn search_incidents_with_http_info(
&self,
query: String,
params: SearchIncidentsOptionalParams,
) -> Result<ResponseContent<IncidentSearchResponse>, Error<SearchIncidentsError>>
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.
sourcepub async fn update_incident(
&self,
incident_id: String,
body: IncidentUpdateRequest,
params: UpdateIncidentOptionalParams,
) -> Result<IncidentResponse, Error<UpdateIncidentError>>
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?
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
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());
}
}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());
}
}sourcepub async fn update_incident_with_http_info(
&self,
incident_id: String,
body: IncidentUpdateRequest,
params: UpdateIncidentOptionalParams,
) -> Result<ResponseContent<IncidentResponse>, Error<UpdateIncidentError>>
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.
sourcepub async fn update_incident_attachments(
&self,
incident_id: String,
body: IncidentAttachmentUpdateRequest,
params: UpdateIncidentAttachmentsOptionalParams,
) -> Result<IncidentAttachmentUpdateResponse, Error<UpdateIncidentAttachmentsError>>
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?
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
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());
}
}sourcepub async fn update_incident_attachments_with_http_info(
&self,
incident_id: String,
body: IncidentAttachmentUpdateRequest,
params: UpdateIncidentAttachmentsOptionalParams,
) -> Result<ResponseContent<IncidentAttachmentUpdateResponse>, Error<UpdateIncidentAttachmentsError>>
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.
sourcepub async fn update_incident_integration(
&self,
incident_id: String,
integration_metadata_id: String,
body: IncidentIntegrationMetadataPatchRequest,
) -> Result<IncidentIntegrationMetadataResponse, Error<UpdateIncidentIntegrationError>>
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?
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());
}
}sourcepub async fn update_incident_integration_with_http_info(
&self,
incident_id: String,
integration_metadata_id: String,
body: IncidentIntegrationMetadataPatchRequest,
) -> Result<ResponseContent<IncidentIntegrationMetadataResponse>, Error<UpdateIncidentIntegrationError>>
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.
sourcepub async fn update_incident_todo(
&self,
incident_id: String,
todo_id: String,
body: IncidentTodoPatchRequest,
) -> Result<IncidentTodoResponse, Error<UpdateIncidentTodoError>>
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?
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());
}
}sourcepub async fn update_incident_todo_with_http_info(
&self,
incident_id: String,
todo_id: String,
body: IncidentTodoPatchRequest,
) -> Result<ResponseContent<IncidentTodoResponse>, Error<UpdateIncidentTodoError>>
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
impl Clone for IncidentsAPI
source§fn clone(&self) -> IncidentsAPI
fn clone(&self) -> IncidentsAPI
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl Debug for IncidentsAPI
impl Debug for IncidentsAPI
Auto Trait Implementations§
impl Freeze for IncidentsAPI
impl !RefUnwindSafe for IncidentsAPI
impl Send for IncidentsAPI
impl Sync for IncidentsAPI
impl Unpin for IncidentsAPI
impl !UnwindSafe for IncidentsAPI
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)