- 필수 기능
- 시작하기
- Glossary
- 표준 속성
- Guides
- Agent
- 통합
- 개방형텔레메트리
- 개발자
- Administrator's Guide
- API
- Datadog Mobile App
- CoScreen
- Cloudcraft
- 앱 내
- 서비스 관리
- 인프라스트럭처
- 애플리케이션 성능
- APM
- Continuous Profiler
- 스팬 시각화
- 데이터 스트림 모니터링
- 데이터 작업 모니터링
- 디지털 경험
- 소프트웨어 제공
- 보안
- AI Observability
- 로그 관리
- 관리
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.
Note: This endpoint is in public beta. If you have any feedback, contact Datadog support.
POST https://api.ap1.datadoghq.com/api/v2/scorecard/ruleshttps://api.datadoghq.eu/api/v2/scorecard/ruleshttps://api.ddog-gov.com/api/v2/scorecard/ruleshttps://api.datadoghq.com/api/v2/scorecard/ruleshttps://api.us3.datadoghq.com/api/v2/scorecard/ruleshttps://api.us5.datadoghq.com/api/v2/scorecard/rules
Creates a new rule.
OAuth apps require the apm_service_catalog_write
authorization scope to access this endpoint.
Rule attributes.
항목
유형
설명
data
object
Scorecard create rule request data.
attributes
object
Details of a rule.
category
string
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": "Example-Service-Scorecard",
"scorecard_name": "Observability Best Practices"
},
"type": "rule"
}
}
Created
Created rule in response.
항목
유형
설명
data
object
Create rule response data.
attributes
object
Details of a rule.
category
string
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.
id
string
The unique ID for a scorecard rule.
relationships
object
Scorecard create rule response relationship.
scorecard
object
Relationship data for a rule.
data
object
Rule relationship data.
id
string
The unique ID for a scorecard.
type
enum
The JSON:API type for scorecard.
Allowed enum values: scorecard
default: scorecard
type
enum
The JSON:API type for scorecard rules.
Allowed enum values: rule
default: rule
{
"data": {
"attributes": {
"category": "string",
"created_at": "2019-09-19T10:00:00.000Z",
"custom": false,
"description": "string",
"enabled": true,
"modified_at": "2019-09-19T10:00:00.000Z",
"name": "Team Defined",
"owner": "string",
"scorecard_name": "Deployments automated via Deployment Trains"
},
"id": "q8MQxk8TCqrHnWkx",
"relationships": {
"scorecard": {
"data": {
"id": "q8MQxk8TCqrHnWkp",
"type": "scorecard"
}
}
},
"type": "rule"
}
}
Bad Request
API error response.
{
"errors": [
"Bad Request"
]
}
Forbidden
API error response.
{
"errors": [
"Bad Request"
]
}
Too many requests
API error response.
{
"errors": [
"Bad Request"
]
}
// Create a new rule returns "Created" response
package main
import (
"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"
)
func main() {
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)
if err != 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)
}
First install the library and its dependencies and then save the example to main.go
and run following commands:
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>" go run "main.go"
Note: This endpoint is in public beta. If you have any feedback, contact Datadog support.
POST https://api.ap1.datadoghq.com/api/v2/scorecard/outcomes/batchhttps://api.datadoghq.eu/api/v2/scorecard/outcomes/batchhttps://api.ddog-gov.com/api/v2/scorecard/outcomes/batchhttps://api.datadoghq.com/api/v2/scorecard/outcomes/batchhttps://api.us3.datadoghq.com/api/v2/scorecard/outcomes/batchhttps://api.us5.datadoghq.com/api/v2/scorecard/outcomes/batch
Sets multiple service-rule outcomes in a single batched request.
OAuth apps require the apm_service_catalog_write
authorization scope to access this endpoint.
Set of scorecard outcomes.
항목
유형
설명
data
object
Scorecard outcomes batch request data.
attributes
object
The JSON:API attributes for a batched set of scorecard outcomes.
results
[object]
Set of scorecard outcomes to update.
remarks
string
Any remarks regarding the scorecard rule's evaluation, and supports HTML hyperlinks.
rule_id [required]
string
The unique ID for a scorecard rule.
service_name [required]
string
The unique name for a service in the catalog.
state [required]
enum
The state of the rule evaluation.
Allowed enum values: pass,fail,skip
type
enum
The JSON:API type for scorecard outcomes.
Allowed enum values: batched-outcome
default: batched-outcome
{
"data": {
"attributes": {
"results": [
{
"remarks": "See: <a href=\"https://app.datadoghq.com/services\">Services</a>",
"rule_id": "q8MQxk8TCqrHnWkx",
"service_name": "my-service",
"state": "pass"
}
]
},
"type": "batched-outcome"
}
}
OK
Scorecard outcomes batch response.
항목
유형
설명
data [required]
[object]
List of rule outcomes which were affected during the bulk operation.
attributes
object
The JSON:API attributes for an outcome.
created_at
date-time
Creation time of the rule outcome.
modified_at
date-time
Time of last rule outcome modification.
remarks
string
Any remarks regarding the scorecard rule's evaluation, and supports HTML hyperlinks.
service_name
string
The unique name for a service in the catalog.
state
enum
The state of the rule evaluation.
Allowed enum values: pass,fail,skip
id
string
The unique ID for a rule outcome.
relationships
object
The JSON:API relationship to a scorecard rule.
rule
object
The JSON:API relationship to a scorecard outcome.
data
object
The JSON:API relationship to an outcome, which returns the related rule id.
id
string
The unique ID for a scorecard rule.
type
enum
The JSON:API type for scorecard rules.
Allowed enum values: rule
default: rule
type
enum
The JSON:API type for an outcome.
Allowed enum values: outcome
default: outcome
meta [required]
object
Metadata pertaining to the bulk operation.
total_received
int64
Total number of scorecard results received during the bulk operation.
total_updated
int64
Total number of scorecard results modified during the bulk operation.
{
"data": [
{
"attributes": {
"created_at": "2019-09-19T10:00:00.000Z",
"modified_at": "2019-09-19T10:00:00.000Z",
"remarks": "See: <a href=\"https://app.datadoghq.com/services\">Services</a>",
"service_name": "my-service",
"state": "pass"
},
"id": "string",
"relationships": {
"rule": {
"data": {
"id": "q8MQxk8TCqrHnWkx",
"type": "rule"
}
}
},
"type": "outcome"
}
],
"meta": {
"total_received": "integer",
"total_updated": "integer"
}
}
Bad Request
API error response.
{
"errors": [
"Bad Request"
]
}
Forbidden
API error response.
{
"errors": [
"Bad Request"
]
}
Too many requests
API error response.
{
"errors": [
"Bad Request"
]
}
// Create outcomes batch returns "OK" response
package main
import (
"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"
)
func main() {
// 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)
if err != 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)
}
First install the library and its dependencies and then save the example to main.go
and run following commands:
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>" go run "main.go"
Note: This endpoint is in public beta. If you have any feedback, contact Datadog support.
GET https://api.ap1.datadoghq.com/api/v2/scorecard/outcomeshttps://api.datadoghq.eu/api/v2/scorecard/outcomeshttps://api.ddog-gov.com/api/v2/scorecard/outcomeshttps://api.datadoghq.com/api/v2/scorecard/outcomeshttps://api.us3.datadoghq.com/api/v2/scorecard/outcomeshttps://api.us5.datadoghq.com/api/v2/scorecard/outcomes
Fetches all rule outcomes.
OAuth apps require the apm_service_catalog_read
authorization scope to access this endpoint.
이름
유형
설명
page[size]
integer
Size for a given page. The maximum allowed value is 100.
page[offset]
integer
Specific offset to use as the beginning of the returned page.
include
string
Include related rule details in the response.
fields[outcome]
string
Return only specified values in the outcome attributes.
fields[rule]
string
Return only specified values in the included rule details.
filter[outcome][service_name]
string
Filter the outcomes on a specific service name.
filter[outcome][state]
string
Filter the outcomes by a specific state.
filter[rule][enabled]
boolean
Filter outcomes on whether a rule is enabled/disabled.
filter[rule][id]
string
Filter outcomes based on rule ID.
filter[rule][name]
string
Filter outcomes based on rule name.
OK
Scorecard outcomes - the result of a rule for a service.
항목
유형
설명
data
[object]
List of rule outcomes.
attributes
object
The JSON:API attributes for an outcome.
created_at
date-time
Creation time of the rule outcome.
modified_at
date-time
Time of last rule outcome modification.
remarks
string
Any remarks regarding the scorecard rule's evaluation, and supports HTML hyperlinks.
service_name
string
The unique name for a service in the catalog.
state
enum
The state of the rule evaluation.
Allowed enum values: pass,fail,skip
id
string
The unique ID for a rule outcome.
relationships
object
The JSON:API relationship to a scorecard rule.
rule
object
The JSON:API relationship to a scorecard outcome.
data
object
The JSON:API relationship to an outcome, which returns the related rule id.
id
string
The unique ID for a scorecard rule.
type
enum
The JSON:API type for scorecard rules.
Allowed enum values: rule
default: rule
type
enum
The JSON:API type for an outcome.
Allowed enum values: outcome
default: outcome
included
[object]
Array of rule details.
attributes
object
Details of a rule.
name
string
Name of the rule.
scorecard_name
string
The scorecard name to which this rule must belong.
id
string
The unique ID for a scorecard rule.
type
enum
The JSON:API type for scorecard rules.
Allowed enum values: rule
default: rule
links
object
Links attributes.
next
string
Link for the next set of results.
{
"data": [
{
"attributes": {
"created_at": "2019-09-19T10:00:00.000Z",
"modified_at": "2019-09-19T10:00:00.000Z",
"remarks": "See: <a href=\"https://app.datadoghq.com/services\">Services</a>",
"service_name": "my-service",
"state": "pass"
},
"id": "string",
"relationships": {
"rule": {
"data": {
"id": "q8MQxk8TCqrHnWkx",
"type": "rule"
}
}
},
"type": "outcome"
}
],
"included": [
{
"attributes": {
"name": "Team Defined",
"scorecard_name": "Observability Best Practices"
},
"id": "q8MQxk8TCqrHnWkx",
"type": "rule"
}
],
"links": {
"next": "/api/v2/scorecard/outcomes?include=rule\u0026page%5Blimit%5D=100\u0026page%5Boffset%5D=100"
}
}
Bad Request
API error response.
{
"errors": [
"Bad Request"
]
}
Forbidden
API error response.
{
"errors": [
"Bad Request"
]
}
Too many requests
API error response.
{
"errors": [
"Bad Request"
]
}
// List all rule outcomes returns "OK" response
package main
import (
"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"
)
func main() {
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())
if err != 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)
}
First install the library and its dependencies and then save the example to main.go
and run following commands:
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>" go run "main.go"
Note: This endpoint is in public beta. If you have any feedback, contact Datadog support.
GET https://api.ap1.datadoghq.com/api/v2/scorecard/ruleshttps://api.datadoghq.eu/api/v2/scorecard/ruleshttps://api.ddog-gov.com/api/v2/scorecard/ruleshttps://api.datadoghq.com/api/v2/scorecard/ruleshttps://api.us3.datadoghq.com/api/v2/scorecard/ruleshttps://api.us5.datadoghq.com/api/v2/scorecard/rules
Fetch all rules.
OAuth apps require the apm_service_catalog_read
authorization scope to access this endpoint.
이름
유형
설명
page[size]
integer
Size for a given page. The maximum allowed value is 100.
page[offset]
integer
Specific offset to use as the beginning of the returned page.
include
string
Include related scorecard details in the response.
filter[rule][id]
string
Filter the rules on a rule ID.
filter[rule][enabled]
boolean
Filter for enabled rules only.
filter[rule][custom]
boolean
Filter for custom rules only.
filter[rule][name]
string
Filter rules on the rule name.
filter[rule][description]
string
Filter rules on the rule description.
fields[rule]
string
Return only specific fields in the response for rule attributes.
fields[scorecard]
string
Return only specific fields in the included response for scorecard attributes.
OK
Scorecard rules response.
항목
유형
설명
data
[object]
Array of rule details.
attributes
object
Details of a rule.
category
string
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.
id
string
The unique ID for a scorecard rule.
relationships
object
Scorecard create rule response relationship.
scorecard
object
Relationship data for a rule.
data
object
Rule relationship data.
id
string
The unique ID for a scorecard.
type
enum
The JSON:API type for scorecard.
Allowed enum values: scorecard
default: scorecard
type
enum
The JSON:API type for scorecard rules.
Allowed enum values: rule
default: rule
links
object
Links attributes.
next
string
Link for the next set of rules.
{
"data": [
{
"attributes": {
"category": "string",
"created_at": "2019-09-19T10:00:00.000Z",
"custom": false,
"description": "string",
"enabled": true,
"modified_at": "2019-09-19T10:00:00.000Z",
"name": "Team Defined",
"owner": "string",
"scorecard_name": "Deployments automated via Deployment Trains"
},
"id": "q8MQxk8TCqrHnWkx",
"relationships": {
"scorecard": {
"data": {
"id": "q8MQxk8TCqrHnWkp",
"type": "scorecard"
}
}
},
"type": "rule"
}
],
"links": {
"next": "/api/v2/scorecard/rules?page%5Blimit%5D=2\u0026page%5Boffset%5D=2\u0026page%5Bsize%5D=2"
}
}
Bad Request
API error response.
{
"errors": [
"Bad Request"
]
}
Forbidden
API error response.
{
"errors": [
"Bad Request"
]
}
Too many requests
API error response.
{
"errors": [
"Bad Request"
]
}
// List all rules returns "OK" response
package main
import (
"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"
)
func main() {
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())
if err != 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)
}
First install the library and its dependencies and then save the example to main.go
and run following commands:
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>" go run "main.go"
Note: This endpoint is in public beta. If you have any feedback, contact Datadog support.
DELETE https://api.ap1.datadoghq.com/api/v2/scorecard/rules/{rule_id}https://api.datadoghq.eu/api/v2/scorecard/rules/{rule_id}https://api.ddog-gov.com/api/v2/scorecard/rules/{rule_id}https://api.datadoghq.com/api/v2/scorecard/rules/{rule_id}https://api.us3.datadoghq.com/api/v2/scorecard/rules/{rule_id}https://api.us5.datadoghq.com/api/v2/scorecard/rules/{rule_id}
Deletes a single rule.
OAuth apps require the apm_service_catalog_write
authorization scope to access this endpoint.
이름
유형
설명
rule_id [required]
string
The ID of the rule.
OK
Bad Request
API error response.
{
"errors": [
"Bad Request"
]
}
Forbidden
API error response.
{
"errors": [
"Bad Request"
]
}
Not Found
API error response.
{
"errors": [
"Bad Request"
]
}
Too many requests
API error response.
{
"errors": [
"Bad Request"
]
}
// Delete a rule returns "OK" response
package main
import (
"context"
"fmt"
"os"
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
"github.com/DataDog/datadog-api-client-go/v2/api/datadogV2"
)
func main() {
// 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)
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `ServiceScorecardsApi.DeleteScorecardRule`: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
}
First install the library and its dependencies and then save the example to main.go
and run following commands:
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>" go run "main.go"
Note: This endpoint is in public beta. If you have any feedback, contact Datadog support.
PUT https://api.ap1.datadoghq.com/api/v2/scorecard/rules/{rule_id}https://api.datadoghq.eu/api/v2/scorecard/rules/{rule_id}https://api.ddog-gov.com/api/v2/scorecard/rules/{rule_id}https://api.datadoghq.com/api/v2/scorecard/rules/{rule_id}https://api.us3.datadoghq.com/api/v2/scorecard/rules/{rule_id}https://api.us5.datadoghq.com/api/v2/scorecard/rules/{rule_id}
Updates an existing rule.
OAuth apps require the apm_service_catalog_write
authorization scope to access this endpoint.
이름
유형
설명
rule_id [required]
string
The ID of the rule.
Rule attributes.
항목
유형
설명
data
object
Data for the request to update a scorecard rule.
attributes
object
Details of a rule.
category
string
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"
}
}
}
Rule updated successfully
The response from a rule update request.
항목
유형
설명
data
object
The data for a rule update response.
attributes
object
Details of a rule.
category
string
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.
id
string
The unique ID for a scorecard rule.
relationships
object
Scorecard create rule response relationship.
scorecard
object
Relationship data for a rule.
data
object
Rule relationship data.
id
string
The unique ID for a scorecard.
type
enum
The JSON:API type for scorecard.
Allowed enum values: scorecard
default: scorecard
type
enum
The JSON:API type for scorecard rules.
Allowed enum values: rule
default: rule
{
"data": {
"attributes": {
"category": "string",
"created_at": "2019-09-19T10:00:00.000Z",
"custom": false,
"description": "string",
"enabled": true,
"modified_at": "2019-09-19T10:00:00.000Z",
"name": "Team Defined",
"owner": "string",
"scorecard_name": "Deployments automated via Deployment Trains"
},
"id": "q8MQxk8TCqrHnWkx",
"relationships": {
"scorecard": {
"data": {
"id": "q8MQxk8TCqrHnWkp",
"type": "scorecard"
}
}
},
"type": "rule"
}
}
Bad Request
API error response.
{
"errors": [
"Bad Request"
]
}
Forbidden
API error response.
{
"errors": [
"Bad Request"
]
}
Too many requests
API error response.
{
"errors": [
"Bad Request"
]
}
// Update an existing rule returns "Rule updated successfully" response
package main
import (
"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"
)
func main() {
// 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)
if err != 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)
}
First install the library and its dependencies and then save the example to main.go
and run following commands:
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>" go run "main.go"