For AI agents: A markdown version of this page is available at https://dnd37xeb23o8n.cloudfront.net/stefon.simmons/docs-astro-web-10435/es/api/latest/cloud-cost-management/create-tag-pipeline-ruleset.md. A documentation index is available at /llms.txt.
Language
Datadog site

Crear conjunto de reglas de pipeline de etiqueta

POSThttps://api.datadoghq.com/api/v2/tags/enrichmenthttps://api.us3.datadoghq.com/api/v2/tags/enrichmenthttps://api.us5.datadoghq.com/api/v2/tags/enrichmenthttps://api.datadoghq.eu/api/v2/tags/enrichmenthttps://api.ap1.datadoghq.com/api/v2/tags/enrichmenthttps://api.ap2.datadoghq.com/api/v2/tags/enrichmenthttps://api.uk1.datadoghq.com/api/v2/tags/enrichmenthttps://api.ddog-gov.com/api/v2/tags/enrichmenthttps://api.us2.ddog-gov.com/api/v2/tags/enrichment

Descripción general

Crea un nuevo conjunto de reglas de pipeline de etiqueta con las reglas y la configuración especificadas.

OAuth apps require the cloud_cost_management_write authorization scope to access this endpoint.

Solicitud

Body Data (required)

Campo
Type
Descripción
data
object

La definición del objeto CreateRulesetRequest.

Respuesta

OK

The definition of RulesetResp object.

Campo
Type
Descripción
data
object

The definition of RulesetRespData object.

Ejemplo de código

