Update tag pipeline ruleset
https://api.datadoghq.com/api/v2/tags/enrichment/{ruleset_id}https://api.us3.datadoghq.com/api/v2/tags/enrichment/{ruleset_id}https://api.us5.datadoghq.com/api/v2/tags/enrichment/{ruleset_id}https://api.datadoghq.eu/api/v2/tags/enrichment/{ruleset_id}https://api.ap1.datadoghq.com/api/v2/tags/enrichment/{ruleset_id}https://api.ap2.datadoghq.com/api/v2/tags/enrichment/{ruleset_id}https://api.uk1.datadoghq.com/api/v2/tags/enrichment/{ruleset_id}https://api.ddog-gov.com/api/v2/tags/enrichment/{ruleset_id}https://api.us2.ddog-gov.com/api/v2/tags/enrichment/{ruleset_id}Overview
Update a tag pipeline ruleset - Update an existing tag pipeline ruleset with new rules and configuration
OAuth apps require the cloud_cost_management_write authorization scope to access this endpoint.
Arguments
Path Parameters
ruleset_id [required]The unique identifier of the ruleset
Request
Body Data (required)
dataThe definition of UpdateRulesetRequestData object.
attributesThe definition of UpdateRulesetRequestDataAttributes object.
enabled [required]The attributes enabled.
last_versionThe attributes last_version.
rules [required]The attributes rules.
enabled [required]The items enabled.
mappingThe definition of DataAttributesRulesItemsMapping object.
destination_key [required]The mapping destination_key.
if_not_existsDEPRECATED Deprecated. Use if_tag_exists instead. The mapping if_not_exists.
if_tag_existsThe behavior when the tag already exists.
append, do_not_apply, replacesource_keys [required]The mapping source_keys.
metadataThe items metadata.
<any-key>name [required]The items name.
queryThe definition of UpdateRulesetRequestDataAttributesRulesItemsQuery object.
addition [required]The definition of UpdateRulesetRequestDataAttributesRulesItemsQueryAddition object.
key [required]The addition key.
value [required]The addition value.
case_insensitivityThe query case_insensitivity.
if_not_existsDEPRECATED Deprecated. Use if_tag_exists instead. The query if_not_exists.
if_tag_existsThe behavior when the tag already exists.
append, do_not_apply, replacequery [required]The query query.
reference_tableThe definition of UpdateRulesetRequestDataAttributesRulesItemsReferenceTable object.
case_insensitivityThe reference_table case_insensitivity.
field_pairs [required]The reference_table field_pairs.
input_column [required]The items input_column.
output_key [required]The items output_key.
if_not_existsDEPRECATED Deprecated. Use if_tag_exists instead. The reference_table if_not_exists.
if_tag_existsThe behavior when the tag already exists.
append, do_not_apply, replacesource_keys [required]The reference_table source_keys.
table_name [required]The reference_table table_name.
idThe UpdateRulesetRequestData id.
type [required]Update ruleset resource type.
update_rulesetupdate_ruleset{
"data": {
"attributes": {
"enabled": true,
"last_version": 1,
"name": "Updated Ruleset",
"rules": [
{
"enabled": true,
"name": "Add Cost Center Tag",
"query": {
"addition": {
"key": "cost_center",
"value": "engineering"
},
"case_insensitivity": false,
"if_tag_exists": "do_not_apply",
"query": "account_id:\"123456789\" AND service:\"web-api\""
}
},
{
"enabled": true,
"mapping": {
"destination_key": "team_owner",
"if_tag_exists": "do_not_apply",
"source_keys": [
"account_name",
"account_id"
]
},
"name": "Account Name Mapping",
"query": null
},
{
"enabled": true,
"name": "New table rule with new UI",
"query": null,
"reference_table": {
"case_insensitivity": true,
"field_pairs": [
{
"input_column": "status_type",
"output_key": "status"
},
{
"input_column": "status_description",
"output_key": "dess"
}
],
"if_tag_exists": "append",
"source_keys": [
"http_status",
"status_description"
],
"table_name": "http_status_codes"
}
}
]
},
"type": "update_ruleset"
}
}Response
OK
The definition of RulesetResp object.
dataThe definition of RulesetRespData object.
attributesThe definition of RulesetRespDataAttributes object.
created [required]The definition of RulesetRespDataAttributesCreated object.
nanosThe created nanos.
secondsThe created seconds.
enabled [required]The attributes enabled.
last_modified_user_uuid [required]The attributes last_modified_user_uuid.
modified [required]The definition of RulesetRespDataAttributesModified object.
nanosThe modified nanos.
secondsThe modified seconds.
name [required]The attributes name.
position [required]The attributes position.
processing_statusThe attributes processing_status.
rules [required]The attributes rules.
enabled [required]The items enabled.
mappingThe definition of DataAttributesRulesItemsMapping object.
destination_key [required]The mapping destination_key.
if_not_existsDEPRECATED Deprecated. Use if_tag_exists instead. The mapping if_not_exists.
if_tag_existsThe behavior when the tag already exists.
append, do_not_apply, replacesource_keys [required]The mapping source_keys.
metadataThe items metadata.
<any-key>name [required]The items name.
queryThe definition of RulesetRespDataAttributesRulesItemsQuery object.
addition [required]The definition of RulesetRespDataAttributesRulesItemsQueryAddition object.
key [required]The addition key.
value [required]The addition value.
case_insensitivityThe query case_insensitivity.
if_not_existsDEPRECATED Deprecated. Use if_tag_exists instead. The query if_not_exists.
if_tag_existsThe behavior when the tag already exists.
append, do_not_apply, replacequery [required]The query query.
reference_tableThe definition of RulesetRespDataAttributesRulesItemsReferenceTable object.
case_insensitivityThe reference_table case_insensitivity.
field_pairs [required]The reference_table field_pairs.
input_column [required]The items input_column.
output_key [required]The items output_key.
if_not_existsDEPRECATED Deprecated. Use if_tag_exists instead. The reference_table if_not_exists.
if_tag_existsThe behavior when the tag already exists.
append, do_not_apply, replacesource_keys [required]The reference_table source_keys.
table_name [required]The reference_table table_name.
version [required]The attributes version.
idThe RulesetRespData id.
type [required]Ruleset resource type.
rulesetruleset{
"data": {
"attributes": {
"created": null,
"enabled": true,
"last_modified_user_uuid": "",
"modified": null,
"name": "Example Ruleset",
"position": 0,
"rules": [
{
"enabled": false,
"mapping": null,
"metadata": null,
"name": "RC test rule edited1",
"query": {
"addition": {
"key": "abc",
"value": "ww"
},
"case_insensitivity": false,
"if_tag_exists": "do_not_apply",
"query": "billingcurrency:\"USD\" AND account_name:\"SZA96462\" AND billingcurrency:\"USD\""
},
"reference_table": null
},
{
"enabled": true,
"mapping": {
"destination_key": "h",
"if_tag_exists": "do_not_apply",
"source_keys": [
"accountname",
"accountownerid"
]
},
"metadata": null,
"name": "rule with empty source key",
"query": null,
"reference_table": null
},
{
"enabled": true,
"mapping": null,
"metadata": null,
"name": "New table rule with new UI",
"query": null,
"reference_table": {
"case_insensitivity": true,
"field_pairs": [
{
"input_column": "status_type",
"output_key": "status"
},
{
"input_column": "status_description",
"output_key": "dess"
}
],
"if_tag_exists": "append",
"source_keys": [
"http_status",
"status_description"
],
"table_name": "http_status_codes"
}
}
],
"version": 1
},
"id": "12345",
"type": "ruleset"
}
}Too many requests
API error response.
errors [required]A list of errors.
{
"errors": [
"Bad Request"
]
}Code Example
# Path parameters
export ruleset_id="CHANGE_ME"
# Set your Datadog site and credentials
export DD_SITE="datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X PATCH "https://api.${DD_SITE}/api/v2/tags/enrichment/${ruleset_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"enabled": true,
"last_version": 1,
"name": "Updated Ruleset",
"rules": [
{
"enabled": true,
"name": "Add Cost Center Tag",
"query": {
"addition": {
"key": "cost_center",
"value": "engineering"
},
"case_insensitivity": false,
"if_tag_exists": "do_not_apply",
"query": "account_id:\"123456789\" AND service:\"web-api\""
}
},
{
"enabled": true,
"mapping": {
"destination_key": "team_owner",
"if_tag_exists": "do_not_apply",
"source_keys": [
"account_name",
"account_id"
]
},
"name": "Account Name Mapping",
"query": null
},
{
"enabled": true,
"name": "New table rule with new UI",
"query": null,
"reference_table": {
"case_insensitivity": true,
"field_pairs": [
{
"input_column": "status_type",
"output_key": "status"
},
{
"input_column": "status_description",
"output_key": "dess"
}
],
"if_tag_exists": "append",
"source_keys": [
"http_status",
"status_description"
],
"table_name": "http_status_codes"
}
}
]
},
"type": "update_ruleset"
}
}
EOF# Path parameters
export ruleset_id="CHANGE_ME"
# Set your Datadog site and credentials
export DD_SITE="us3.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X PATCH "https://api.${DD_SITE}/api/v2/tags/enrichment/${ruleset_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"enabled": true,
"last_version": 1,
"name": "Updated Ruleset",
"rules": [
{
"enabled": true,
"name": "Add Cost Center Tag",
"query": {
"addition": {
"key": "cost_center",
"value": "engineering"
},
"case_insensitivity": false,
"if_tag_exists": "do_not_apply",
"query": "account_id:\"123456789\" AND service:\"web-api\""
}
},
{
"enabled": true,
"mapping": {
"destination_key": "team_owner",
"if_tag_exists": "do_not_apply",
"source_keys": [
"account_name",
"account_id"
]
},
"name": "Account Name Mapping",
"query": null
},
{
"enabled": true,
"name": "New table rule with new UI",
"query": null,
"reference_table": {
"case_insensitivity": true,
"field_pairs": [
{
"input_column": "status_type",
"output_key": "status"
},
{
"input_column": "status_description",
"output_key": "dess"
}
],
"if_tag_exists": "append",
"source_keys": [
"http_status",
"status_description"
],
"table_name": "http_status_codes"
}
}
]
},
"type": "update_ruleset"
}
}
EOF# Path parameters
export ruleset_id="CHANGE_ME"
# Set your Datadog site and credentials
export DD_SITE="us5.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X PATCH "https://api.${DD_SITE}/api/v2/tags/enrichment/${ruleset_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"enabled": true,
"last_version": 1,
"name": "Updated Ruleset",
"rules": [
{
"enabled": true,
"name": "Add Cost Center Tag",
"query": {
"addition": {
"key": "cost_center",
"value": "engineering"
},
"case_insensitivity": false,
"if_tag_exists": "do_not_apply",
"query": "account_id:\"123456789\" AND service:\"web-api\""
}
},
{
"enabled": true,
"mapping": {
"destination_key": "team_owner",
"if_tag_exists": "do_not_apply",
"source_keys": [
"account_name",
"account_id"
]
},
"name": "Account Name Mapping",
"query": null
},
{
"enabled": true,
"name": "New table rule with new UI",
"query": null,
"reference_table": {
"case_insensitivity": true,
"field_pairs": [
{
"input_column": "status_type",
"output_key": "status"
},
{
"input_column": "status_description",
"output_key": "dess"
}
],
"if_tag_exists": "append",
"source_keys": [
"http_status",
"status_description"
],
"table_name": "http_status_codes"
}
}
]
},
"type": "update_ruleset"
}
}
EOF# Path parameters
export ruleset_id="CHANGE_ME"
# Set your Datadog site and credentials
export DD_SITE="datadoghq.eu"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X PATCH "https://api.${DD_SITE}/api/v2/tags/enrichment/${ruleset_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"enabled": true,
"last_version": 1,
"name": "Updated Ruleset",
"rules": [
{
"enabled": true,
"name": "Add Cost Center Tag",
"query": {
"addition": {
"key": "cost_center",
"value": "engineering"
},
"case_insensitivity": false,
"if_tag_exists": "do_not_apply",
"query": "account_id:\"123456789\" AND service:\"web-api\""
}
},
{
"enabled": true,
"mapping": {
"destination_key": "team_owner",
"if_tag_exists": "do_not_apply",
"source_keys": [
"account_name",
"account_id"
]
},
"name": "Account Name Mapping",
"query": null
},
{
"enabled": true,
"name": "New table rule with new UI",
"query": null,
"reference_table": {
"case_insensitivity": true,
"field_pairs": [
{
"input_column": "status_type",
"output_key": "status"
},
{
"input_column": "status_description",
"output_key": "dess"
}
],
"if_tag_exists": "append",
"source_keys": [
"http_status",
"status_description"
],
"table_name": "http_status_codes"
}
}
]
},
"type": "update_ruleset"
}
}
EOF# Path parameters
export ruleset_id="CHANGE_ME"
# Set your Datadog site and credentials
export DD_SITE="ap1.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X PATCH "https://api.${DD_SITE}/api/v2/tags/enrichment/${ruleset_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"enabled": true,
"last_version": 1,
"name": "Updated Ruleset",
"rules": [
{
"enabled": true,
"name": "Add Cost Center Tag",
"query": {
"addition": {
"key": "cost_center",
"value": "engineering"
},
"case_insensitivity": false,
"if_tag_exists": "do_not_apply",
"query": "account_id:\"123456789\" AND service:\"web-api\""
}
},
{
"enabled": true,
"mapping": {
"destination_key": "team_owner",
"if_tag_exists": "do_not_apply",
"source_keys": [
"account_name",
"account_id"
]
},
"name": "Account Name Mapping",
"query": null
},
{
"enabled": true,
"name": "New table rule with new UI",
"query": null,
"reference_table": {
"case_insensitivity": true,
"field_pairs": [
{
"input_column": "status_type",
"output_key": "status"
},
{
"input_column": "status_description",
"output_key": "dess"
}
],
"if_tag_exists": "append",
"source_keys": [
"http_status",
"status_description"
],
"table_name": "http_status_codes"
}
}
]
},
"type": "update_ruleset"
}
}
EOF# Path parameters
export ruleset_id="CHANGE_ME"
# Set your Datadog site and credentials
export DD_SITE="ap2.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X PATCH "https://api.${DD_SITE}/api/v2/tags/enrichment/${ruleset_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"enabled": true,
"last_version": 1,
"name": "Updated Ruleset",
"rules": [
{
"enabled": true,
"name": "Add Cost Center Tag",
"query": {
"addition": {
"key": "cost_center",
"value": "engineering"
},
"case_insensitivity": false,
"if_tag_exists": "do_not_apply",
"query": "account_id:\"123456789\" AND service:\"web-api\""
}
},
{
"enabled": true,
"mapping": {
"destination_key": "team_owner",
"if_tag_exists": "do_not_apply",
"source_keys": [
"account_name",
"account_id"
]
},
"name": "Account Name Mapping",
"query": null
},
{
"enabled": true,
"name": "New table rule with new UI",
"query": null,
"reference_table": {
"case_insensitivity": true,
"field_pairs": [
{
"input_column": "status_type",
"output_key": "status"
},
{
"input_column": "status_description",
"output_key": "dess"
}
],
"if_tag_exists": "append",
"source_keys": [
"http_status",
"status_description"
],
"table_name": "http_status_codes"
}
}
]
},
"type": "update_ruleset"
}
}
EOF# Path parameters
export ruleset_id="CHANGE_ME"
# Set your Datadog site and credentials
export DD_SITE="uk1.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X PATCH "https://api.${DD_SITE}/api/v2/tags/enrichment/${ruleset_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"enabled": true,
"last_version": 1,
"name": "Updated Ruleset",
"rules": [
{
"enabled": true,
"name": "Add Cost Center Tag",
"query": {
"addition": {
"key": "cost_center",
"value": "engineering"
},
"case_insensitivity": false,
"if_tag_exists": "do_not_apply",
"query": "account_id:\"123456789\" AND service:\"web-api\""
}
},
{
"enabled": true,
"mapping": {
"destination_key": "team_owner",
"if_tag_exists": "do_not_apply",
"source_keys": [
"account_name",
"account_id"
]
},
"name": "Account Name Mapping",
"query": null
},
{
"enabled": true,
"name": "New table rule with new UI",
"query": null,
"reference_table": {
"case_insensitivity": true,
"field_pairs": [
{
"input_column": "status_type",
"output_key": "status"
},
{
"input_column": "status_description",
"output_key": "dess"
}
],
"if_tag_exists": "append",
"source_keys": [
"http_status",
"status_description"
],
"table_name": "http_status_codes"
}
}
]
},
"type": "update_ruleset"
}
}
EOF# Path parameters
export ruleset_id="CHANGE_ME"
# Set your Datadog site and credentials
export DD_SITE="ddog-gov.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X PATCH "https://api.${DD_SITE}/api/v2/tags/enrichment/${ruleset_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"enabled": true,
"last_version": 1,
"name": "Updated Ruleset",
"rules": [
{
"enabled": true,
"name": "Add Cost Center Tag",
"query": {
"addition": {
"key": "cost_center",
"value": "engineering"
},
"case_insensitivity": false,
"if_tag_exists": "do_not_apply",
"query": "account_id:\"123456789\" AND service:\"web-api\""
}
},
{
"enabled": true,
"mapping": {
"destination_key": "team_owner",
"if_tag_exists": "do_not_apply",
"source_keys": [
"account_name",
"account_id"
]
},
"name": "Account Name Mapping",
"query": null
},
{
"enabled": true,
"name": "New table rule with new UI",
"query": null,
"reference_table": {
"case_insensitivity": true,
"field_pairs": [
{
"input_column": "status_type",
"output_key": "status"
},
{
"input_column": "status_description",
"output_key": "dess"
}
],
"if_tag_exists": "append",
"source_keys": [
"http_status",
"status_description"
],
"table_name": "http_status_codes"
}
}
]
},
"type": "update_ruleset"
}
}
EOF# Path parameters
export ruleset_id="CHANGE_ME"
# Set your Datadog site and credentials
export DD_SITE="us2.ddog-gov.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X PATCH "https://api.${DD_SITE}/api/v2/tags/enrichment/${ruleset_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"enabled": true,
"last_version": 1,
"name": "Updated Ruleset",
"rules": [
{
"enabled": true,
"name": "Add Cost Center Tag",
"query": {
"addition": {
"key": "cost_center",
"value": "engineering"
},
"case_insensitivity": false,
"if_tag_exists": "do_not_apply",
"query": "account_id:\"123456789\" AND service:\"web-api\""
}
},
{
"enabled": true,
"mapping": {
"destination_key": "team_owner",
"if_tag_exists": "do_not_apply",
"source_keys": [
"account_name",
"account_id"
]
},
"name": "Account Name Mapping",
"query": null
},
{
"enabled": true,
"name": "New table rule with new UI",
"query": null,
"reference_table": {
"case_insensitivity": true,
"field_pairs": [
{
"input_column": "status_type",
"output_key": "status"
},
{
"input_column": "status_description",
"output_key": "dess"
}
],
"if_tag_exists": "append",
"source_keys": [
"http_status",
"status_description"
],
"table_name": "http_status_codes"
}
}
]
},
"type": "update_ruleset"
}
}
EOFUpdate tag pipeline ruleset returns "OK" response
// Update tag pipeline ruleset 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() {
body := datadogV2.UpdateRulesetRequest{
Data: &datadogV2.UpdateRulesetRequestData{
Attributes: &datadogV2.UpdateRulesetRequestDataAttributes{
Enabled: true,
LastVersion: datadog.PtrInt64(3611102),
Rules: []datadogV2.UpdateRulesetRequestDataAttributesRulesItems{
{
Enabled: true,
Mapping: *datadogV2.NewNullableDataAttributesRulesItemsMapping(&datadogV2.DataAttributesRulesItemsMapping{
DestinationKey: "team_owner",
IfNotExists: datadog.PtrBool(true),
SourceKeys: []string{
"account_name",
"account_id",
},
}),
Name: "Account Name Mapping",
Query: *datadogV2.NewNullableUpdateRulesetRequestDataAttributesRulesItemsQuery(nil),
ReferenceTable: *datadogV2.NewNullableUpdateRulesetRequestDataAttributesRulesItemsReferenceTable(nil),
},
},
},
Id: datadog.PtrString("New Ruleset"),
Type: datadogV2.UPDATERULESETREQUESTDATATYPE_UPDATE_RULESET,
},
}
ctx := datadog.NewDefaultContext(context.Background())
ctx = context.WithValue(ctx, datadog.ContextAccessToken, os.Getenv("DD_BEARER_TOKEN"))
configuration := datadog.NewConfiguration()
apiClient := datadog.NewAPIClient(configuration)
api := datadogV2.NewCloudCostManagementApi(apiClient)
resp, r, err := api.UpdateTagPipelinesRuleset(ctx, "ee10c3ff-312f-464c-b4f6-46adaa6d00a1", body)
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `CloudCostManagementApi.UpdateTagPipelinesRuleset`: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
responseContent, _ := json.MarshalIndent(resp, "", " ")
fmt.Fprintf(os.Stdout, "Response from `CloudCostManagementApi.UpdateTagPipelinesRuleset`:\n%s\n", responseContent)
}
Update tag pipeline ruleset with if_tag_exists returns "OK" response
// Update tag pipeline ruleset with if_tag_exists 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() {
body := datadogV2.UpdateRulesetRequest{
Data: &datadogV2.UpdateRulesetRequestData{
Attributes: &datadogV2.UpdateRulesetRequestDataAttributes{
Enabled: true,
LastVersion: datadog.PtrInt64(3611102),
Rules: []datadogV2.UpdateRulesetRequestDataAttributesRulesItems{
{
Enabled: true,
Mapping: *datadogV2.NewNullableDataAttributesRulesItemsMapping(&datadogV2.DataAttributesRulesItemsMapping{
DestinationKey: "team_owner",
IfTagExists: datadogV2.DATAATTRIBUTESRULESITEMSIFTAGEXISTS_REPLACE.Ptr(),
SourceKeys: []string{
"account_name",
"account_id",
},
}),
Name: "Account Name Mapping",
Query: *datadogV2.NewNullableUpdateRulesetRequestDataAttributesRulesItemsQuery(nil),
ReferenceTable: *datadogV2.NewNullableUpdateRulesetRequestDataAttributesRulesItemsReferenceTable(nil),
},
},
},
Id: datadog.PtrString("New Ruleset"),
Type: datadogV2.UPDATERULESETREQUESTDATATYPE_UPDATE_RULESET,
},
}
ctx := datadog.NewDefaultContext(context.Background())
ctx = context.WithValue(ctx, datadog.ContextAccessToken, os.Getenv("DD_BEARER_TOKEN"))
configuration := datadog.NewConfiguration()
apiClient := datadog.NewAPIClient(configuration)
api := datadogV2.NewCloudCostManagementApi(apiClient)
resp, r, err := api.UpdateTagPipelinesRuleset(ctx, "ee10c3ff-312f-464c-b4f6-46adaa6d00a1", body)
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `CloudCostManagementApi.UpdateTagPipelinesRuleset`: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
responseContent, _ := json.MarshalIndent(resp, "", " ")
fmt.Fprintf(os.Stdout, "Response from `CloudCostManagementApi.UpdateTagPipelinesRuleset`:\n%s\n", responseContent)
}
Instructions
First install the library and its dependencies and then save the example to main.go and run following commands:
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="us3.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="us5.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="datadoghq.eu" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="ap1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="ap2.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="uk1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="us2.ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"Update tag pipeline ruleset returns "OK" response
// Update tag pipeline ruleset returns "OK" response
import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.CloudCostManagementApi;
import com.datadog.api.client.v2.model.DataAttributesRulesItemsMapping;
import com.datadog.api.client.v2.model.RulesetResp;
import com.datadog.api.client.v2.model.UpdateRulesetRequest;
import com.datadog.api.client.v2.model.UpdateRulesetRequestData;
import com.datadog.api.client.v2.model.UpdateRulesetRequestDataAttributes;
import com.datadog.api.client.v2.model.UpdateRulesetRequestDataAttributesRulesItems;
import com.datadog.api.client.v2.model.UpdateRulesetRequestDataType;
import java.util.Arrays;
import java.util.Collections;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = ApiClient.getDefaultApiClient();
defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN"));
CloudCostManagementApi apiInstance = new CloudCostManagementApi(defaultClient);
UpdateRulesetRequest body =
new UpdateRulesetRequest()
.data(
new UpdateRulesetRequestData()
.attributes(
new UpdateRulesetRequestDataAttributes()
.enabled(true)
.lastVersion(3611102L)
.rules(
Collections.singletonList(
new UpdateRulesetRequestDataAttributesRulesItems()
.enabled(true)
.mapping(
new DataAttributesRulesItemsMapping()
.destinationKey("team_owner")
.ifNotExists(true)
.sourceKeys(
Arrays.asList("account_name", "account_id")))
.name("Account Name Mapping")
.query(null)
.referenceTable(null))))
.id("New Ruleset")
.type(UpdateRulesetRequestDataType.UPDATE_RULESET));
try {
RulesetResp result =
apiInstance.updateTagPipelinesRuleset("ee10c3ff-312f-464c-b4f6-46adaa6d00a1", body);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling CloudCostManagementApi#updateTagPipelinesRuleset");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Update tag pipeline ruleset with if_tag_exists returns "OK" response
// Update tag pipeline ruleset with if_tag_exists returns "OK" response
import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.CloudCostManagementApi;
import com.datadog.api.client.v2.model.DataAttributesRulesItemsIfTagExists;
import com.datadog.api.client.v2.model.DataAttributesRulesItemsMapping;
import com.datadog.api.client.v2.model.RulesetResp;
import com.datadog.api.client.v2.model.UpdateRulesetRequest;
import com.datadog.api.client.v2.model.UpdateRulesetRequestData;
import com.datadog.api.client.v2.model.UpdateRulesetRequestDataAttributes;
import com.datadog.api.client.v2.model.UpdateRulesetRequestDataAttributesRulesItems;
import com.datadog.api.client.v2.model.UpdateRulesetRequestDataType;
import java.util.Arrays;
import java.util.Collections;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = ApiClient.getDefaultApiClient();
defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN"));
CloudCostManagementApi apiInstance = new CloudCostManagementApi(defaultClient);
UpdateRulesetRequest body =
new UpdateRulesetRequest()
.data(
new UpdateRulesetRequestData()
.attributes(
new UpdateRulesetRequestDataAttributes()
.enabled(true)
.lastVersion(3611102L)
.rules(
Collections.singletonList(
new UpdateRulesetRequestDataAttributesRulesItems()
.enabled(true)
.mapping(
new DataAttributesRulesItemsMapping()
.destinationKey("team_owner")
.ifTagExists(
DataAttributesRulesItemsIfTagExists.REPLACE)
.sourceKeys(
Arrays.asList("account_name", "account_id")))
.name("Account Name Mapping")
.query(null)
.referenceTable(null))))
.id("New Ruleset")
.type(UpdateRulesetRequestDataType.UPDATE_RULESET));
try {
RulesetResp result =
apiInstance.updateTagPipelinesRuleset("ee10c3ff-312f-464c-b4f6-46adaa6d00a1", body);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling CloudCostManagementApi#updateTagPipelinesRuleset");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Instructions
First install the library and its dependencies and then save the example to Example.java and run following commands:
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="us3.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="us5.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="datadoghq.eu" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="ap1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="ap2.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="uk1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="us2.ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"Update tag pipeline ruleset returns "OK" response
"""
Update tag pipeline ruleset returns "OK" response
"""
from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.cloud_cost_management_api import CloudCostManagementApi
from datadog_api_client.v2.model.data_attributes_rules_items_mapping import DataAttributesRulesItemsMapping
from datadog_api_client.v2.model.update_ruleset_request import UpdateRulesetRequest
from datadog_api_client.v2.model.update_ruleset_request_data import UpdateRulesetRequestData
from datadog_api_client.v2.model.update_ruleset_request_data_attributes import UpdateRulesetRequestDataAttributes
from datadog_api_client.v2.model.update_ruleset_request_data_attributes_rules_items import (
UpdateRulesetRequestDataAttributesRulesItems,
)
from datadog_api_client.v2.model.update_ruleset_request_data_type import UpdateRulesetRequestDataType
body = UpdateRulesetRequest(
data=UpdateRulesetRequestData(
attributes=UpdateRulesetRequestDataAttributes(
enabled=True,
last_version=3611102,
rules=[
UpdateRulesetRequestDataAttributesRulesItems(
enabled=True,
mapping=DataAttributesRulesItemsMapping(
destination_key="team_owner",
if_not_exists=True,
source_keys=[
"account_name",
"account_id",
],
),
name="Account Name Mapping",
query=None,
reference_table=None,
),
],
),
id="New Ruleset",
type=UpdateRulesetRequestDataType.UPDATE_RULESET,
),
)
configuration = Configuration()
configuration.access_token = environ["DD_BEARER_TOKEN"]
with ApiClient(configuration) as api_client:
api_instance = CloudCostManagementApi(api_client)
response = api_instance.update_tag_pipelines_ruleset(ruleset_id="ee10c3ff-312f-464c-b4f6-46adaa6d00a1", body=body)
print(response)
Update tag pipeline ruleset with if_tag_exists returns "OK" response
"""
Update tag pipeline ruleset with if_tag_exists returns "OK" response
"""
from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.cloud_cost_management_api import CloudCostManagementApi
from datadog_api_client.v2.model.data_attributes_rules_items_if_tag_exists import DataAttributesRulesItemsIfTagExists
from datadog_api_client.v2.model.data_attributes_rules_items_mapping import DataAttributesRulesItemsMapping
from datadog_api_client.v2.model.update_ruleset_request import UpdateRulesetRequest
from datadog_api_client.v2.model.update_ruleset_request_data import UpdateRulesetRequestData
from datadog_api_client.v2.model.update_ruleset_request_data_attributes import UpdateRulesetRequestDataAttributes
from datadog_api_client.v2.model.update_ruleset_request_data_attributes_rules_items import (
UpdateRulesetRequestDataAttributesRulesItems,
)
from datadog_api_client.v2.model.update_ruleset_request_data_type import UpdateRulesetRequestDataType
body = UpdateRulesetRequest(
data=UpdateRulesetRequestData(
attributes=UpdateRulesetRequestDataAttributes(
enabled=True,
last_version=3611102,
rules=[
UpdateRulesetRequestDataAttributesRulesItems(
enabled=True,
mapping=DataAttributesRulesItemsMapping(
destination_key="team_owner",
if_tag_exists=DataAttributesRulesItemsIfTagExists.REPLACE,
source_keys=[
"account_name",
"account_id",
],
),
name="Account Name Mapping",
query=None,
reference_table=None,
),
],
),
id="New Ruleset",
type=UpdateRulesetRequestDataType.UPDATE_RULESET,
),
)
configuration = Configuration()
configuration.access_token = environ["DD_BEARER_TOKEN"]
with ApiClient(configuration) as api_client:
api_instance = CloudCostManagementApi(api_client)
response = api_instance.update_tag_pipelines_ruleset(ruleset_id="ee10c3ff-312f-464c-b4f6-46adaa6d00a1", body=body)
print(response)
Instructions
First install the library and its dependencies and then save the example to example.py and run following commands:
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="us3.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="us5.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="datadoghq.eu" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="ap1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="ap2.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="uk1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="us2.ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"Update tag pipeline ruleset returns "OK" response
# Update tag pipeline ruleset returns "OK" response
require "datadog_api_client"
DatadogAPIClient.configure do |config|
config.access_token = ENV["DD_BEARER_TOKEN"]
end
api_instance = DatadogAPIClient::V2::CloudCostManagementAPI.new
body = DatadogAPIClient::V2::UpdateRulesetRequest.new({
data: DatadogAPIClient::V2::UpdateRulesetRequestData.new({
attributes: DatadogAPIClient::V2::UpdateRulesetRequestDataAttributes.new({
enabled: true,
last_version: 3611102,
rules: [
DatadogAPIClient::V2::UpdateRulesetRequestDataAttributesRulesItems.new({
enabled: true,
mapping: DatadogAPIClient::V2::DataAttributesRulesItemsMapping.new({
destination_key: "team_owner",
if_not_exists: true,
source_keys: [
"account_name",
"account_id",
],
}),
name: "Account Name Mapping",
query: nil,
reference_table: nil,
}),
],
}),
id: "New Ruleset",
type: DatadogAPIClient::V2::UpdateRulesetRequestDataType::UPDATE_RULESET,
}),
})
p api_instance.update_tag_pipelines_ruleset("ee10c3ff-312f-464c-b4f6-46adaa6d00a1", body)
Update tag pipeline ruleset with if_tag_exists returns "OK" response
# Update tag pipeline ruleset with if_tag_exists returns "OK" response
require "datadog_api_client"
DatadogAPIClient.configure do |config|
config.access_token = ENV["DD_BEARER_TOKEN"]
end
api_instance = DatadogAPIClient::V2::CloudCostManagementAPI.new
body = DatadogAPIClient::V2::UpdateRulesetRequest.new({
data: DatadogAPIClient::V2::UpdateRulesetRequestData.new({
attributes: DatadogAPIClient::V2::UpdateRulesetRequestDataAttributes.new({
enabled: true,
last_version: 3611102,
rules: [
DatadogAPIClient::V2::UpdateRulesetRequestDataAttributesRulesItems.new({
enabled: true,
mapping: DatadogAPIClient::V2::DataAttributesRulesItemsMapping.new({
destination_key: "team_owner",
if_tag_exists: DatadogAPIClient::V2::DataAttributesRulesItemsIfTagExists::REPLACE,
source_keys: [
"account_name",
"account_id",
],
}),
name: "Account Name Mapping",
query: nil,
reference_table: nil,
}),
],
}),
id: "New Ruleset",
type: DatadogAPIClient::V2::UpdateRulesetRequestDataType::UPDATE_RULESET,
}),
})
p api_instance.update_tag_pipelines_ruleset("ee10c3ff-312f-464c-b4f6-46adaa6d00a1", body)
Instructions
First install the library and its dependencies and then save the example to example.rb and run following commands:
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="us3.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="us5.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="datadoghq.eu" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="ap1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="ap2.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="uk1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="us2.ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"Update tag pipeline ruleset returns "OK" response
// Update tag pipeline ruleset returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_cloud_cost_management::CloudCostManagementAPI;
use datadog_api_client::datadogV2::model::DataAttributesRulesItemsMapping;
use datadog_api_client::datadogV2::model::UpdateRulesetRequest;
use datadog_api_client::datadogV2::model::UpdateRulesetRequestData;
use datadog_api_client::datadogV2::model::UpdateRulesetRequestDataAttributes;
use datadog_api_client::datadogV2::model::UpdateRulesetRequestDataAttributesRulesItems;
use datadog_api_client::datadogV2::model::UpdateRulesetRequestDataType;
#[tokio::main]
async fn main() {
let body = UpdateRulesetRequest::new().data(
UpdateRulesetRequestData::new(UpdateRulesetRequestDataType::UPDATE_RULESET)
.attributes(
UpdateRulesetRequestDataAttributes::new(
true,
vec![UpdateRulesetRequestDataAttributesRulesItems::new(
true,
"Account Name Mapping".to_string(),
)
.mapping(Some(
DataAttributesRulesItemsMapping::new(
"team_owner".to_string(),
vec!["account_name".to_string(), "account_id".to_string()],
)
.if_not_exists(true),
))
.query(None)
.reference_table(None)],
)
.last_version(3611102),
)
.id("New Ruleset".to_string()),
);
let configuration = datadog::Configuration::new();
let api = CloudCostManagementAPI::with_config(configuration);
let resp = api
.update_tag_pipelines_ruleset("ee10c3ff-312f-464c-b4f6-46adaa6d00a1".to_string(), body)
.await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}
Update tag pipeline ruleset with if_tag_exists returns "OK" response
// Update tag pipeline ruleset with if_tag_exists returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_cloud_cost_management::CloudCostManagementAPI;
use datadog_api_client::datadogV2::model::DataAttributesRulesItemsIfTagExists;
use datadog_api_client::datadogV2::model::DataAttributesRulesItemsMapping;
use datadog_api_client::datadogV2::model::UpdateRulesetRequest;
use datadog_api_client::datadogV2::model::UpdateRulesetRequestData;
use datadog_api_client::datadogV2::model::UpdateRulesetRequestDataAttributes;
use datadog_api_client::datadogV2::model::UpdateRulesetRequestDataAttributesRulesItems;
use datadog_api_client::datadogV2::model::UpdateRulesetRequestDataType;
#[tokio::main]
async fn main() {
let body = UpdateRulesetRequest::new().data(
UpdateRulesetRequestData::new(UpdateRulesetRequestDataType::UPDATE_RULESET)
.attributes(
UpdateRulesetRequestDataAttributes::new(
true,
vec![UpdateRulesetRequestDataAttributesRulesItems::new(
true,
"Account Name Mapping".to_string(),
)
.mapping(Some(
DataAttributesRulesItemsMapping::new(
"team_owner".to_string(),
vec!["account_name".to_string(), "account_id".to_string()],
)
.if_tag_exists(DataAttributesRulesItemsIfTagExists::REPLACE),
))
.query(None)
.reference_table(None)],
)
.last_version(3611102),
)
.id("New Ruleset".to_string()),
);
let configuration = datadog::Configuration::new();
let api = CloudCostManagementAPI::with_config(configuration);
let resp = api
.update_tag_pipelines_ruleset("ee10c3ff-312f-464c-b4f6-46adaa6d00a1".to_string(), body)
.await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}
Instructions
First install the library and its dependencies and then save the example to src/main.rs and run following commands:
DD_SITE="datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo runDD_SITE="us3.datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo runDD_SITE="us5.datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo runDD_SITE="datadoghq.eu" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo runDD_SITE="ap1.datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo runDD_SITE="ap2.datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo runDD_SITE="uk1.datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo runDD_SITE="ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo runDD_SITE="us2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo runUpdate tag pipeline ruleset returns "OK" response
/**
* Update tag pipeline ruleset returns "OK" response
*/
import { client, v2 } from "@datadog/datadog-api-client";
const configuration = client.createConfiguration({
authMethods: {
AuthZ: {
accessToken: process.env.DD_BEARER_TOKEN as string,
},
},
});
const apiInstance = new v2.CloudCostManagementApi(configuration);
const params: v2.CloudCostManagementApiUpdateTagPipelinesRulesetRequest = {
body: {
data: {
attributes: {
enabled: true,
lastVersion: 3611102,
rules: [
{
enabled: true,
mapping: {
destinationKey: "team_owner",
ifNotExists: true,
sourceKeys: ["account_name", "account_id"],
},
name: "Account Name Mapping",
query: undefined,
referenceTable: undefined,
},
],
},
id: "New Ruleset",
type: "update_ruleset",
},
},
rulesetId: "ee10c3ff-312f-464c-b4f6-46adaa6d00a1",
};
apiInstance
.updateTagPipelinesRuleset(params)
.then((data: v2.RulesetResp) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
})
.catch((error: any) => console.error(error));
Update tag pipeline ruleset with if_tag_exists returns "OK" response
/**
* Update tag pipeline ruleset with if_tag_exists returns "OK" response
*/
import { client, v2 } from "@datadog/datadog-api-client";
const configuration = client.createConfiguration({
authMethods: {
AuthZ: {
accessToken: process.env.DD_BEARER_TOKEN as string,
},
},
});
const apiInstance = new v2.CloudCostManagementApi(configuration);
const params: v2.CloudCostManagementApiUpdateTagPipelinesRulesetRequest = {
body: {
data: {
attributes: {
enabled: true,
lastVersion: 3611102,
rules: [
{
enabled: true,
mapping: {
destinationKey: "team_owner",
ifTagExists: "replace",
sourceKeys: ["account_name", "account_id"],
},
name: "Account Name Mapping",
query: undefined,
referenceTable: undefined,
},
],
},
id: "New Ruleset",
type: "update_ruleset",
},
},
rulesetId: "ee10c3ff-312f-464c-b4f6-46adaa6d00a1",
};
apiInstance
.updateTagPipelinesRuleset(params)
.then((data: v2.RulesetResp) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
})
.catch((error: any) => console.error(error));
Instructions
First install the library and its dependencies and then save the example to example.ts and run following commands:
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="us3.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="us5.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="datadoghq.eu" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="ap1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="ap2.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="uk1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="us2.ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"