For AI agents: A markdown version of this page is available at https://dnd37xeb23o8n.cloudfront.net/jen.gilbert/astro-base/fr/api/latest/sensitive-data-scanner/update-scanning-rule.md. A documentation index is available at /llms.txt.
Language
Datadog site

Mettre à jour une règle d'analyse

PATCHhttps://api.datadoghq.com/api/v2/sensitive-data-scanner/config/rules/{rule_id}https://api.us3.datadoghq.com/api/v2/sensitive-data-scanner/config/rules/{rule_id}https://api.us5.datadoghq.com/api/v2/sensitive-data-scanner/config/rules/{rule_id}https://api.datadoghq.eu/api/v2/sensitive-data-scanner/config/rules/{rule_id}https://api.ap1.datadoghq.com/api/v2/sensitive-data-scanner/config/rules/{rule_id}https://api.ap2.datadoghq.com/api/v2/sensitive-data-scanner/config/rules/{rule_id}https://api.uk1.datadoghq.com/api/v2/sensitive-data-scanner/config/rules/{rule_id}https://api.ddog-gov.com/api/v2/sensitive-data-scanner/config/rules/{rule_id}https://api.us2.ddog-gov.com/api/v2/sensitive-data-scanner/config/rules/{rule_id}

Présentation

Mettez à jour une règle d'analyse. Le corps de la requête NE DOIT PAS inclure une relation standard_pattern, car cette relation n'est pas modifiable. Essayer de modifier l'attribut regex d'une règle avec une relation standard_pattern entraînera également une erreur.

This endpoint requires the data_scanner_write permission.

Arguments

Paramètres du chemin

Name
Type
Description
rule_id [required]
string

The ID of the rule.

Requête

Body Data (required)

Champ
Type
Description
data [required]
object

Mettez à jour une requête de règle.

meta [required]
object

Meta payload containing information about the API.

Réponse

OK

Update rule response.

Champ
Type
Description
meta
object

Meta payload containing information about the API.

Exemple de code

Update Scanning Rule returns "OK" response
# Path parameters
export rule_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/sensitive-data-scanner/config/rules/${rule_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "meta": {},
  "data": {
    "id": "string",
    "type": "sensitive_data_scanner_rule",
    "attributes": {
      "name": "Example-Sensitive-Data-Scanner",
      "pattern": "pattern",
      "text_replacement": {
        "type": "none"
      },
      "tags": [
        "sensitive_data:true"
      ],
      "is_enabled": true,
      "priority": 5,
      "included_keyword_configuration": {
        "keywords": [
          "credit card",
          "cc"
        ],
        "character_count": 35
      }
    }
  }
}
EOF
# Path parameters
export rule_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/sensitive-data-scanner/config/rules/${rule_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "meta": {},
  "data": {
    "id": "string",
    "type": "sensitive_data_scanner_rule",
    "attributes": {
      "name": "Example-Sensitive-Data-Scanner",
      "pattern": "pattern",
      "text_replacement": {
        "type": "none"
      },
      "tags": [
        "sensitive_data:true"
      ],
      "is_enabled": true,
      "priority": 5,
      "included_keyword_configuration": {
        "keywords": [
          "credit card",
          "cc"
        ],
        "character_count": 35
      }
    }
  }
}
EOF
# Path parameters
export rule_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/sensitive-data-scanner/config/rules/${rule_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "meta": {},
  "data": {
    "id": "string",
    "type": "sensitive_data_scanner_rule",
    "attributes": {
      "name": "Example-Sensitive-Data-Scanner",
      "pattern": "pattern",
      "text_replacement": {
        "type": "none"
      },
      "tags": [
        "sensitive_data:true"
      ],
      "is_enabled": true,
      "priority": 5,
      "included_keyword_configuration": {
        "keywords": [
          "credit card",
          "cc"
        ],
        "character_count": 35
      }
    }
  }
}
EOF
# Path parameters
export rule_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/sensitive-data-scanner/config/rules/${rule_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "meta": {},
  "data": {
    "id": "string",
    "type": "sensitive_data_scanner_rule",
    "attributes": {
      "name": "Example-Sensitive-Data-Scanner",
      "pattern": "pattern",
      "text_replacement": {
        "type": "none"
      },
      "tags": [
        "sensitive_data:true"
      ],
      "is_enabled": true,
      "priority": 5,
      "included_keyword_configuration": {
        "keywords": [
          "credit card",
          "cc"
        ],
        "character_count": 35
      }
    }
  }
}
EOF
# Path parameters
export rule_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/sensitive-data-scanner/config/rules/${rule_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "meta": {},
  "data": {
    "id": "string",
    "type": "sensitive_data_scanner_rule",
    "attributes": {
      "name": "Example-Sensitive-Data-Scanner",
      "pattern": "pattern",
      "text_replacement": {
        "type": "none"
      },
      "tags": [
        "sensitive_data:true"
      ],
      "is_enabled": true,
      "priority": 5,
      "included_keyword_configuration": {
        "keywords": [
          "credit card",
          "cc"
        ],
        "character_count": 35
      }
    }
  }
}
EOF
# Path parameters
export rule_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/sensitive-data-scanner/config/rules/${rule_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "meta": {},
  "data": {
    "id": "string",
    "type": "sensitive_data_scanner_rule",
    "attributes": {
      "name": "Example-Sensitive-Data-Scanner",
      "pattern": "pattern",
      "text_replacement": {
        "type": "none"
      },
      "tags": [
        "sensitive_data:true"
      ],
      "is_enabled": true,
      "priority": 5,
      "included_keyword_configuration": {
        "keywords": [
          "credit card",
          "cc"
        ],
        "character_count": 35
      }
    }
  }
}
EOF
# Path parameters
export rule_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/sensitive-data-scanner/config/rules/${rule_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "meta": {},
  "data": {
    "id": "string",
    "type": "sensitive_data_scanner_rule",
    "attributes": {
      "name": "Example-Sensitive-Data-Scanner",
      "pattern": "pattern",
      "text_replacement": {
        "type": "none"
      },
      "tags": [
        "sensitive_data:true"
      ],
      "is_enabled": true,
      "priority": 5,
      "included_keyword_configuration": {
        "keywords": [
          "credit card",
          "cc"
        ],
        "character_count": 35
      }
    }
  }
}
EOF
# Path parameters
export rule_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/sensitive-data-scanner/config/rules/${rule_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "meta": {},
  "data": {
    "id": "string",
    "type": "sensitive_data_scanner_rule",
    "attributes": {
      "name": "Example-Sensitive-Data-Scanner",
      "pattern": "pattern",
      "text_replacement": {
        "type": "none"
      },
      "tags": [
        "sensitive_data:true"
      ],
      "is_enabled": true,
      "priority": 5,
      "included_keyword_configuration": {
        "keywords": [
          "credit card",
          "cc"
        ],
        "character_count": 35
      }
    }
  }
}
EOF
# Path parameters
export rule_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/sensitive-data-scanner/config/rules/${rule_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "meta": {},
  "data": {
    "id": "string",
    "type": "sensitive_data_scanner_rule",
    "attributes": {
      "name": "Example-Sensitive-Data-Scanner",
      "pattern": "pattern",
      "text_replacement": {
        "type": "none"
      },
      "tags": [
        "sensitive_data:true"
      ],
      "is_enabled": true,
      "priority": 5,
      "included_keyword_configuration": {
        "keywords": [
          "credit card",
          "cc"
        ],
        "character_count": 35
      }
    }
  }
}
EOF