Create tag pipeline ruleset returns "OK" response
# 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 POST "https://api.${DD_SITE}/api/v2/tags/enrichment" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "enabled": true,
      "rules": [
        {
          "enabled": true,
          "mapping": null,
          "name": "Add Cost Center Tag",
          "query": {
            "addition": {
              "key": "cost_center",
              "value": "engineering"
            },
            "case_insensitivity": false,
            "if_not_exists": true,
            "query": "account_id:\"123456789\" AND service:\"web-api\""
          },
          "reference_table": null
        }
      ]
    },
    "id": "New Ruleset",
    "type": "create_ruleset"
  }
}
EOF
# 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 POST "https://api.${DD_SITE}/api/v2/tags/enrichment" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "enabled": true,
      "rules": [
        {
          "enabled": true,
          "mapping": null,
          "name": "Add Cost Center Tag",
          "query": {
            "addition": {
              "key": "cost_center",
              "value": "engineering"
            },
            "case_insensitivity": false,
            "if_not_exists": true,
            "query": "account_id:\"123456789\" AND service:\"web-api\""
          },
          "reference_table": null
        }
      ]
    },
    "id": "New Ruleset",
    "type": "create_ruleset"
  }
}
EOF
# 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 POST "https://api.${DD_SITE}/api/v2/tags/enrichment" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "enabled": true,
      "rules": [
        {
          "enabled": true,
          "mapping": null,
          "name": "Add Cost Center Tag",
          "query": {
            "addition": {
              "key": "cost_center",
              "value": "engineering"
            },
            "case_insensitivity": false,
            "if_not_exists": true,
            "query": "account_id:\"123456789\" AND service:\"web-api\""
          },
          "reference_table": null
        }
      ]
    },
    "id": "New Ruleset",
    "type": "create_ruleset"
  }
}
EOF
# 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 POST "https://api.${DD_SITE}/api/v2/tags/enrichment" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "enabled": true,
      "rules": [
        {
          "enabled": true,
          "mapping": null,
          "name": "Add Cost Center Tag",
          "query": {
            "addition": {
              "key": "cost_center",
              "value": "engineering"
            },
            "case_insensitivity": false,
            "if_not_exists": true,
            "query": "account_id:\"123456789\" AND service:\"web-api\""
          },
          "reference_table": null
        }
      ]
    },
    "id": "New Ruleset",
    "type": "create_ruleset"
  }
}
EOF
# 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 POST "https://api.${DD_SITE}/api/v2/tags/enrichment" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "enabled": true,
      "rules": [
        {
          "enabled": true,
          "mapping": null,
          "name": "Add Cost Center Tag",
          "query": {
            "addition": {
              "key": "cost_center",
              "value": "engineering"
            },
            "case_insensitivity": false,
            "if_not_exists": true,
            "query": "account_id:\"123456789\" AND service:\"web-api\""
          },
          "reference_table": null
        }
      ]
    },
    "id": "New Ruleset",
    "type": "create_ruleset"
  }
}
EOF
# 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 POST "https://api.${DD_SITE}/api/v2/tags/enrichment" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "enabled": true,
      "rules": [
        {
          "enabled": true,
          "mapping": null,
          "name": "Add Cost Center Tag",
          "query": {
            "addition": {
              "key": "cost_center",
              "value": "engineering"
            },
            "case_insensitivity": false,
            "if_not_exists": true,
            "query": "account_id:\"123456789\" AND service:\"web-api\""
          },
          "reference_table": null
        }
      ]
    },
    "id": "New Ruleset",
    "type": "create_ruleset"
  }
}
EOF
# 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 POST "https://api.${DD_SITE}/api/v2/tags/enrichment" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "enabled": true,
      "rules": [
        {
          "enabled": true,
          "mapping": null,
          "name": "Add Cost Center Tag",
          "query": {
            "addition": {
              "key": "cost_center",
              "value": "engineering"
            },
            "case_insensitivity": false,
            "if_not_exists": true,
            "query": "account_id:\"123456789\" AND service:\"web-api\""
          },
          "reference_table": null
        }
      ]
    },
    "id": "New Ruleset",
    "type": "create_ruleset"
  }
}
EOF
# 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 POST "https://api.${DD_SITE}/api/v2/tags/enrichment" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "enabled": true,
      "rules": [
        {
          "enabled": true,
          "mapping": null,
          "name": "Add Cost Center Tag",
          "query": {
            "addition": {
              "key": "cost_center",
              "value": "engineering"
            },
            "case_insensitivity": false,
            "if_not_exists": true,
            "query": "account_id:\"123456789\" AND service:\"web-api\""
          },
          "reference_table": null
        }
      ]
    },
    "id": "New Ruleset",
    "type": "create_ruleset"
  }
}
EOF
# 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 POST "https://api.${DD_SITE}/api/v2/tags/enrichment" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "enabled": true,
      "rules": [
        {
          "enabled": true,
          "mapping": null,
          "name": "Add Cost Center Tag",
          "query": {
            "addition": {
              "key": "cost_center",
              "value": "engineering"
            },
            "case_insensitivity": false,
            "if_not_exists": true,
            "query": "account_id:\"123456789\" AND service:\"web-api\""
          },
          "reference_table": null
        }
      ]
    },
    "id": "New Ruleset",
    "type": "create_ruleset"
  }
}
EOF
Create tag pipeline ruleset with if_tag_exists returns "OK" response
# 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 POST "https://api.${DD_SITE}/api/v2/tags/enrichment" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "enabled": true,
      "rules": [
        {
          "enabled": true,
          "mapping": null,
          "name": "Add Cost Center Tag",
          "query": {
            "addition": {
              "key": "cost_center",
              "value": "engineering"
            },
            "case_insensitivity": false,
            "if_tag_exists": "replace",
            "query": "account_id:\"123456789\" AND service:\"web-api\""
          },
          "reference_table": null
        }
      ]
    },
    "id": "New Ruleset",
    "type": "create_ruleset"
  }
}
EOF
# 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 POST "https://api.${DD_SITE}/api/v2/tags/enrichment" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "enabled": true,
      "rules": [
        {
          "enabled": true,
          "mapping": null,
          "name": "Add Cost Center Tag",
          "query": {
            "addition": {
              "key": "cost_center",
              "value": "engineering"
            },
            "case_insensitivity": false,
            "if_tag_exists": "replace",
            "query": "account_id:\"123456789\" AND service:\"web-api\""
          },
          "reference_table": null
        }
      ]
    },
    "id": "New Ruleset",
    "type": "create_ruleset"
  }
}
EOF
# 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 POST "https://api.${DD_SITE}/api/v2/tags/enrichment" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "enabled": true,
      "rules": [
        {
          "enabled": true,
          "mapping": null,
          "name": "Add Cost Center Tag",
          "query": {
            "addition": {
              "key": "cost_center",
              "value": "engineering"
            },
            "case_insensitivity": false,
            "if_tag_exists": "replace",
            "query": "account_id:\"123456789\" AND service:\"web-api\""
          },
          "reference_table": null
        }
      ]
    },
    "id": "New Ruleset",
    "type": "create_ruleset"
  }
}
EOF
# 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 POST "https://api.${DD_SITE}/api/v2/tags/enrichment" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "enabled": true,
      "rules": [
        {
          "enabled": true,
          "mapping": null,
          "name": "Add Cost Center Tag",
          "query": {
            "addition": {
              "key": "cost_center",
              "value": "engineering"
            },
            "case_insensitivity": false,
            "if_tag_exists": "replace",
            "query": "account_id:\"123456789\" AND service:\"web-api\""
          },
          "reference_table": null
        }
      ]
    },
    "id": "New Ruleset",
    "type": "create_ruleset"
  }
}
EOF
# 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 POST "https://api.${DD_SITE}/api/v2/tags/enrichment" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "enabled": true,
      "rules": [
        {
          "enabled": true,
          "mapping": null,
          "name": "Add Cost Center Tag",
          "query": {
            "addition": {
              "key": "cost_center",
              "value": "engineering"
            },
            "case_insensitivity": false,
            "if_tag_exists": "replace",
            "query": "account_id:\"123456789\" AND service:\"web-api\""
          },
          "reference_table": null
        }
      ]
    },
    "id": "New Ruleset",
    "type": "create_ruleset"
  }
}
EOF
# 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 POST "https://api.${DD_SITE}/api/v2/tags/enrichment" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "enabled": true,
      "rules": [
        {
          "enabled": true,
          "mapping": null,
          "name": "Add Cost Center Tag",
          "query": {
            "addition": {
              "key": "cost_center",
              "value": "engineering"
            },
            "case_insensitivity": false,
            "if_tag_exists": "replace",
            "query": "account_id:\"123456789\" AND service:\"web-api\""
          },
          "reference_table": null
        }
      ]
    },
    "id": "New Ruleset",
    "type": "create_ruleset"
  }
}
EOF
# 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 POST "https://api.${DD_SITE}/api/v2/tags/enrichment" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "enabled": true,
      "rules": [
        {
          "enabled": true,
          "mapping": null,
          "name": "Add Cost Center Tag",
          "query": {
            "addition": {
              "key": "cost_center",
              "value": "engineering"
            },
            "case_insensitivity": false,
            "if_tag_exists": "replace",
            "query": "account_id:\"123456789\" AND service:\"web-api\""
          },
          "reference_table": null
        }
      ]
    },
    "id": "New Ruleset",
    "type": "create_ruleset"
  }
}
EOF
# 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 POST "https://api.${DD_SITE}/api/v2/tags/enrichment" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "enabled": true,
      "rules": [
        {
          "enabled": true,
          "mapping": null,
          "name": "Add Cost Center Tag",
          "query": {
            "addition": {
              "key": "cost_center",
              "value": "engineering"
            },
            "case_insensitivity": false,
            "if_tag_exists": "replace",
            "query": "account_id:\"123456789\" AND service:\"web-api\""
          },
          "reference_table": null
        }
      ]
    },
    "id": "New Ruleset",
    "type": "create_ruleset"
  }
}
EOF
# 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 POST "https://api.${DD_SITE}/api/v2/tags/enrichment" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "enabled": true,
      "rules": [
        {
          "enabled": true,
          "mapping": null,
          "name": "Add Cost Center Tag",
          "query": {
            "addition": {
              "key": "cost_center",
              "value": "engineering"
            },
            "case_insensitivity": false,
            "if_tag_exists": "replace",
            "query": "account_id:\"123456789\" AND service:\"web-api\""
          },
          "reference_table": null
        }
      ]
    },
    "id": "New Ruleset",
    "type": "create_ruleset"
  }
}
EOF