"""
Update a notification rule returns "No Content" response
"""fromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v2.api.case_management_apiimportCaseManagementApifromdatadog_api_client.v2.model.case_notification_rule_attributesimportCaseNotificationRuleAttributesfromdatadog_api_client.v2.model.case_notification_rule_recipientimportCaseNotificationRuleRecipientfromdatadog_api_client.v2.model.case_notification_rule_recipient_dataimportCaseNotificationRuleRecipientDatafromdatadog_api_client.v2.model.case_notification_rule_resource_typeimportCaseNotificationRuleResourceTypefromdatadog_api_client.v2.model.case_notification_rule_triggerimportCaseNotificationRuleTriggerfromdatadog_api_client.v2.model.case_notification_rule_trigger_dataimportCaseNotificationRuleTriggerDatafromdatadog_api_client.v2.model.case_notification_rule_updateimportCaseNotificationRuleUpdatefromdatadog_api_client.v2.model.case_notification_rule_update_requestimportCaseNotificationRuleUpdateRequestbody=CaseNotificationRuleUpdateRequest(data=CaseNotificationRuleUpdate(attributes=CaseNotificationRuleAttributes(recipients=[CaseNotificationRuleRecipient(data=CaseNotificationRuleRecipientData(),type="EMAIL",),],triggers=[CaseNotificationRuleTrigger(data=CaseNotificationRuleTriggerData(),type="CASE_CREATED",),],),type=CaseNotificationRuleResourceType.NOTIFICATION_RULE,),)configuration=Configuration()withApiClient(configuration)asapi_client:api_instance=CaseManagementApi(api_client)api_instance.update_project_notification_rule(project_id="project_id",notification_rule_id="notification_rule_id",body=body)
# Update a notification rule returns "No Content" responserequire"datadog_api_client"api_instance=DatadogAPIClient::V2::CaseManagementAPI.newbody=DatadogAPIClient::V2::CaseNotificationRuleUpdateRequest.new({data:DatadogAPIClient::V2::CaseNotificationRuleUpdate.new({attributes:DatadogAPIClient::V2::CaseNotificationRuleAttributes.new({recipients:[DatadogAPIClient::V2::CaseNotificationRuleRecipient.new({data:DatadogAPIClient::V2::CaseNotificationRuleRecipientData.new({}),type:"EMAIL",}),],triggers:[DatadogAPIClient::V2::CaseNotificationRuleTrigger.new({data:DatadogAPIClient::V2::CaseNotificationRuleTriggerData.new({}),type:"CASE_CREATED",}),],}),type:DatadogAPIClient::V2::CaseNotificationRuleResourceType::NOTIFICATION_RULE,}),})api_instance.update_project_notification_rule("project_id","notification_rule_id",body)
// Update a notification rule returns "No Content" response
usedatadog_api_client::datadog;usedatadog_api_client::datadogV2::api_case_management::CaseManagementAPI;usedatadog_api_client::datadogV2::model::CaseNotificationRuleAttributes;usedatadog_api_client::datadogV2::model::CaseNotificationRuleRecipient;usedatadog_api_client::datadogV2::model::CaseNotificationRuleRecipientData;usedatadog_api_client::datadogV2::model::CaseNotificationRuleResourceType;usedatadog_api_client::datadogV2::model::CaseNotificationRuleTrigger;usedatadog_api_client::datadogV2::model::CaseNotificationRuleTriggerData;usedatadog_api_client::datadogV2::model::CaseNotificationRuleUpdate;usedatadog_api_client::datadogV2::model::CaseNotificationRuleUpdateRequest;#[tokio::main]asyncfnmain(){letbody=CaseNotificationRuleUpdateRequest::new(CaseNotificationRuleUpdate::new(CaseNotificationRuleResourceType::NOTIFICATION_RULE).attributes(CaseNotificationRuleAttributes::new().recipients(vec![CaseNotificationRuleRecipient::new().data(CaseNotificationRuleRecipientData::new()).type_("EMAIL".to_string())]).triggers(vec![CaseNotificationRuleTrigger::new().data(CaseNotificationRuleTriggerData::new()).type_("CASE_CREATED".to_string())]),),);letconfiguration=datadog::Configuration::new();letapi=CaseManagementAPI::with_config(configuration);letresp=api.update_project_notification_rule("project_id".to_string(),"notification_rule_id".to_string(),body,).await;ifletOk(value)=resp{println!("{:#?}",value);}else{println!("{:#?}",resp.unwrap_err());}}
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com"DD_API_KEY="<DD_API_KEY>"DD_APP_KEY="<DD_APP_KEY>"cargo run
/**
* Update a notification rule returns "No Content" response
*/import{client,v2}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv2.CaseManagementApi(configuration);constparams: v2.CaseManagementApiUpdateProjectNotificationRuleRequest={body:{data:{attributes:{recipients:[{data:{},type:"EMAIL",},],triggers:[{data:{},type:"CASE_CREATED",},],},type:"notification_rule",},},projectId:"project_id",notificationRuleId:"notification_rule_id",};apiInstance.updateProjectNotificationRule(params).then((data: any)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));