Replace the notification settings for the governance control with the given detection type,
setting, for each supported event type, whether notifications are enabled and which
destinations receive them.
This endpoint requires
all
of the following permissions:
governance_console_read
governance_console_write
引数
パスパラメーター
名前
タイプ
説明
detection_type [required]
string
The detection type that identifies the control; for example, unused_api_keys.
## default
#
# Path parameters exportdetection_type="unused_api_keys" # Use a Personal Access Token or Service Access Token exportDD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comuk1.datadoghq.comddog-gov.comus2.ddog-gov.com"DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"python3"example.py"
# Update control notification settings returns "OK" responserequire"datadog_api_client"DatadogAPIClient.configuredo|config|config.access_token=ENV["DD_BEARER_TOKEN"]config.unstable_operations["v2.update_governance_control_notification_settings".to_sym]=trueendapi_instance=DatadogAPIClient::V2::GovernanceConsoleAPI.newbody=DatadogAPIClient::V2::ControlNotificationSettingsUpdateRequest.new({data:DatadogAPIClient::V2::ControlNotificationSettingsUpdateData.new({attributes:DatadogAPIClient::V2::ControlNotificationSettingsUpdateAttributes.new({event_settings:[DatadogAPIClient::V2::ControlNotificationEventSetting.new({enabled:true,event_type:"new_detection",targets:[DatadogAPIClient::V2::ControlNotificationTarget.new({handle:"#governance-alerts",type:DatadogAPIClient::V2::ControlNotificationTargetType::SLACK,}),],}),],}),type:DatadogAPIClient::V2::ControlNotificationSettingsResourceType::CONTROL_NOTIFICATION_SETTINGS,}),})papi_instance.update_governance_control_notification_settings("detection_type",body)
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comuk1.datadoghq.comddog-gov.comus2.ddog-gov.com"DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"rb"example.rb"
// Update control notification settings returns "OK" responsepackagemainimport("context""encoding/json""fmt""os""github.com/DataDog/datadog-api-client-go/v2/api/datadog""github.com/DataDog/datadog-api-client-go/v2/api/datadogV2")funcmain(){body:=datadogV2.ControlNotificationSettingsUpdateRequest{Data:datadogV2.ControlNotificationSettingsUpdateData{Attributes:&datadogV2.ControlNotificationSettingsUpdateAttributes{EventSettings:[]datadogV2.ControlNotificationEventSetting{{Enabled:true,EventType:"new_detection",Targets:[]datadogV2.ControlNotificationTarget{{Handle:"#governance-alerts",Type:datadogV2.CONTROLNOTIFICATIONTARGETTYPE_SLACK,},},},},},Type:datadogV2.CONTROLNOTIFICATIONSETTINGSRESOURCETYPE_CONTROL_NOTIFICATION_SETTINGS,},}ctx:=datadog.NewDefaultContext(context.Background())ctx=context.WithValue(ctx,datadog.ContextAccessToken,os.Getenv("DD_BEARER_TOKEN"))configuration:=datadog.NewConfiguration()configuration.SetUnstableOperationEnabled("v2.UpdateGovernanceControlNotificationSettings",true)apiClient:=datadog.NewAPIClient(configuration)api:=datadogV2.NewGovernanceConsoleApi(apiClient)resp,r,err:=api.UpdateGovernanceControlNotificationSettings(ctx,"detection_type",body)iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `GovernanceConsoleApi.UpdateGovernanceControlNotificationSettings`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}responseContent,_:=json.MarshalIndent(resp,""," ")fmt.Fprintf(os.Stdout,"Response from `GovernanceConsoleApi.UpdateGovernanceControlNotificationSettings`:\n%s\n",responseContent)}
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comuk1.datadoghq.comddog-gov.comus2.ddog-gov.com"DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"go run"main.go"
// Update control notification settings returns "OK" responseimportcom.datadog.api.client.ApiClient;importcom.datadog.api.client.ApiException;importcom.datadog.api.client.v2.api.GovernanceConsoleApi;importcom.datadog.api.client.v2.model.ControlNotificationEventSetting;importcom.datadog.api.client.v2.model.ControlNotificationSettingsResourceType;importcom.datadog.api.client.v2.model.ControlNotificationSettingsResponse;importcom.datadog.api.client.v2.model.ControlNotificationSettingsUpdateAttributes;importcom.datadog.api.client.v2.model.ControlNotificationSettingsUpdateData;importcom.datadog.api.client.v2.model.ControlNotificationSettingsUpdateRequest;importcom.datadog.api.client.v2.model.ControlNotificationTarget;importcom.datadog.api.client.v2.model.ControlNotificationTargetType;importjava.util.Collections;publicclassExample{publicstaticvoidmain(String[]args){ApiClientdefaultClient=ApiClient.getDefaultApiClient();defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN"));defaultClient.setUnstableOperationEnabled("v2.updateGovernanceControlNotificationSettings",true);GovernanceConsoleApiapiInstance=newGovernanceConsoleApi(defaultClient);ControlNotificationSettingsUpdateRequestbody=newControlNotificationSettingsUpdateRequest().data(newControlNotificationSettingsUpdateData().attributes(newControlNotificationSettingsUpdateAttributes().eventSettings(Collections.singletonList(newControlNotificationEventSetting().enabled(true).eventType("new_detection").targets(Collections.singletonList(newControlNotificationTarget().handle("#governance-alerts").type(ControlNotificationTargetType.SLACK)))))).type(ControlNotificationSettingsResourceType.CONTROL_NOTIFICATION_SETTINGS));try{ControlNotificationSettingsResponseresult=apiInstance.updateGovernanceControlNotificationSettings("unused_api_keys",body);System.out.println(result);}catch(ApiExceptione){System.err.println("Exception when calling"+" GovernanceConsoleApi#updateGovernanceControlNotificationSettings");System.err.println("Status code: "+e.getCode());System.err.println("Reason: "+e.getResponseBody());System.err.println("Response headers: "+e.getResponseHeaders());e.printStackTrace();}}}
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comuk1.datadoghq.comddog-gov.comus2.ddog-gov.com"DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"java"Example.java"
// Update control notification settings returns "OK" response
usedatadog_api_client::datadog;usedatadog_api_client::datadogV2::api_governance_console::GovernanceConsoleAPI;usedatadog_api_client::datadogV2::model::ControlNotificationEventSetting;usedatadog_api_client::datadogV2::model::ControlNotificationSettingsResourceType;usedatadog_api_client::datadogV2::model::ControlNotificationSettingsUpdateAttributes;usedatadog_api_client::datadogV2::model::ControlNotificationSettingsUpdateData;usedatadog_api_client::datadogV2::model::ControlNotificationSettingsUpdateRequest;usedatadog_api_client::datadogV2::model::ControlNotificationTarget;usedatadog_api_client::datadogV2::model::ControlNotificationTargetType;#[tokio::main]asyncfnmain(){letbody=ControlNotificationSettingsUpdateRequest::new(ControlNotificationSettingsUpdateData::new(ControlNotificationSettingsResourceType::CONTROL_NOTIFICATION_SETTINGS,).attributes(ControlNotificationSettingsUpdateAttributes::new().event_settings(vec![ControlNotificationEventSetting::new(true,"new_detection".to_string(),vec![ControlNotificationTarget::new("#governance-alerts".to_string(),ControlNotificationTargetType::SLACK,)],),]),),);letmutconfiguration=datadog::Configuration::new();configuration.set_unstable_operation_enabled("v2.UpdateGovernanceControlNotificationSettings",true);letapi=GovernanceConsoleAPI::with_config(configuration);letresp=api.update_governance_control_notification_settings("detection_type".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.comuk1.datadoghq.comddog-gov.comus2.ddog-gov.com"DD_API_KEY="<DD_API_KEY>"DD_APP_KEY="<DD_APP_KEY>"cargo run
/**
* Update control notification settings returns "OK" response
*/import{client,v2}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration({authMethods:{AuthZ:{accessToken: process.env.DD_BEARER_TOKENasstring,},},});configuration.unstableOperations["v2.updateGovernanceControlNotificationSettings"]=true;constapiInstance=newv2.GovernanceConsoleApi(configuration);constparams: v2.GovernanceConsoleApiUpdateGovernanceControlNotificationSettingsRequest={body:{data:{attributes:{eventSettings:[{enabled: true,eventType:"new_detection",targets:[{handle:"#governance-alerts",type:"slack",},],},],},type:"control_notification_settings",},},detectionType:"detection_type",};apiInstance.updateGovernanceControlNotificationSettings(params).then((data: v2.ControlNotificationSettingsResponse)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comuk1.datadoghq.comddog-gov.comus2.ddog-gov.com"DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"tsc"example.ts"
パーソナライズされたデモをリクエスト
Datadog を始める
Ask AI
AI-generated responses may be inaccurate. Verify important info.