"""
Delete a Workload Protection agent rule returns "OK" response
"""fromosimportenvironfromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v2.api.csm_threats_apiimportCSMThreatsApi# there is a valid "agent_rule_rc" in the systemAGENT_RULE_DATA_ID=environ["AGENT_RULE_DATA_ID"]# there is a valid "policy_rc" in the systemPOLICY_DATA_ID=environ["POLICY_DATA_ID"]configuration=Configuration()withApiClient(configuration)asapi_client:api_instance=CSMThreatsApi(api_client)api_instance.delete_csm_threats_agent_rule(agent_rule_id=AGENT_RULE_DATA_ID,policy_id=POLICY_DATA_ID,)
# Delete a Workload Protection agent rule returns "OK" responserequire"datadog_api_client"api_instance=DatadogAPIClient::V2::CSMThreatsAPI.new# there is a valid "agent_rule_rc" in the systemAGENT_RULE_DATA_ID=ENV["AGENT_RULE_DATA_ID"]# there is a valid "policy_rc" in the systemPOLICY_DATA_ID=ENV["POLICY_DATA_ID"]opts={policy_id:POLICY_DATA_ID,}api_instance.delete_csm_threats_agent_rule(AGENT_RULE_DATA_ID,opts)
// Delete a Workload Protection agent rule returns "OK" responsepackagemainimport("context""fmt""os""github.com/DataDog/datadog-api-client-go/v2/api/datadog""github.com/DataDog/datadog-api-client-go/v2/api/datadogV2")funcmain(){// there is a valid "agent_rule_rc" in the systemAgentRuleDataID:=os.Getenv("AGENT_RULE_DATA_ID")// there is a valid "policy_rc" in the systemPolicyDataID:=os.Getenv("POLICY_DATA_ID")ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()apiClient:=datadog.NewAPIClient(configuration)api:=datadogV2.NewCSMThreatsApi(apiClient)r,err:=api.DeleteCSMThreatsAgentRule(ctx,AgentRuleDataID,*datadogV2.NewDeleteCSMThreatsAgentRuleOptionalParameters().WithPolicyId(PolicyDataID))iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `CSMThreatsApi.DeleteCSMThreatsAgentRule`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}}
// Delete a Workload Protection agent rule returns "OK" responseimportcom.datadog.api.client.ApiClient;importcom.datadog.api.client.ApiException;importcom.datadog.api.client.v2.api.CsmThreatsApi;importcom.datadog.api.client.v2.api.CsmThreatsApi.DeleteCSMThreatsAgentRuleOptionalParameters;publicclassExample{publicstaticvoidmain(String[]args){ApiClientdefaultClient=ApiClient.getDefaultApiClient();CsmThreatsApiapiInstance=newCsmThreatsApi(defaultClient);// there is a valid "agent_rule_rc" in the systemStringAGENT_RULE_DATA_ID=System.getenv("AGENT_RULE_DATA_ID");// there is a valid "policy_rc" in the systemStringPOLICY_DATA_ID=System.getenv("POLICY_DATA_ID");try{apiInstance.deleteCSMThreatsAgentRule(AGENT_RULE_DATA_ID,newDeleteCSMThreatsAgentRuleOptionalParameters().policyId(POLICY_DATA_ID));}catch(ApiExceptione){System.err.println("Exception when calling CsmThreatsApi#deleteCSMThreatsAgentRule");System.err.println("Status code: "+e.getCode());System.err.println("Reason: "+e.getResponseBody());System.err.println("Response headers: "+e.getResponseHeaders());e.printStackTrace();}}}
// Delete a Workload Protection agent rule returns "OK" response
usedatadog_api_client::datadog;usedatadog_api_client::datadogV2::api_csm_threats::CSMThreatsAPI;usedatadog_api_client::datadogV2::api_csm_threats::DeleteCSMThreatsAgentRuleOptionalParams;#[tokio::main]asyncfnmain(){// there is a valid "agent_rule_rc" in the system
letagent_rule_data_id=std::env::var("AGENT_RULE_DATA_ID").unwrap();// there is a valid "policy_rc" in the system
letpolicy_data_id=std::env::var("POLICY_DATA_ID").unwrap();letconfiguration=datadog::Configuration::new();letapi=CSMThreatsAPI::with_config(configuration);letresp=api.delete_csm_threats_agent_rule(agent_rule_data_id.clone(),DeleteCSMThreatsAgentRuleOptionalParams::default().policy_id(policy_data_id.clone()),).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="<API-KEY>"DD_APP_KEY="<APP-KEY>"cargo run
/**
* Delete a Workload Protection agent rule returns "OK" response
*/import{client,v2}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv2.CSMThreatsApi(configuration);// there is a valid "agent_rule_rc" in the system
constAGENT_RULE_DATA_ID=process.env.AGENT_RULE_DATA_IDasstring;// there is a valid "policy_rc" in the system
constPOLICY_DATA_ID=process.env.POLICY_DATA_IDasstring;constparams: v2.CSMThreatsApiDeleteCSMThreatsAgentRuleRequest={agentRuleId: AGENT_RULE_DATA_ID,policyId: POLICY_DATA_ID,};apiInstance.deleteCSMThreatsAgentRule(params).then((data: any)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));