This page is not yet available in Spanish. We are working on its translation. If you have any questions or feedback about our current translation project, feel free to reach out to us!
Service Scorecards
API to create and update scorecard rules and outcomes. See Service Scorecards for more information.
This feature is currently in BETA. If you have any feedback, contact Datadog support.
// Create a new rule returns "Created" response
packagemainimport("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.CreateRuleRequest{Data:&datadogV2.CreateRuleRequestData{Attributes:&datadogV2.RuleAttributes{Enabled:datadog.PtrBool(true),Name:datadog.PtrString("Example-Service-Scorecard"),ScorecardName:datadog.PtrString("Observability Best Practices"),},Type:datadogV2.RULETYPE_RULE.Ptr(),},}ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()configuration.SetUnstableOperationEnabled("v2.CreateScorecardRule",true)apiClient:=datadog.NewAPIClient(configuration)api:=datadogV2.NewServiceScorecardsApi(apiClient)resp,r,err:=api.CreateScorecardRule(ctx,body)iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `ServiceScorecardsApi.CreateScorecardRule`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}responseContent,_:=json.MarshalIndent(resp,""," ")fmt.Fprintf(os.Stdout,"Response from `ServiceScorecardsApi.CreateScorecardRule`:\n%s\n",responseContent)}
// Create a new rule returns "Created" responseimportcom.datadog.api.client.ApiClient;importcom.datadog.api.client.ApiException;importcom.datadog.api.client.v2.api.ServiceScorecardsApi;importcom.datadog.api.client.v2.model.CreateRuleRequest;importcom.datadog.api.client.v2.model.CreateRuleRequestData;importcom.datadog.api.client.v2.model.CreateRuleResponse;importcom.datadog.api.client.v2.model.RuleAttributes;importcom.datadog.api.client.v2.model.RuleType;publicclassExample{publicstaticvoidmain(String[]args){ApiClientdefaultClient=ApiClient.getDefaultApiClient();defaultClient.setUnstableOperationEnabled("v2.createScorecardRule",true);ServiceScorecardsApiapiInstance=newServiceScorecardsApi(defaultClient);CreateRuleRequestbody=newCreateRuleRequest().data(newCreateRuleRequestData().attributes(newRuleAttributes().enabled(true).name("Example-Service-Scorecard").scorecardName("Observability Best Practices")).type(RuleType.RULE));try{CreateRuleResponseresult=apiInstance.createScorecardRule(body);System.out.println(result);}catch(ApiExceptione){System.err.println("Exception when calling ServiceScorecardsApi#createScorecardRule");System.err.println("Status code: "+e.getCode());System.err.println("Reason: "+e.getResponseBody());System.err.println("Response headers: "+e.getResponseHeaders());e.printStackTrace();}}}
"""
Create a new rule returns "Created" response
"""fromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v2.api.service_scorecards_apiimportServiceScorecardsApifromdatadog_api_client.v2.model.create_rule_requestimportCreateRuleRequestfromdatadog_api_client.v2.model.create_rule_request_dataimportCreateRuleRequestDatafromdatadog_api_client.v2.model.rule_attributesimportRuleAttributesfromdatadog_api_client.v2.model.rule_typeimportRuleTypebody=CreateRuleRequest(data=CreateRuleRequestData(attributes=RuleAttributes(enabled=True,name="Example-Service-Scorecard",scorecard_name="Observability Best Practices",),type=RuleType.RULE,),)configuration=Configuration()configuration.unstable_operations["create_scorecard_rule"]=TruewithApiClient(configuration)asapi_client:api_instance=ServiceScorecardsApi(api_client)response=api_instance.create_scorecard_rule(body=body)print(response)
# Create a new rule returns "Created" responserequire"datadog_api_client"DatadogAPIClient.configuredo|config|config.unstable_operations["v2.create_scorecard_rule".to_sym]=trueendapi_instance=DatadogAPIClient::V2::ServiceScorecardsAPI.newbody=DatadogAPIClient::V2::CreateRuleRequest.new({data:DatadogAPIClient::V2::CreateRuleRequestData.new({attributes:DatadogAPIClient::V2::RuleAttributes.new({enabled:true,name:"Example-Service-Scorecard",scorecard_name:"Observability Best Practices",}),type:DatadogAPIClient::V2::RuleType::RULE,}),})papi_instance.create_scorecard_rule(body)
// Create a new rule returns "Created" response
usedatadog_api_client::datadog;usedatadog_api_client::datadogV2::api_service_scorecards::ServiceScorecardsAPI;usedatadog_api_client::datadogV2::model::CreateRuleRequest;usedatadog_api_client::datadogV2::model::CreateRuleRequestData;usedatadog_api_client::datadogV2::model::RuleAttributes;usedatadog_api_client::datadogV2::model::RuleType;#[tokio::main]asyncfnmain(){letbody=CreateRuleRequest::new().data(CreateRuleRequestData::new().attributes(RuleAttributes::new().enabled(true).name("Example-Service-Scorecard".to_string()).scorecard_name("Observability Best Practices".to_string()),).type_(RuleType::RULE),);letmutconfiguration=datadog::Configuration::new();configuration.set_unstable_operation_enabled("v2.CreateScorecardRule",true);letapi=ServiceScorecardsAPI::with_config(configuration);letresp=api.create_scorecard_rule(body).await;ifletOk(value)=resp{println!("{:#?}",value);}else{println!("{:#?}",resp.unwrap_err());}}
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com"DD_API_KEY="<DD_API_KEY>"DD_APP_KEY="<DD_APP_KEY>"cargo run
/**
* Create a new rule returns "Created" response
*/import{client,v2}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();configuration.unstableOperations["v2.createScorecardRule"]=true;constapiInstance=newv2.ServiceScorecardsApi(configuration);constparams: v2.ServiceScorecardsApiCreateScorecardRuleRequest={body:{data:{attributes:{enabled: true,name:"Example-Service-Scorecard",scorecardName:"Observability Best Practices",},type:"rule",},},};apiInstance.createScorecardRule(params).then((data: v2.CreateRuleResponse)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));
// Create outcomes batch returns "OK" response
packagemainimport("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(){// there is a valid "create_scorecard_rule" in the system
CreateScorecardRuleDataID:=os.Getenv("CREATE_SCORECARD_RULE_DATA_ID")body:=datadogV2.OutcomesBatchRequest{Data:&datadogV2.OutcomesBatchRequestData{Attributes:&datadogV2.OutcomesBatchAttributes{Results:[]datadogV2.OutcomesBatchRequestItem{{Remarks:datadog.PtrString(`See: <a href="https://app.datadoghq.com/services">Services</a>`),RuleId:CreateScorecardRuleDataID,ServiceName:"my-service",State:datadogV2.STATE_PASS,},},},Type:datadogV2.OUTCOMESBATCHTYPE_BATCHED_OUTCOME.Ptr(),},}ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()configuration.SetUnstableOperationEnabled("v2.CreateScorecardOutcomesBatch",true)apiClient:=datadog.NewAPIClient(configuration)api:=datadogV2.NewServiceScorecardsApi(apiClient)resp,r,err:=api.CreateScorecardOutcomesBatch(ctx,body)iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `ServiceScorecardsApi.CreateScorecardOutcomesBatch`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}responseContent,_:=json.MarshalIndent(resp,""," ")fmt.Fprintf(os.Stdout,"Response from `ServiceScorecardsApi.CreateScorecardOutcomesBatch`:\n%s\n",responseContent)}
// Create outcomes batch returns "OK" responseimportcom.datadog.api.client.ApiClient;importcom.datadog.api.client.ApiException;importcom.datadog.api.client.v2.api.ServiceScorecardsApi;importcom.datadog.api.client.v2.model.OutcomesBatchAttributes;importcom.datadog.api.client.v2.model.OutcomesBatchRequest;importcom.datadog.api.client.v2.model.OutcomesBatchRequestData;importcom.datadog.api.client.v2.model.OutcomesBatchRequestItem;importcom.datadog.api.client.v2.model.OutcomesBatchResponse;importcom.datadog.api.client.v2.model.OutcomesBatchType;importcom.datadog.api.client.v2.model.State;importjava.util.Collections;publicclassExample{publicstaticvoidmain(String[]args){ApiClientdefaultClient=ApiClient.getDefaultApiClient();defaultClient.setUnstableOperationEnabled("v2.createScorecardOutcomesBatch",true);ServiceScorecardsApiapiInstance=newServiceScorecardsApi(defaultClient);// there is a valid "create_scorecard_rule" in the systemStringCREATE_SCORECARD_RULE_DATA_ID=System.getenv("CREATE_SCORECARD_RULE_DATA_ID");OutcomesBatchRequestbody=newOutcomesBatchRequest().data(newOutcomesBatchRequestData().attributes(newOutcomesBatchAttributes().results(Collections.singletonList(newOutcomesBatchRequestItem().remarks("""
See: <a href="https://app.datadoghq.com/services">Services</a>
""").ruleId(CREATE_SCORECARD_RULE_DATA_ID).serviceName("my-service").state(State.PASS)))).type(OutcomesBatchType.BATCHED_OUTCOME));try{OutcomesBatchResponseresult=apiInstance.createScorecardOutcomesBatch(body);System.out.println(result);}catch(ApiExceptione){System.err.println("Exception when calling ServiceScorecardsApi#createScorecardOutcomesBatch");System.err.println("Status code: "+e.getCode());System.err.println("Reason: "+e.getResponseBody());System.err.println("Response headers: "+e.getResponseHeaders());e.printStackTrace();}}}
"""
Create outcomes batch returns "OK" response
"""fromosimportenvironfromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v2.api.service_scorecards_apiimportServiceScorecardsApifromdatadog_api_client.v2.model.outcomes_batch_attributesimportOutcomesBatchAttributesfromdatadog_api_client.v2.model.outcomes_batch_requestimportOutcomesBatchRequestfromdatadog_api_client.v2.model.outcomes_batch_request_dataimportOutcomesBatchRequestDatafromdatadog_api_client.v2.model.outcomes_batch_request_itemimportOutcomesBatchRequestItemfromdatadog_api_client.v2.model.outcomes_batch_typeimportOutcomesBatchTypefromdatadog_api_client.v2.model.stateimportState# there is a valid "create_scorecard_rule" in the systemCREATE_SCORECARD_RULE_DATA_ID=environ["CREATE_SCORECARD_RULE_DATA_ID"]body=OutcomesBatchRequest(data=OutcomesBatchRequestData(attributes=OutcomesBatchAttributes(results=[OutcomesBatchRequestItem(remarks='See: <a href="https://app.datadoghq.com/services">Services</a>',rule_id=CREATE_SCORECARD_RULE_DATA_ID,service_name="my-service",state=State.PASS,),],),type=OutcomesBatchType.BATCHED_OUTCOME,),)configuration=Configuration()configuration.unstable_operations["create_scorecard_outcomes_batch"]=TruewithApiClient(configuration)asapi_client:api_instance=ServiceScorecardsApi(api_client)response=api_instance.create_scorecard_outcomes_batch(body=body)print(response)
# Create outcomes batch returns "OK" responserequire"datadog_api_client"DatadogAPIClient.configuredo|config|config.unstable_operations["v2.create_scorecard_outcomes_batch".to_sym]=trueendapi_instance=DatadogAPIClient::V2::ServiceScorecardsAPI.new# there is a valid "create_scorecard_rule" in the systemCREATE_SCORECARD_RULE_DATA_ID=ENV["CREATE_SCORECARD_RULE_DATA_ID"]body=DatadogAPIClient::V2::OutcomesBatchRequest.new({data:DatadogAPIClient::V2::OutcomesBatchRequestData.new({attributes:DatadogAPIClient::V2::OutcomesBatchAttributes.new({results:[DatadogAPIClient::V2::OutcomesBatchRequestItem.new({remarks:'See: <a href="https://app.datadoghq.com/services">Services</a>',rule_id:CREATE_SCORECARD_RULE_DATA_ID,service_name:"my-service",state:DatadogAPIClient::V2::State::PASS,}),],}),type:DatadogAPIClient::V2::OutcomesBatchType::BATCHED_OUTCOME,}),})papi_instance.create_scorecard_outcomes_batch(body)
// Create outcomes batch returns "OK" response
usedatadog_api_client::datadog;usedatadog_api_client::datadogV2::api_service_scorecards::ServiceScorecardsAPI;usedatadog_api_client::datadogV2::model::OutcomesBatchAttributes;usedatadog_api_client::datadogV2::model::OutcomesBatchRequest;usedatadog_api_client::datadogV2::model::OutcomesBatchRequestData;usedatadog_api_client::datadogV2::model::OutcomesBatchRequestItem;usedatadog_api_client::datadogV2::model::OutcomesBatchType;usedatadog_api_client::datadogV2::model::State;#[tokio::main]asyncfnmain(){// there is a valid "create_scorecard_rule" in the system
letcreate_scorecard_rule_data_id=std::env::var("CREATE_SCORECARD_RULE_DATA_ID").unwrap();letbody=OutcomesBatchRequest::new().data(OutcomesBatchRequestData::new().attributes(OutcomesBatchAttributes::new().results(vec![OutcomesBatchRequestItem::new(create_scorecard_rule_data_id.clone(),"my-service".to_string(),State::PASS,).remarks(r#"See: <a href="https://app.datadoghq.com/services">Services</a>"#.to_string(),)]),).type_(OutcomesBatchType::BATCHED_OUTCOME),);letmutconfiguration=datadog::Configuration::new();configuration.set_unstable_operation_enabled("v2.CreateScorecardOutcomesBatch",true);letapi=ServiceScorecardsAPI::with_config(configuration);letresp=api.create_scorecard_outcomes_batch(body).await;ifletOk(value)=resp{println!("{:#?}",value);}else{println!("{:#?}",resp.unwrap_err());}}
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com"DD_API_KEY="<DD_API_KEY>"DD_APP_KEY="<DD_APP_KEY>"cargo run
/**
* Create outcomes batch returns "OK" response
*/import{client,v2}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();configuration.unstableOperations["v2.createScorecardOutcomesBatch"]=true;constapiInstance=newv2.ServiceScorecardsApi(configuration);// there is a valid "create_scorecard_rule" in the system
constCREATE_SCORECARD_RULE_DATA_ID=process.env.CREATE_SCORECARD_RULE_DATA_IDasstring;constparams: v2.ServiceScorecardsApiCreateScorecardOutcomesBatchRequest={body:{data:{attributes:{results:[{remarks:`See: <a href="https://app.datadoghq.com/services">Services</a>`,ruleId: CREATE_SCORECARD_RULE_DATA_ID,serviceName:"my-service",state:"pass",},],},type:"batched-outcome",},},};apiInstance.createScorecardOutcomesBatch(params).then((data: v2.OutcomesBatchResponse)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));
"""
List all rule outcomes returns "OK" response
"""fromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v2.api.service_scorecards_apiimportServiceScorecardsApiconfiguration=Configuration()configuration.unstable_operations["list_scorecard_outcomes"]=TruewithApiClient(configuration)asapi_client:api_instance=ServiceScorecardsApi(api_client)response=api_instance.list_scorecard_outcomes()print(response)
# List all rule outcomes returns "OK" responserequire"datadog_api_client"DatadogAPIClient.configuredo|config|config.unstable_operations["v2.list_scorecard_outcomes".to_sym]=trueendapi_instance=DatadogAPIClient::V2::ServiceScorecardsAPI.newpapi_instance.list_scorecard_outcomes()
// List all rule outcomes returns "OK" response
packagemainimport("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(){ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()configuration.SetUnstableOperationEnabled("v2.ListScorecardOutcomes",true)apiClient:=datadog.NewAPIClient(configuration)api:=datadogV2.NewServiceScorecardsApi(apiClient)resp,r,err:=api.ListScorecardOutcomes(ctx,*datadogV2.NewListScorecardOutcomesOptionalParameters())iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `ServiceScorecardsApi.ListScorecardOutcomes`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}responseContent,_:=json.MarshalIndent(resp,""," ")fmt.Fprintf(os.Stdout,"Response from `ServiceScorecardsApi.ListScorecardOutcomes`:\n%s\n",responseContent)}
// List all rule outcomes returns "OK" response
usedatadog_api_client::datadog;usedatadog_api_client::datadogV2::api_service_scorecards::ListScorecardOutcomesOptionalParams;usedatadog_api_client::datadogV2::api_service_scorecards::ServiceScorecardsAPI;#[tokio::main]asyncfnmain(){letmutconfiguration=datadog::Configuration::new();configuration.set_unstable_operation_enabled("v2.ListScorecardOutcomes",true);letapi=ServiceScorecardsAPI::with_config(configuration);letresp=api.list_scorecard_outcomes(ListScorecardOutcomesOptionalParams::default()).await;ifletOk(value)=resp{println!("{:#?}",value);}else{println!("{:#?}",resp.unwrap_err());}}
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com"DD_API_KEY="<DD_API_KEY>"DD_APP_KEY="<DD_APP_KEY>"cargo run
/**
* List all rule outcomes returns "OK" response
*/import{client,v2}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();configuration.unstableOperations["v2.listScorecardOutcomes"]=true;constapiInstance=newv2.ServiceScorecardsApi(configuration);apiInstance.listScorecardOutcomes().then((data: v2.OutcomesResponse)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));
"""
List all rules returns "OK" response
"""fromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v2.api.service_scorecards_apiimportServiceScorecardsApiconfiguration=Configuration()configuration.unstable_operations["list_scorecard_rules"]=TruewithApiClient(configuration)asapi_client:api_instance=ServiceScorecardsApi(api_client)response=api_instance.list_scorecard_rules()print(response)
# List all rules returns "OK" responserequire"datadog_api_client"DatadogAPIClient.configuredo|config|config.unstable_operations["v2.list_scorecard_rules".to_sym]=trueendapi_instance=DatadogAPIClient::V2::ServiceScorecardsAPI.newpapi_instance.list_scorecard_rules()
// List all rules returns "OK" response
packagemainimport("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(){ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()configuration.SetUnstableOperationEnabled("v2.ListScorecardRules",true)apiClient:=datadog.NewAPIClient(configuration)api:=datadogV2.NewServiceScorecardsApi(apiClient)resp,r,err:=api.ListScorecardRules(ctx,*datadogV2.NewListScorecardRulesOptionalParameters())iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `ServiceScorecardsApi.ListScorecardRules`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}responseContent,_:=json.MarshalIndent(resp,""," ")fmt.Fprintf(os.Stdout,"Response from `ServiceScorecardsApi.ListScorecardRules`:\n%s\n",responseContent)}
// List all rules returns "OK" responseimportcom.datadog.api.client.ApiClient;importcom.datadog.api.client.ApiException;importcom.datadog.api.client.v2.api.ServiceScorecardsApi;importcom.datadog.api.client.v2.model.ListRulesResponse;publicclassExample{publicstaticvoidmain(String[]args){ApiClientdefaultClient=ApiClient.getDefaultApiClient();defaultClient.setUnstableOperationEnabled("v2.listScorecardRules",true);ServiceScorecardsApiapiInstance=newServiceScorecardsApi(defaultClient);try{ListRulesResponseresult=apiInstance.listScorecardRules();System.out.println(result);}catch(ApiExceptione){System.err.println("Exception when calling ServiceScorecardsApi#listScorecardRules");System.err.println("Status code: "+e.getCode());System.err.println("Reason: "+e.getResponseBody());System.err.println("Response headers: "+e.getResponseHeaders());e.printStackTrace();}}}
// List all rules returns "OK" response
usedatadog_api_client::datadog;usedatadog_api_client::datadogV2::api_service_scorecards::ListScorecardRulesOptionalParams;usedatadog_api_client::datadogV2::api_service_scorecards::ServiceScorecardsAPI;#[tokio::main]asyncfnmain(){letmutconfiguration=datadog::Configuration::new();configuration.set_unstable_operation_enabled("v2.ListScorecardRules",true);letapi=ServiceScorecardsAPI::with_config(configuration);letresp=api.list_scorecard_rules(ListScorecardRulesOptionalParams::default()).await;ifletOk(value)=resp{println!("{:#?}",value);}else{println!("{:#?}",resp.unwrap_err());}}
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com"DD_API_KEY="<DD_API_KEY>"DD_APP_KEY="<DD_APP_KEY>"cargo run
/**
* List all rules returns "OK" response
*/import{client,v2}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();configuration.unstableOperations["v2.listScorecardRules"]=true;constapiInstance=newv2.ServiceScorecardsApi(configuration);apiInstance.listScorecardRules().then((data: v2.ListRulesResponse)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));
"""
Delete a rule returns "OK" response
"""fromosimportenvironfromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v2.api.service_scorecards_apiimportServiceScorecardsApi# there is a valid "create_scorecard_rule" in the systemCREATE_SCORECARD_RULE_DATA_ID=environ["CREATE_SCORECARD_RULE_DATA_ID"]configuration=Configuration()configuration.unstable_operations["delete_scorecard_rule"]=TruewithApiClient(configuration)asapi_client:api_instance=ServiceScorecardsApi(api_client)api_instance.delete_scorecard_rule(rule_id=CREATE_SCORECARD_RULE_DATA_ID,)
# Delete a rule returns "OK" responserequire"datadog_api_client"DatadogAPIClient.configuredo|config|config.unstable_operations["v2.delete_scorecard_rule".to_sym]=trueendapi_instance=DatadogAPIClient::V2::ServiceScorecardsAPI.new# there is a valid "create_scorecard_rule" in the systemCREATE_SCORECARD_RULE_DATA_ID=ENV["CREATE_SCORECARD_RULE_DATA_ID"]api_instance.delete_scorecard_rule(CREATE_SCORECARD_RULE_DATA_ID)
// Delete a rule returns "OK" response
packagemainimport("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 "create_scorecard_rule" in the system
CreateScorecardRuleDataID:=os.Getenv("CREATE_SCORECARD_RULE_DATA_ID")ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()configuration.SetUnstableOperationEnabled("v2.DeleteScorecardRule",true)apiClient:=datadog.NewAPIClient(configuration)api:=datadogV2.NewServiceScorecardsApi(apiClient)r,err:=api.DeleteScorecardRule(ctx,CreateScorecardRuleDataID)iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `ServiceScorecardsApi.DeleteScorecardRule`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}}
// Delete a rule returns "OK" responseimportcom.datadog.api.client.ApiClient;importcom.datadog.api.client.ApiException;importcom.datadog.api.client.v2.api.ServiceScorecardsApi;publicclassExample{publicstaticvoidmain(String[]args){ApiClientdefaultClient=ApiClient.getDefaultApiClient();defaultClient.setUnstableOperationEnabled("v2.deleteScorecardRule",true);ServiceScorecardsApiapiInstance=newServiceScorecardsApi(defaultClient);// there is a valid "create_scorecard_rule" in the systemStringCREATE_SCORECARD_RULE_DATA_ID=System.getenv("CREATE_SCORECARD_RULE_DATA_ID");try{apiInstance.deleteScorecardRule(CREATE_SCORECARD_RULE_DATA_ID);}catch(ApiExceptione){System.err.println("Exception when calling ServiceScorecardsApi#deleteScorecardRule");System.err.println("Status code: "+e.getCode());System.err.println("Reason: "+e.getResponseBody());System.err.println("Response headers: "+e.getResponseHeaders());e.printStackTrace();}}}
// Delete a rule returns "OK" response
usedatadog_api_client::datadog;usedatadog_api_client::datadogV2::api_service_scorecards::ServiceScorecardsAPI;#[tokio::main]asyncfnmain(){// there is a valid "create_scorecard_rule" in the system
letcreate_scorecard_rule_data_id=std::env::var("CREATE_SCORECARD_RULE_DATA_ID").unwrap();letmutconfiguration=datadog::Configuration::new();configuration.set_unstable_operation_enabled("v2.DeleteScorecardRule",true);letapi=ServiceScorecardsAPI::with_config(configuration);letresp=api.delete_scorecard_rule(create_scorecard_rule_data_id.clone()).await;ifletOk(value)=resp{println!("{:#?}",value);}else{println!("{:#?}",resp.unwrap_err());}}
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com"DD_API_KEY="<DD_API_KEY>"DD_APP_KEY="<DD_APP_KEY>"cargo run
/**
* Delete a rule returns "OK" response
*/import{client,v2}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();configuration.unstableOperations["v2.deleteScorecardRule"]=true;constapiInstance=newv2.ServiceScorecardsApi(configuration);// there is a valid "create_scorecard_rule" in the system
constCREATE_SCORECARD_RULE_DATA_ID=process.env.CREATE_SCORECARD_RULE_DATA_IDasstring;constparams: v2.ServiceScorecardsApiDeleteScorecardRuleRequest={ruleId: CREATE_SCORECARD_RULE_DATA_ID,};apiInstance.deleteScorecardRule(params).then((data: any)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));
DEPRECATED: The scorecard name to which this rule must belong.
created_at
date-time
Creation time of the rule outcome.
custom
boolean
Defines if the rule is a custom rule.
description
string
Explanation of the rule.
enabled
boolean
If enabled, the rule is calculated as part of the score.
modified_at
date-time
Time of the last rule outcome modification.
name
string
Name of the rule.
owner
string
Owner of the rule.
scorecard_name
string
The scorecard name to which this rule must belong.
type
enum
The JSON:API type for scorecard rules.
Allowed enum values: rule
default: rule
{"data":{"attributes":{"enabled":true,"name":"Team Defined","scorecard_name":"Deployments automated via Deployment Trains","description":"Updated description via test"}}}
// Update an existing rule returns "Rule updated successfully" response
packagemainimport("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(){// there is a valid "create_scorecard_rule" in the system
CreateScorecardRuleDataAttributesName:=os.Getenv("CREATE_SCORECARD_RULE_DATA_ATTRIBUTES_NAME")CreateScorecardRuleDataAttributesScorecardName:=os.Getenv("CREATE_SCORECARD_RULE_DATA_ATTRIBUTES_SCORECARD_NAME")CreateScorecardRuleDataID:=os.Getenv("CREATE_SCORECARD_RULE_DATA_ID")body:=datadogV2.UpdateRuleRequest{Data:&datadogV2.UpdateRuleRequestData{Attributes:&datadogV2.RuleAttributes{Enabled:datadog.PtrBool(true),Name:datadog.PtrString(CreateScorecardRuleDataAttributesName),ScorecardName:datadog.PtrString(CreateScorecardRuleDataAttributesScorecardName),Description:datadog.PtrString("Updated description via test"),},},}ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()configuration.SetUnstableOperationEnabled("v2.UpdateScorecardRule",true)apiClient:=datadog.NewAPIClient(configuration)api:=datadogV2.NewServiceScorecardsApi(apiClient)resp,r,err:=api.UpdateScorecardRule(ctx,CreateScorecardRuleDataID,body)iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `ServiceScorecardsApi.UpdateScorecardRule`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}responseContent,_:=json.MarshalIndent(resp,""," ")fmt.Fprintf(os.Stdout,"Response from `ServiceScorecardsApi.UpdateScorecardRule`:\n%s\n",responseContent)}
// Update an existing rule returns "Rule updated successfully" responseimportcom.datadog.api.client.ApiClient;importcom.datadog.api.client.ApiException;importcom.datadog.api.client.v2.api.ServiceScorecardsApi;importcom.datadog.api.client.v2.model.RuleAttributes;importcom.datadog.api.client.v2.model.UpdateRuleRequest;importcom.datadog.api.client.v2.model.UpdateRuleRequestData;importcom.datadog.api.client.v2.model.UpdateRuleResponse;publicclassExample{publicstaticvoidmain(String[]args){ApiClientdefaultClient=ApiClient.getDefaultApiClient();defaultClient.setUnstableOperationEnabled("v2.updateScorecardRule",true);ServiceScorecardsApiapiInstance=newServiceScorecardsApi(defaultClient);// there is a valid "create_scorecard_rule" in the systemStringCREATE_SCORECARD_RULE_DATA_ATTRIBUTES_NAME=System.getenv("CREATE_SCORECARD_RULE_DATA_ATTRIBUTES_NAME");StringCREATE_SCORECARD_RULE_DATA_ATTRIBUTES_SCORECARD_NAME=System.getenv("CREATE_SCORECARD_RULE_DATA_ATTRIBUTES_SCORECARD_NAME");StringCREATE_SCORECARD_RULE_DATA_ID=System.getenv("CREATE_SCORECARD_RULE_DATA_ID");UpdateRuleRequestbody=newUpdateRuleRequest().data(newUpdateRuleRequestData().attributes(newRuleAttributes().enabled(true).name(CREATE_SCORECARD_RULE_DATA_ATTRIBUTES_NAME).scorecardName(CREATE_SCORECARD_RULE_DATA_ATTRIBUTES_SCORECARD_NAME).description("Updated description via test")));try{UpdateRuleResponseresult=apiInstance.updateScorecardRule(CREATE_SCORECARD_RULE_DATA_ID,body);System.out.println(result);}catch(ApiExceptione){System.err.println("Exception when calling ServiceScorecardsApi#updateScorecardRule");System.err.println("Status code: "+e.getCode());System.err.println("Reason: "+e.getResponseBody());System.err.println("Response headers: "+e.getResponseHeaders());e.printStackTrace();}}}
"""
Update an existing rule returns "Rule updated successfully" response
"""fromosimportenvironfromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v2.api.service_scorecards_apiimportServiceScorecardsApifromdatadog_api_client.v2.model.rule_attributesimportRuleAttributesfromdatadog_api_client.v2.model.update_rule_requestimportUpdateRuleRequestfromdatadog_api_client.v2.model.update_rule_request_dataimportUpdateRuleRequestData# there is a valid "create_scorecard_rule" in the systemCREATE_SCORECARD_RULE_DATA_ATTRIBUTES_NAME=environ["CREATE_SCORECARD_RULE_DATA_ATTRIBUTES_NAME"]CREATE_SCORECARD_RULE_DATA_ATTRIBUTES_SCORECARD_NAME=environ["CREATE_SCORECARD_RULE_DATA_ATTRIBUTES_SCORECARD_NAME"]CREATE_SCORECARD_RULE_DATA_ID=environ["CREATE_SCORECARD_RULE_DATA_ID"]body=UpdateRuleRequest(data=UpdateRuleRequestData(attributes=RuleAttributes(enabled=True,name=CREATE_SCORECARD_RULE_DATA_ATTRIBUTES_NAME,scorecard_name=CREATE_SCORECARD_RULE_DATA_ATTRIBUTES_SCORECARD_NAME,description="Updated description via test",),),)configuration=Configuration()configuration.unstable_operations["update_scorecard_rule"]=TruewithApiClient(configuration)asapi_client:api_instance=ServiceScorecardsApi(api_client)response=api_instance.update_scorecard_rule(rule_id=CREATE_SCORECARD_RULE_DATA_ID,body=body)print(response)
# Update an existing rule returns "Rule updated successfully" responserequire"datadog_api_client"DatadogAPIClient.configuredo|config|config.unstable_operations["v2.update_scorecard_rule".to_sym]=trueendapi_instance=DatadogAPIClient::V2::ServiceScorecardsAPI.new# there is a valid "create_scorecard_rule" in the systemCREATE_SCORECARD_RULE_DATA_ATTRIBUTES_NAME=ENV["CREATE_SCORECARD_RULE_DATA_ATTRIBUTES_NAME"]CREATE_SCORECARD_RULE_DATA_ATTRIBUTES_SCORECARD_NAME=ENV["CREATE_SCORECARD_RULE_DATA_ATTRIBUTES_SCORECARD_NAME"]CREATE_SCORECARD_RULE_DATA_ID=ENV["CREATE_SCORECARD_RULE_DATA_ID"]body=DatadogAPIClient::V2::UpdateRuleRequest.new({data:DatadogAPIClient::V2::UpdateRuleRequestData.new({attributes:DatadogAPIClient::V2::RuleAttributes.new({enabled:true,name:CREATE_SCORECARD_RULE_DATA_ATTRIBUTES_NAME,scorecard_name:CREATE_SCORECARD_RULE_DATA_ATTRIBUTES_SCORECARD_NAME,description:"Updated description via test",}),}),})papi_instance.update_scorecard_rule(CREATE_SCORECARD_RULE_DATA_ID,body)
// Update an existing rule returns "Rule updated successfully" response
usedatadog_api_client::datadog;usedatadog_api_client::datadogV2::api_service_scorecards::ServiceScorecardsAPI;usedatadog_api_client::datadogV2::model::RuleAttributes;usedatadog_api_client::datadogV2::model::UpdateRuleRequest;usedatadog_api_client::datadogV2::model::UpdateRuleRequestData;#[tokio::main]asyncfnmain(){// there is a valid "create_scorecard_rule" in the system
letcreate_scorecard_rule_data_attributes_name=std::env::var("CREATE_SCORECARD_RULE_DATA_ATTRIBUTES_NAME").unwrap();letcreate_scorecard_rule_data_attributes_scorecard_name=std::env::var("CREATE_SCORECARD_RULE_DATA_ATTRIBUTES_SCORECARD_NAME").unwrap();letcreate_scorecard_rule_data_id=std::env::var("CREATE_SCORECARD_RULE_DATA_ID").unwrap();letbody=UpdateRuleRequest::new().data(UpdateRuleRequestData::new().attributes(RuleAttributes::new().description("Updated description via test".to_string()).enabled(true).name(create_scorecard_rule_data_attributes_name.clone()).scorecard_name(create_scorecard_rule_data_attributes_scorecard_name.clone()),),);letmutconfiguration=datadog::Configuration::new();configuration.set_unstable_operation_enabled("v2.UpdateScorecardRule",true);letapi=ServiceScorecardsAPI::with_config(configuration);letresp=api.update_scorecard_rule(create_scorecard_rule_data_id.clone(),body).await;ifletOk(value)=resp{println!("{:#?}",value);}else{println!("{:#?}",resp.unwrap_err());}}
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com"DD_API_KEY="<DD_API_KEY>"DD_APP_KEY="<DD_APP_KEY>"cargo run
/**
* Update an existing rule returns "Rule updated successfully" response
*/import{client,v2}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();configuration.unstableOperations["v2.updateScorecardRule"]=true;constapiInstance=newv2.ServiceScorecardsApi(configuration);// there is a valid "create_scorecard_rule" in the system
constCREATE_SCORECARD_RULE_DATA_ATTRIBUTES_NAME=process.env.CREATE_SCORECARD_RULE_DATA_ATTRIBUTES_NAMEasstring;constCREATE_SCORECARD_RULE_DATA_ATTRIBUTES_SCORECARD_NAME=process.env.CREATE_SCORECARD_RULE_DATA_ATTRIBUTES_SCORECARD_NAMEasstring;constCREATE_SCORECARD_RULE_DATA_ID=process.env.CREATE_SCORECARD_RULE_DATA_IDasstring;constparams: v2.ServiceScorecardsApiUpdateScorecardRuleRequest={body:{data:{attributes:{enabled: true,name: CREATE_SCORECARD_RULE_DATA_ATTRIBUTES_NAME,scorecardName: CREATE_SCORECARD_RULE_DATA_ATTRIBUTES_SCORECARD_NAME,description:"Updated description via test",},},},ruleId: CREATE_SCORECARD_RULE_DATA_ID,};apiInstance.updateScorecardRule(params).then((data: v2.UpdateRuleResponse)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));