#[non_exhaustive]pub struct IncidentCreateData {
pub attributes: IncidentCreateAttributes,
pub relationships: Option<IncidentCreateRelationships>,
pub type_: IncidentType,
pub additional_properties: BTreeMap<String, Value>,
/* private fields */
}
Expand description
Incident data for a create request.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.attributes: IncidentCreateAttributes
The incident’s attributes for a create request.
relationships: Option<IncidentCreateRelationships>
The relationships the incident will have with other resources once created.
type_: IncidentType
Incident resource type.
additional_properties: BTreeMap<String, Value>
Implementations§
Source§impl IncidentCreateData
impl IncidentCreateData
Sourcepub fn new(
attributes: IncidentCreateAttributes,
type_: IncidentType,
) -> IncidentCreateData
pub fn new( attributes: IncidentCreateAttributes, type_: IncidentType, ) -> IncidentCreateData
Examples found in repository?
examples/v2_incidents_CreateIncident.rs (lines 22-34)
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}
Sourcepub fn relationships(self, value: IncidentCreateRelationships) -> Self
pub fn relationships(self, value: IncidentCreateRelationships) -> Self
Examples found in repository?
examples/v2_incidents_CreateIncident.rs (lines 35-40)
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}
pub fn additional_properties(self, value: BTreeMap<String, Value>) -> Self
Trait Implementations§
Source§impl Clone for IncidentCreateData
impl Clone for IncidentCreateData
Source§fn clone(&self) -> IncidentCreateData
fn clone(&self) -> IncidentCreateData
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for IncidentCreateData
impl Debug for IncidentCreateData
Source§impl<'de> Deserialize<'de> for IncidentCreateData
impl<'de> Deserialize<'de> for IncidentCreateData
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for IncidentCreateData
impl PartialEq for IncidentCreateData
Source§impl Serialize for IncidentCreateData
impl Serialize for IncidentCreateData
impl StructuralPartialEq for IncidentCreateData
Auto Trait Implementations§
impl Freeze for IncidentCreateData
impl RefUnwindSafe for IncidentCreateData
impl Send for IncidentCreateData
impl Sync for IncidentCreateData
impl Unpin for IncidentCreateData
impl UnwindSafe for IncidentCreateData
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
Mutably borrows from an owned value. Read more