Sensitive Data Scanner group type.
Allowed enum values: sensitive_data_scanner_group
default: sensitive_data_scanner_group
type
enum
Sensitive Data Scanner configuration type.
Allowed enum values: sensitive_data_scanner_configuration
default: sensitive_data_scanner_configuration
included
[ <oneOf>]
Included objects from relationships.
Option 1
object
A Scanning Rule included item.
attributes
object
Attributes of the Sensitive Data Scanner rule.
description
string
Description of the rule.
excluded_namespaces
[string]
Attributes excluded from the scan. If namespaces is provided, it has to be a sub-path of the namespaces array.
included_keyword_configuration
object
Object defining a set of keywords and a number of characters that help reduce noise.
You can provide a list of keywords you would like to check within a defined proximity of the matching pattern.
If any of the keywords are found within the proximity check, the match is kept.
If none are found, the match is discarded.
character_count [required]
int64
The number of characters behind a match detected by Sensitive Data Scanner to look for the keywords defined.
character_count should be greater than the maximum length of a keyword defined for a rule.
keywords [required]
[string]
Keyword list that will be checked during scanning in order to validate a match.
The number of keywords in the list must be less than or equal to 30.
use_recommended_keywords
boolean
Should the rule use the underlying standard pattern keyword configuration. If set to true, the rule must be tied
to a standard pattern. If set to false, the specified keywords and character_count are applied.
is_enabled
boolean
Whether or not the rule is enabled.
name
string
Name of the rule.
namespaces
[string]
Attributes included in the scan. If namespaces is empty or missing, all attributes except excluded_namespaces are scanned.
If both are missing the whole event is scanned.
pattern
string
Not included if there is a relationship to a standard pattern.
priority
int64
Integer from 1 (high) to 5 (low) indicating rule issue severity.
tags
[string]
List of tags.
text_replacement
object
Object describing how the scanned event will be replaced.
number_of_chars
int64
Required if type == 'partial_replacement_from_beginning'
or 'partial_replacement_from_end'. It must be > 0.
replacement_string
string
Required if type == 'replacement_string'.
type
enum
Type of the replacement text. None means no replacement.
hash means the data will be stubbed. replacement_string means that
one can chose a text to replace the data. partial_replacement_from_beginning
allows a user to partially replace the data from the beginning, and
partial_replacement_from_end on the other hand, allows to replace data from
the end.
Allowed enum values: none,hash,replacement_string,partial_replacement_from_beginning,partial_replacement_from_end
default: none
id
string
ID of the rule.
relationships
object
Relationships of a scanning rule.
group
object
A scanning group data.
data
object
A scanning group.
id
string
ID of the group.
type
enum
Sensitive Data Scanner group type.
Allowed enum values: sensitive_data_scanner_group
default: sensitive_data_scanner_group
standard_pattern
object
A standard pattern.
data
object
Data containing the standard pattern id.
id
string
ID of the standard pattern.
type
enum
Sensitive Data Scanner standard pattern type.
Allowed enum values: sensitive_data_scanner_standard_pattern
default: sensitive_data_scanner_standard_pattern
type
enum
Sensitive Data Scanner rule type.
Allowed enum values: sensitive_data_scanner_rule
default: sensitive_data_scanner_rule
Option 2
object
A Scanning Group included item.
attributes
object
Attributes of the Sensitive Data Scanner group.
description
string
Description of the group.
filter
object
Filter for the Scanning Group.
query
string
Query to filter the events.
is_enabled
boolean
Whether or not the group is enabled.
name
string
Name of the group.
product_list
[string]
List of products the scanning group applies.
id
string
ID of the group.
relationships
object
Relationships of the group.
configuration
object
A Sensitive Data Scanner configuration data.
data
object
A Sensitive Data Scanner configuration.
id
string
ID of the configuration.
type
enum
Sensitive Data Scanner configuration type.
Allowed enum values: sensitive_data_scanner_configuration
default: sensitive_data_scanner_configuration
rules
object
Rules included in the group.
data
[object]
Rules included in the group. The order is important.
id
string
ID of the rule.
type
enum
Sensitive Data Scanner rule type.
Allowed enum values: sensitive_data_scanner_rule
default: sensitive_data_scanner_rule
type
enum
Sensitive Data Scanner group type.
Allowed enum values: sensitive_data_scanner_group
default: sensitive_data_scanner_group
meta
object
Meta response containing information about the API.
count_limit
int64
Maximum number of scanning rules allowed for the org.
group_count_limit
int64
Maximum number of scanning groups allowed for the org.
has_highlight_enabled
boolean
DEPRECATED: (Deprecated) Whether or not scanned events are highlighted in Logs or RUM for the org.
default: true
has_multi_pass_enabled
boolean
DEPRECATED: (Deprecated) Whether or not scanned events have multi-pass enabled.
is_pci_compliant
boolean
Whether or not the org is compliant to the payment card industry standard.
"""
List Scanning Groups returns "OK" response
"""fromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v2.api.sensitive_data_scanner_apiimportSensitiveDataScannerApiconfiguration=Configuration()withApiClient(configuration)asapi_client:api_instance=SensitiveDataScannerApi(api_client)response=api_instance.list_scanning_groups()print(response)
# List Scanning Groups returns "OK" responserequire"datadog_api_client"api_instance=DatadogAPIClient::V2::SensitiveDataScannerAPI.newpapi_instance.list_scanning_groups()
// List Scanning Groups returns "OK" response
packagemainimport("context""encoding/json""fmt""os""github.com/DataDog/datadog-api-client-go/v2/api/datadog""github.com/DataDog/datadog-api-client-go/v2/api/datadogV2")funcmain(){ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()apiClient:=datadog.NewAPIClient(configuration)api:=datadogV2.NewSensitiveDataScannerApi(apiClient)resp,r,err:=api.ListScanningGroups(ctx)iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `SensitiveDataScannerApi.ListScanningGroups`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}responseContent,_:=json.MarshalIndent(resp,""," ")fmt.Fprintf(os.Stdout,"Response from `SensitiveDataScannerApi.ListScanningGroups`:\n%s\n",responseContent)}
// List Scanning Groups returns "OK" responseimportcom.datadog.api.client.ApiClient;importcom.datadog.api.client.ApiException;importcom.datadog.api.client.v2.api.SensitiveDataScannerApi;importcom.datadog.api.client.v2.model.SensitiveDataScannerGetConfigResponse;publicclassExample{publicstaticvoidmain(String[]args){ApiClientdefaultClient=ApiClient.getDefaultApiClient();SensitiveDataScannerApiapiInstance=newSensitiveDataScannerApi(defaultClient);try{SensitiveDataScannerGetConfigResponseresult=apiInstance.listScanningGroups();System.out.println(result);}catch(ApiExceptione){System.err.println("Exception when calling SensitiveDataScannerApi#listScanningGroups");System.err.println("Status code: "+e.getCode());System.err.println("Reason: "+e.getResponseBody());System.err.println("Response headers: "+e.getResponseHeaders());e.printStackTrace();}}}
// List Scanning Groups returns "OK" response
usedatadog_api_client::datadog;usedatadog_api_client::datadogV2::api_sensitive_data_scanner::SensitiveDataScannerAPI;#[tokio::main]asyncfnmain(){letconfiguration=datadog::Configuration::new();letapi=SensitiveDataScannerAPI::with_config(configuration);letresp=api.list_scanning_groups().await;ifletOk(value)=resp{println!("{:#?}",value);}else{println!("{:#?}",resp.unwrap_err());}}
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com"DD_API_KEY="<API-KEY>"DD_APP_KEY="<APP-KEY>"cargo run
/**
* List Scanning Groups returns "OK" response
*/import{client,v2}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv2.SensitiveDataScannerApi(configuration);apiInstance.listScanningGroups().then((data: v2.SensitiveDataScannerGetConfigResponse)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));
// Reorder Groups returns "OK" response
packagemainimport("context""encoding/json""fmt""os""github.com/DataDog/datadog-api-client-go/v2/api/datadog""github.com/DataDog/datadog-api-client-go/v2/api/datadogV2")funcmain(){// there is a valid "scanning_group" in the system
GroupDataID:=os.Getenv("GROUP_DATA_ID")// a valid "configuration" in the system
ConfigurationDataID:=os.Getenv("CONFIGURATION_DATA_ID")body:=datadogV2.SensitiveDataScannerConfigRequest{Data:datadogV2.SensitiveDataScannerReorderConfig{Relationships:&datadogV2.SensitiveDataScannerConfigurationRelationships{Groups:&datadogV2.SensitiveDataScannerGroupList{Data:[]datadogV2.SensitiveDataScannerGroupItem{{Type:datadogV2.SENSITIVEDATASCANNERGROUPTYPE_SENSITIVE_DATA_SCANNER_GROUP.Ptr(),Id:datadog.PtrString(GroupDataID),},},},},Type:datadogV2.SENSITIVEDATASCANNERCONFIGURATIONTYPE_SENSITIVE_DATA_SCANNER_CONFIGURATIONS.Ptr(),Id:datadog.PtrString(ConfigurationDataID),},Meta:datadogV2.SensitiveDataScannerMetaVersionOnly{},}ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()apiClient:=datadog.NewAPIClient(configuration)api:=datadogV2.NewSensitiveDataScannerApi(apiClient)resp,r,err:=api.ReorderScanningGroups(ctx,body)iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `SensitiveDataScannerApi.ReorderScanningGroups`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}responseContent,_:=json.MarshalIndent(resp,""," ")fmt.Fprintf(os.Stdout,"Response from `SensitiveDataScannerApi.ReorderScanningGroups`:\n%s\n",responseContent)}
// Reorder Groups returns "OK" responseimportcom.datadog.api.client.ApiClient;importcom.datadog.api.client.ApiException;importcom.datadog.api.client.v2.api.SensitiveDataScannerApi;importcom.datadog.api.client.v2.model.SensitiveDataScannerConfigRequest;importcom.datadog.api.client.v2.model.SensitiveDataScannerConfigurationRelationships;importcom.datadog.api.client.v2.model.SensitiveDataScannerConfigurationType;importcom.datadog.api.client.v2.model.SensitiveDataScannerGroupItem;importcom.datadog.api.client.v2.model.SensitiveDataScannerGroupList;importcom.datadog.api.client.v2.model.SensitiveDataScannerGroupType;importcom.datadog.api.client.v2.model.SensitiveDataScannerMetaVersionOnly;importcom.datadog.api.client.v2.model.SensitiveDataScannerReorderConfig;importcom.datadog.api.client.v2.model.SensitiveDataScannerReorderGroupsResponse;importjava.util.Collections;publicclassExample{publicstaticvoidmain(String[]args){ApiClientdefaultClient=ApiClient.getDefaultApiClient();SensitiveDataScannerApiapiInstance=newSensitiveDataScannerApi(defaultClient);// there is a valid "scanning_group" in the systemStringGROUP_DATA_ID=System.getenv("GROUP_DATA_ID");// a valid "configuration" in the systemStringCONFIGURATION_DATA_ID=System.getenv("CONFIGURATION_DATA_ID");SensitiveDataScannerConfigRequestbody=newSensitiveDataScannerConfigRequest().data(newSensitiveDataScannerReorderConfig().relationships(newSensitiveDataScannerConfigurationRelationships().groups(newSensitiveDataScannerGroupList().data(Collections.singletonList(newSensitiveDataScannerGroupItem().type(SensitiveDataScannerGroupType.SENSITIVE_DATA_SCANNER_GROUP).id(GROUP_DATA_ID))))).type(SensitiveDataScannerConfigurationType.SENSITIVE_DATA_SCANNER_CONFIGURATIONS).id(CONFIGURATION_DATA_ID)).meta(newSensitiveDataScannerMetaVersionOnly());try{SensitiveDataScannerReorderGroupsResponseresult=apiInstance.reorderScanningGroups(body);System.out.println(result);}catch(ApiExceptione){System.err.println("Exception when calling SensitiveDataScannerApi#reorderScanningGroups");System.err.println("Status code: "+e.getCode());System.err.println("Reason: "+e.getResponseBody());System.err.println("Response headers: "+e.getResponseHeaders());e.printStackTrace();}}}
"""
Reorder Groups returns "OK" response
"""fromosimportenvironfromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v2.api.sensitive_data_scanner_apiimportSensitiveDataScannerApifromdatadog_api_client.v2.model.sensitive_data_scanner_config_requestimportSensitiveDataScannerConfigRequestfromdatadog_api_client.v2.model.sensitive_data_scanner_configuration_relationshipsimport(SensitiveDataScannerConfigurationRelationships,)fromdatadog_api_client.v2.model.sensitive_data_scanner_configuration_typeimportSensitiveDataScannerConfigurationTypefromdatadog_api_client.v2.model.sensitive_data_scanner_group_itemimportSensitiveDataScannerGroupItemfromdatadog_api_client.v2.model.sensitive_data_scanner_group_listimportSensitiveDataScannerGroupListfromdatadog_api_client.v2.model.sensitive_data_scanner_group_typeimportSensitiveDataScannerGroupTypefromdatadog_api_client.v2.model.sensitive_data_scanner_meta_version_onlyimportSensitiveDataScannerMetaVersionOnlyfromdatadog_api_client.v2.model.sensitive_data_scanner_reorder_configimportSensitiveDataScannerReorderConfig# there is a valid "scanning_group" in the systemGROUP_DATA_ID=environ["GROUP_DATA_ID"]# a valid "configuration" in the systemCONFIGURATION_DATA_ID=environ["CONFIGURATION_DATA_ID"]body=SensitiveDataScannerConfigRequest(data=SensitiveDataScannerReorderConfig(relationships=SensitiveDataScannerConfigurationRelationships(groups=SensitiveDataScannerGroupList(data=[SensitiveDataScannerGroupItem(type=SensitiveDataScannerGroupType.SENSITIVE_DATA_SCANNER_GROUP,id=GROUP_DATA_ID,),],),),type=SensitiveDataScannerConfigurationType.SENSITIVE_DATA_SCANNER_CONFIGURATIONS,id=CONFIGURATION_DATA_ID,),meta=SensitiveDataScannerMetaVersionOnly(),)configuration=Configuration()withApiClient(configuration)asapi_client:api_instance=SensitiveDataScannerApi(api_client)response=api_instance.reorder_scanning_groups(body=body)print(response)
# Reorder Groups returns "OK" responserequire"datadog_api_client"api_instance=DatadogAPIClient::V2::SensitiveDataScannerAPI.new# there is a valid "scanning_group" in the systemGROUP_DATA_ID=ENV["GROUP_DATA_ID"]# a valid "configuration" in the systemCONFIGURATION_DATA_ID=ENV["CONFIGURATION_DATA_ID"]body=DatadogAPIClient::V2::SensitiveDataScannerConfigRequest.new({data:DatadogAPIClient::V2::SensitiveDataScannerReorderConfig.new({relationships:DatadogAPIClient::V2::SensitiveDataScannerConfigurationRelationships.new({groups:DatadogAPIClient::V2::SensitiveDataScannerGroupList.new({data:[DatadogAPIClient::V2::SensitiveDataScannerGroupItem.new({type:DatadogAPIClient::V2::SensitiveDataScannerGroupType::SENSITIVE_DATA_SCANNER_GROUP,id:GROUP_DATA_ID,}),],}),}),type:DatadogAPIClient::V2::SensitiveDataScannerConfigurationType::SENSITIVE_DATA_SCANNER_CONFIGURATIONS,id:CONFIGURATION_DATA_ID,}),meta:DatadogAPIClient::V2::SensitiveDataScannerMetaVersionOnly.new({}),})papi_instance.reorder_scanning_groups(body)
// Reorder Groups returns "OK" response
usedatadog_api_client::datadog;usedatadog_api_client::datadogV2::api_sensitive_data_scanner::SensitiveDataScannerAPI;usedatadog_api_client::datadogV2::model::SensitiveDataScannerConfigRequest;usedatadog_api_client::datadogV2::model::SensitiveDataScannerConfigurationRelationships;usedatadog_api_client::datadogV2::model::SensitiveDataScannerConfigurationType;usedatadog_api_client::datadogV2::model::SensitiveDataScannerGroupItem;usedatadog_api_client::datadogV2::model::SensitiveDataScannerGroupList;usedatadog_api_client::datadogV2::model::SensitiveDataScannerGroupType;usedatadog_api_client::datadogV2::model::SensitiveDataScannerMetaVersionOnly;usedatadog_api_client::datadogV2::model::SensitiveDataScannerReorderConfig;#[tokio::main]asyncfnmain(){// there is a valid "scanning_group" in the system
letgroup_data_id=std::env::var("GROUP_DATA_ID").unwrap();// a valid "configuration" in the system
letconfiguration_data_id=std::env::var("CONFIGURATION_DATA_ID").unwrap();letbody=SensitiveDataScannerConfigRequest::new(SensitiveDataScannerReorderConfig::new().id(configuration_data_id.clone()).relationships(SensitiveDataScannerConfigurationRelationships::new().groups(SensitiveDataScannerGroupList::new().data(vec![SensitiveDataScannerGroupItem::new().id(group_data_id.clone()).type_(SensitiveDataScannerGroupType::SENSITIVE_DATA_SCANNER_GROUP),]),),).type_(SensitiveDataScannerConfigurationType::SENSITIVE_DATA_SCANNER_CONFIGURATIONS),SensitiveDataScannerMetaVersionOnly::new(),);letconfiguration=datadog::Configuration::new();letapi=SensitiveDataScannerAPI::with_config(configuration);letresp=api.reorder_scanning_groups(body).await;ifletOk(value)=resp{println!("{:#?}",value);}else{println!("{:#?}",resp.unwrap_err());}}
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com"DD_API_KEY="<API-KEY>"DD_APP_KEY="<APP-KEY>"cargo run
/**
* Reorder Groups returns "OK" response
*/import{client,v2}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv2.SensitiveDataScannerApi(configuration);// there is a valid "scanning_group" in the system
constGROUP_DATA_ID=process.env.GROUP_DATA_IDasstring;// a valid "configuration" in the system
constCONFIGURATION_DATA_ID=process.env.CONFIGURATION_DATA_IDasstring;constparams: v2.SensitiveDataScannerApiReorderScanningGroupsRequest={body:{data:{relationships:{groups:{data:[{type:"sensitive_data_scanner_group",id: GROUP_DATA_ID,},],},},type:"sensitive_data_scanner_configuration",id: CONFIGURATION_DATA_ID,},meta:{},},};apiInstance.reorderScanningGroups(params).then((data: v2.SensitiveDataScannerReorderGroupsResponse)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));
Attributes of the Sensitive Data Scanner standard pattern.
description
string
Description of the standard pattern.
included_keywords
[string]
List of included keywords.
name
string
Name of the standard pattern.
pattern
string
DEPRECATED: (Deprecated) Regex to match, optionally documented for older standard rules. Refer to the description field to understand what the rule does.
priority
int64
Integer from 1 (high) to 5 (low) indicating standard pattern issue severity.
tags
[string]
List of tags.
id
string
ID of the standard pattern.
type
enum
Sensitive Data Scanner standard pattern type.
Allowed enum values: sensitive_data_scanner_standard_pattern
"""
List standard patterns returns "OK" response
"""fromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v2.api.sensitive_data_scanner_apiimportSensitiveDataScannerApiconfiguration=Configuration()withApiClient(configuration)asapi_client:api_instance=SensitiveDataScannerApi(api_client)response=api_instance.list_standard_patterns()print(response)
# List standard patterns returns "OK" responserequire"datadog_api_client"api_instance=DatadogAPIClient::V2::SensitiveDataScannerAPI.newpapi_instance.list_standard_patterns()
// List standard patterns returns "OK" response
packagemainimport("context""encoding/json""fmt""os""github.com/DataDog/datadog-api-client-go/v2/api/datadog""github.com/DataDog/datadog-api-client-go/v2/api/datadogV2")funcmain(){ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()apiClient:=datadog.NewAPIClient(configuration)api:=datadogV2.NewSensitiveDataScannerApi(apiClient)resp,r,err:=api.ListStandardPatterns(ctx)iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `SensitiveDataScannerApi.ListStandardPatterns`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}responseContent,_:=json.MarshalIndent(resp,""," ")fmt.Fprintf(os.Stdout,"Response from `SensitiveDataScannerApi.ListStandardPatterns`:\n%s\n",responseContent)}
// List standard patterns returns "OK" responseimportcom.datadog.api.client.ApiClient;importcom.datadog.api.client.ApiException;importcom.datadog.api.client.v2.api.SensitiveDataScannerApi;importcom.datadog.api.client.v2.model.SensitiveDataScannerStandardPatternsResponseData;publicclassExample{publicstaticvoidmain(String[]args){ApiClientdefaultClient=ApiClient.getDefaultApiClient();SensitiveDataScannerApiapiInstance=newSensitiveDataScannerApi(defaultClient);try{SensitiveDataScannerStandardPatternsResponseDataresult=apiInstance.listStandardPatterns();System.out.println(result);}catch(ApiExceptione){System.err.println("Exception when calling SensitiveDataScannerApi#listStandardPatterns");System.err.println("Status code: "+e.getCode());System.err.println("Reason: "+e.getResponseBody());System.err.println("Response headers: "+e.getResponseHeaders());e.printStackTrace();}}}
// List standard patterns returns "OK" response
usedatadog_api_client::datadog;usedatadog_api_client::datadogV2::api_sensitive_data_scanner::SensitiveDataScannerAPI;#[tokio::main]asyncfnmain(){letconfiguration=datadog::Configuration::new();letapi=SensitiveDataScannerAPI::with_config(configuration);letresp=api.list_standard_patterns().await;ifletOk(value)=resp{println!("{:#?}",value);}else{println!("{:#?}",resp.unwrap_err());}}
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com"DD_API_KEY="<API-KEY>"DD_APP_KEY="<APP-KEY>"cargo run
/**
* List standard patterns returns "OK" response
*/import{client,v2}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv2.SensitiveDataScannerApi(configuration);apiInstance.listStandardPatterns().then((data: v2.SensitiveDataScannerStandardPatternsResponseData)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));
Create a scanning group.
The request MAY include a configuration relationship.
A rules relationship can be omitted entirely, but if it is included it MUST be
null or an empty array (rules cannot be created at the same time).
The new group will be ordered last within the configuration.
This endpoint requires the data_scanner_write permission.
// Create Scanning Group returns "OK" response
packagemainimport("context""encoding/json""fmt""os""github.com/DataDog/datadog-api-client-go/v2/api/datadog""github.com/DataDog/datadog-api-client-go/v2/api/datadogV2")funcmain(){// a valid "configuration" in the system
ConfigurationDataID:=os.Getenv("CONFIGURATION_DATA_ID")body:=datadogV2.SensitiveDataScannerGroupCreateRequest{Meta:&datadogV2.SensitiveDataScannerMetaVersionOnly{},Data:&datadogV2.SensitiveDataScannerGroupCreate{Type:datadogV2.SENSITIVEDATASCANNERGROUPTYPE_SENSITIVE_DATA_SCANNER_GROUP,Attributes:datadogV2.SensitiveDataScannerGroupAttributes{Name:datadog.PtrString("Example-Sensitive-Data-Scanner"),IsEnabled:datadog.PtrBool(false),ProductList:[]datadogV2.SensitiveDataScannerProduct{datadogV2.SENSITIVEDATASCANNERPRODUCT_LOGS,},Filter:&datadogV2.SensitiveDataScannerFilter{Query:datadog.PtrString("*"),},},Relationships:&datadogV2.SensitiveDataScannerGroupRelationships{Configuration:&datadogV2.SensitiveDataScannerConfigurationData{Data:&datadogV2.SensitiveDataScannerConfiguration{Type:datadogV2.SENSITIVEDATASCANNERCONFIGURATIONTYPE_SENSITIVE_DATA_SCANNER_CONFIGURATIONS.Ptr(),Id:datadog.PtrString(ConfigurationDataID),},},Rules:&datadogV2.SensitiveDataScannerRuleData{Data:[]datadogV2.SensitiveDataScannerRule{},},},},}ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()apiClient:=datadog.NewAPIClient(configuration)api:=datadogV2.NewSensitiveDataScannerApi(apiClient)resp,r,err:=api.CreateScanningGroup(ctx,body)iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `SensitiveDataScannerApi.CreateScanningGroup`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}responseContent,_:=json.MarshalIndent(resp,""," ")fmt.Fprintf(os.Stdout,"Response from `SensitiveDataScannerApi.CreateScanningGroup`:\n%s\n",responseContent)}
// Create Scanning Group returns "OK" responseimportcom.datadog.api.client.ApiClient;importcom.datadog.api.client.ApiException;importcom.datadog.api.client.v2.api.SensitiveDataScannerApi;importcom.datadog.api.client.v2.model.SensitiveDataScannerConfiguration;importcom.datadog.api.client.v2.model.SensitiveDataScannerConfigurationData;importcom.datadog.api.client.v2.model.SensitiveDataScannerConfigurationType;importcom.datadog.api.client.v2.model.SensitiveDataScannerCreateGroupResponse;importcom.datadog.api.client.v2.model.SensitiveDataScannerFilter;importcom.datadog.api.client.v2.model.SensitiveDataScannerGroupAttributes;importcom.datadog.api.client.v2.model.SensitiveDataScannerGroupCreate;importcom.datadog.api.client.v2.model.SensitiveDataScannerGroupCreateRequest;importcom.datadog.api.client.v2.model.SensitiveDataScannerGroupRelationships;importcom.datadog.api.client.v2.model.SensitiveDataScannerGroupType;importcom.datadog.api.client.v2.model.SensitiveDataScannerMetaVersionOnly;importcom.datadog.api.client.v2.model.SensitiveDataScannerProduct;importcom.datadog.api.client.v2.model.SensitiveDataScannerRuleData;importjava.util.Collections;publicclassExample{publicstaticvoidmain(String[]args){ApiClientdefaultClient=ApiClient.getDefaultApiClient();SensitiveDataScannerApiapiInstance=newSensitiveDataScannerApi(defaultClient);// a valid "configuration" in the systemStringCONFIGURATION_DATA_ID=System.getenv("CONFIGURATION_DATA_ID");SensitiveDataScannerGroupCreateRequestbody=newSensitiveDataScannerGroupCreateRequest().meta(newSensitiveDataScannerMetaVersionOnly()).data(newSensitiveDataScannerGroupCreate().type(SensitiveDataScannerGroupType.SENSITIVE_DATA_SCANNER_GROUP).attributes(newSensitiveDataScannerGroupAttributes().name("Example-Sensitive-Data-Scanner").isEnabled(false).productList(Collections.singletonList(SensitiveDataScannerProduct.LOGS)).filter(newSensitiveDataScannerFilter().query("*"))).relationships(newSensitiveDataScannerGroupRelationships().configuration(newSensitiveDataScannerConfigurationData().data(newSensitiveDataScannerConfiguration().type(SensitiveDataScannerConfigurationType.SENSITIVE_DATA_SCANNER_CONFIGURATIONS).id(CONFIGURATION_DATA_ID))).rules(newSensitiveDataScannerRuleData())));try{SensitiveDataScannerCreateGroupResponseresult=apiInstance.createScanningGroup(body);System.out.println(result);}catch(ApiExceptione){System.err.println("Exception when calling SensitiveDataScannerApi#createScanningGroup");System.err.println("Status code: "+e.getCode());System.err.println("Reason: "+e.getResponseBody());System.err.println("Response headers: "+e.getResponseHeaders());e.printStackTrace();}}}
"""
Create Scanning Group returns "OK" response
"""fromosimportenvironfromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v2.api.sensitive_data_scanner_apiimportSensitiveDataScannerApifromdatadog_api_client.v2.model.sensitive_data_scanner_configurationimportSensitiveDataScannerConfigurationfromdatadog_api_client.v2.model.sensitive_data_scanner_configuration_dataimportSensitiveDataScannerConfigurationDatafromdatadog_api_client.v2.model.sensitive_data_scanner_configuration_typeimportSensitiveDataScannerConfigurationTypefromdatadog_api_client.v2.model.sensitive_data_scanner_filterimportSensitiveDataScannerFilterfromdatadog_api_client.v2.model.sensitive_data_scanner_group_attributesimportSensitiveDataScannerGroupAttributesfromdatadog_api_client.v2.model.sensitive_data_scanner_group_createimportSensitiveDataScannerGroupCreatefromdatadog_api_client.v2.model.sensitive_data_scanner_group_create_requestimport(SensitiveDataScannerGroupCreateRequest,)fromdatadog_api_client.v2.model.sensitive_data_scanner_group_relationshipsimport(SensitiveDataScannerGroupRelationships,)fromdatadog_api_client.v2.model.sensitive_data_scanner_group_typeimportSensitiveDataScannerGroupTypefromdatadog_api_client.v2.model.sensitive_data_scanner_meta_version_onlyimportSensitiveDataScannerMetaVersionOnlyfromdatadog_api_client.v2.model.sensitive_data_scanner_productimportSensitiveDataScannerProductfromdatadog_api_client.v2.model.sensitive_data_scanner_rule_dataimportSensitiveDataScannerRuleData# a valid "configuration" in the systemCONFIGURATION_DATA_ID=environ["CONFIGURATION_DATA_ID"]body=SensitiveDataScannerGroupCreateRequest(meta=SensitiveDataScannerMetaVersionOnly(),data=SensitiveDataScannerGroupCreate(type=SensitiveDataScannerGroupType.SENSITIVE_DATA_SCANNER_GROUP,attributes=SensitiveDataScannerGroupAttributes(name="Example-Sensitive-Data-Scanner",is_enabled=False,product_list=[SensitiveDataScannerProduct.LOGS,],filter=SensitiveDataScannerFilter(query="*",),),relationships=SensitiveDataScannerGroupRelationships(configuration=SensitiveDataScannerConfigurationData(data=SensitiveDataScannerConfiguration(type=SensitiveDataScannerConfigurationType.SENSITIVE_DATA_SCANNER_CONFIGURATIONS,id=CONFIGURATION_DATA_ID,),),rules=SensitiveDataScannerRuleData(data=[],),),),)configuration=Configuration()withApiClient(configuration)asapi_client:api_instance=SensitiveDataScannerApi(api_client)response=api_instance.create_scanning_group(body=body)print(response)
# Create Scanning Group returns "OK" responserequire"datadog_api_client"api_instance=DatadogAPIClient::V2::SensitiveDataScannerAPI.new# a valid "configuration" in the systemCONFIGURATION_DATA_ID=ENV["CONFIGURATION_DATA_ID"]body=DatadogAPIClient::V2::SensitiveDataScannerGroupCreateRequest.new({meta:DatadogAPIClient::V2::SensitiveDataScannerMetaVersionOnly.new({}),data:DatadogAPIClient::V2::SensitiveDataScannerGroupCreate.new({type:DatadogAPIClient::V2::SensitiveDataScannerGroupType::SENSITIVE_DATA_SCANNER_GROUP,attributes:DatadogAPIClient::V2::SensitiveDataScannerGroupAttributes.new({name:"Example-Sensitive-Data-Scanner",is_enabled:false,product_list:[DatadogAPIClient::V2::SensitiveDataScannerProduct::LOGS,],filter:DatadogAPIClient::V2::SensitiveDataScannerFilter.new({query:"*",}),}),relationships:DatadogAPIClient::V2::SensitiveDataScannerGroupRelationships.new({configuration:DatadogAPIClient::V2::SensitiveDataScannerConfigurationData.new({data:DatadogAPIClient::V2::SensitiveDataScannerConfiguration.new({type:DatadogAPIClient::V2::SensitiveDataScannerConfigurationType::SENSITIVE_DATA_SCANNER_CONFIGURATIONS,id:CONFIGURATION_DATA_ID,}),}),rules:DatadogAPIClient::V2::SensitiveDataScannerRuleData.new({data:[],}),}),}),})papi_instance.create_scanning_group(body)
// Create Scanning Group returns "OK" response
usedatadog_api_client::datadog;usedatadog_api_client::datadogV2::api_sensitive_data_scanner::SensitiveDataScannerAPI;usedatadog_api_client::datadogV2::model::SensitiveDataScannerConfiguration;usedatadog_api_client::datadogV2::model::SensitiveDataScannerConfigurationData;usedatadog_api_client::datadogV2::model::SensitiveDataScannerConfigurationType;usedatadog_api_client::datadogV2::model::SensitiveDataScannerFilter;usedatadog_api_client::datadogV2::model::SensitiveDataScannerGroupAttributes;usedatadog_api_client::datadogV2::model::SensitiveDataScannerGroupCreate;usedatadog_api_client::datadogV2::model::SensitiveDataScannerGroupCreateRequest;usedatadog_api_client::datadogV2::model::SensitiveDataScannerGroupRelationships;usedatadog_api_client::datadogV2::model::SensitiveDataScannerGroupType;usedatadog_api_client::datadogV2::model::SensitiveDataScannerMetaVersionOnly;usedatadog_api_client::datadogV2::model::SensitiveDataScannerProduct;usedatadog_api_client::datadogV2::model::SensitiveDataScannerRuleData;#[tokio::main]asyncfnmain(){// a valid "configuration" in the system
letconfiguration_data_id=std::env::var("CONFIGURATION_DATA_ID").unwrap();letbody=SensitiveDataScannerGroupCreateRequest::new().data(SensitiveDataScannerGroupCreate::new(SensitiveDataScannerGroupAttributes::new().filter(SensitiveDataScannerFilter::new().query("*".to_string())).is_enabled(false).name("Example-Sensitive-Data-Scanner".to_string()).product_list(vec![SensitiveDataScannerProduct::LOGS]),SensitiveDataScannerGroupType::SENSITIVE_DATA_SCANNER_GROUP,).relationships(SensitiveDataScannerGroupRelationships::new().configuration(SensitiveDataScannerConfigurationData::new().data(SensitiveDataScannerConfiguration::new().id(configuration_data_id.clone()).type_(SensitiveDataScannerConfigurationType::SENSITIVE_DATA_SCANNER_CONFIGURATIONS,),),).rules(SensitiveDataScannerRuleData::new().data(vec![])),),).meta(SensitiveDataScannerMetaVersionOnly::new());letconfiguration=datadog::Configuration::new();letapi=SensitiveDataScannerAPI::with_config(configuration);letresp=api.create_scanning_group(body).await;ifletOk(value)=resp{println!("{:#?}",value);}else{println!("{:#?}",resp.unwrap_err());}}
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com"DD_API_KEY="<API-KEY>"DD_APP_KEY="<APP-KEY>"cargo run
/**
* Create Scanning Group returns "OK" response
*/import{client,v2}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv2.SensitiveDataScannerApi(configuration);// a valid "configuration" in the system
constCONFIGURATION_DATA_ID=process.env.CONFIGURATION_DATA_IDasstring;constparams: v2.SensitiveDataScannerApiCreateScanningGroupRequest={body:{meta:{},data:{type:"sensitive_data_scanner_group",attributes:{name:"Example-Sensitive-Data-Scanner",isEnabled: false,productList:["logs"],filter:{query:"*",},},relationships:{configuration:{data:{type:"sensitive_data_scanner_configuration",id: CONFIGURATION_DATA_ID,},},rules:{data:[],},},},},};apiInstance.createScanningGroup(params).then((data: v2.SensitiveDataScannerCreateGroupResponse)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));
Update a group, including the order of the rules.
Rules within the group are reordered by including a rules relationship. If the rules
relationship is present, its data section MUST contain linkages for all of the rules
currently in the group, and MUST NOT contain any others.
This endpoint requires the data_scanner_write permission.
// Update Scanning Group returns "OK" response
packagemainimport("context""encoding/json""fmt""os""github.com/DataDog/datadog-api-client-go/v2/api/datadog""github.com/DataDog/datadog-api-client-go/v2/api/datadogV2")funcmain(){// there is a valid "scanning_group" in the system
GroupDataID:=os.Getenv("GROUP_DATA_ID")// a valid "configuration" in the system
ConfigurationDataID:=os.Getenv("CONFIGURATION_DATA_ID")body:=datadogV2.SensitiveDataScannerGroupUpdateRequest{Meta:datadogV2.SensitiveDataScannerMetaVersionOnly{},Data:datadogV2.SensitiveDataScannerGroupUpdate{Id:datadog.PtrString(GroupDataID),Type:datadogV2.SENSITIVEDATASCANNERGROUPTYPE_SENSITIVE_DATA_SCANNER_GROUP.Ptr(),Attributes:&datadogV2.SensitiveDataScannerGroupAttributes{Name:datadog.PtrString("Example-Sensitive-Data-Scanner"),IsEnabled:datadog.PtrBool(false),ProductList:[]datadogV2.SensitiveDataScannerProduct{datadogV2.SENSITIVEDATASCANNERPRODUCT_LOGS,},Filter:&datadogV2.SensitiveDataScannerFilter{Query:datadog.PtrString("*"),},},Relationships:&datadogV2.SensitiveDataScannerGroupRelationships{Configuration:&datadogV2.SensitiveDataScannerConfigurationData{Data:&datadogV2.SensitiveDataScannerConfiguration{Type:datadogV2.SENSITIVEDATASCANNERCONFIGURATIONTYPE_SENSITIVE_DATA_SCANNER_CONFIGURATIONS.Ptr(),Id:datadog.PtrString(ConfigurationDataID),},},Rules:&datadogV2.SensitiveDataScannerRuleData{Data:[]datadogV2.SensitiveDataScannerRule{},},},},}ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()apiClient:=datadog.NewAPIClient(configuration)api:=datadogV2.NewSensitiveDataScannerApi(apiClient)resp,r,err:=api.UpdateScanningGroup(ctx,GroupDataID,body)iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `SensitiveDataScannerApi.UpdateScanningGroup`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}responseContent,_:=json.MarshalIndent(resp,""," ")fmt.Fprintf(os.Stdout,"Response from `SensitiveDataScannerApi.UpdateScanningGroup`:\n%s\n",responseContent)}
// Update Scanning Group returns "OK" responseimportcom.datadog.api.client.ApiClient;importcom.datadog.api.client.ApiException;importcom.datadog.api.client.v2.api.SensitiveDataScannerApi;importcom.datadog.api.client.v2.model.SensitiveDataScannerConfiguration;importcom.datadog.api.client.v2.model.SensitiveDataScannerConfigurationData;importcom.datadog.api.client.v2.model.SensitiveDataScannerConfigurationType;importcom.datadog.api.client.v2.model.SensitiveDataScannerFilter;importcom.datadog.api.client.v2.model.SensitiveDataScannerGroupAttributes;importcom.datadog.api.client.v2.model.SensitiveDataScannerGroupRelationships;importcom.datadog.api.client.v2.model.SensitiveDataScannerGroupType;importcom.datadog.api.client.v2.model.SensitiveDataScannerGroupUpdate;importcom.datadog.api.client.v2.model.SensitiveDataScannerGroupUpdateRequest;importcom.datadog.api.client.v2.model.SensitiveDataScannerGroupUpdateResponse;importcom.datadog.api.client.v2.model.SensitiveDataScannerMetaVersionOnly;importcom.datadog.api.client.v2.model.SensitiveDataScannerProduct;importcom.datadog.api.client.v2.model.SensitiveDataScannerRuleData;importjava.util.Collections;publicclassExample{publicstaticvoidmain(String[]args){ApiClientdefaultClient=ApiClient.getDefaultApiClient();SensitiveDataScannerApiapiInstance=newSensitiveDataScannerApi(defaultClient);// there is a valid "scanning_group" in the systemStringGROUP_DATA_ID=System.getenv("GROUP_DATA_ID");// a valid "configuration" in the systemStringCONFIGURATION_DATA_ID=System.getenv("CONFIGURATION_DATA_ID");SensitiveDataScannerGroupUpdateRequestbody=newSensitiveDataScannerGroupUpdateRequest().meta(newSensitiveDataScannerMetaVersionOnly()).data(newSensitiveDataScannerGroupUpdate().id(GROUP_DATA_ID).type(SensitiveDataScannerGroupType.SENSITIVE_DATA_SCANNER_GROUP).attributes(newSensitiveDataScannerGroupAttributes().name("Example-Sensitive-Data-Scanner").isEnabled(false).productList(Collections.singletonList(SensitiveDataScannerProduct.LOGS)).filter(newSensitiveDataScannerFilter().query("*"))).relationships(newSensitiveDataScannerGroupRelationships().configuration(newSensitiveDataScannerConfigurationData().data(newSensitiveDataScannerConfiguration().type(SensitiveDataScannerConfigurationType.SENSITIVE_DATA_SCANNER_CONFIGURATIONS).id(CONFIGURATION_DATA_ID))).rules(newSensitiveDataScannerRuleData())));try{SensitiveDataScannerGroupUpdateResponseresult=apiInstance.updateScanningGroup(GROUP_DATA_ID,body);System.out.println(result);}catch(ApiExceptione){System.err.println("Exception when calling SensitiveDataScannerApi#updateScanningGroup");System.err.println("Status code: "+e.getCode());System.err.println("Reason: "+e.getResponseBody());System.err.println("Response headers: "+e.getResponseHeaders());e.printStackTrace();}}}
"""
Update Scanning Group returns "OK" response
"""fromosimportenvironfromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v2.api.sensitive_data_scanner_apiimportSensitiveDataScannerApifromdatadog_api_client.v2.model.sensitive_data_scanner_configurationimportSensitiveDataScannerConfigurationfromdatadog_api_client.v2.model.sensitive_data_scanner_configuration_dataimportSensitiveDataScannerConfigurationDatafromdatadog_api_client.v2.model.sensitive_data_scanner_configuration_typeimportSensitiveDataScannerConfigurationTypefromdatadog_api_client.v2.model.sensitive_data_scanner_filterimportSensitiveDataScannerFilterfromdatadog_api_client.v2.model.sensitive_data_scanner_group_attributesimportSensitiveDataScannerGroupAttributesfromdatadog_api_client.v2.model.sensitive_data_scanner_group_relationshipsimport(SensitiveDataScannerGroupRelationships,)fromdatadog_api_client.v2.model.sensitive_data_scanner_group_typeimportSensitiveDataScannerGroupTypefromdatadog_api_client.v2.model.sensitive_data_scanner_group_updateimportSensitiveDataScannerGroupUpdatefromdatadog_api_client.v2.model.sensitive_data_scanner_group_update_requestimport(SensitiveDataScannerGroupUpdateRequest,)fromdatadog_api_client.v2.model.sensitive_data_scanner_meta_version_onlyimportSensitiveDataScannerMetaVersionOnlyfromdatadog_api_client.v2.model.sensitive_data_scanner_productimportSensitiveDataScannerProductfromdatadog_api_client.v2.model.sensitive_data_scanner_rule_dataimportSensitiveDataScannerRuleData# there is a valid "scanning_group" in the systemGROUP_DATA_ID=environ["GROUP_DATA_ID"]# a valid "configuration" in the systemCONFIGURATION_DATA_ID=environ["CONFIGURATION_DATA_ID"]body=SensitiveDataScannerGroupUpdateRequest(meta=SensitiveDataScannerMetaVersionOnly(),data=SensitiveDataScannerGroupUpdate(id=GROUP_DATA_ID,type=SensitiveDataScannerGroupType.SENSITIVE_DATA_SCANNER_GROUP,attributes=SensitiveDataScannerGroupAttributes(name="Example-Sensitive-Data-Scanner",is_enabled=False,product_list=[SensitiveDataScannerProduct.LOGS,],filter=SensitiveDataScannerFilter(query="*",),),relationships=SensitiveDataScannerGroupRelationships(configuration=SensitiveDataScannerConfigurationData(data=SensitiveDataScannerConfiguration(type=SensitiveDataScannerConfigurationType.SENSITIVE_DATA_SCANNER_CONFIGURATIONS,id=CONFIGURATION_DATA_ID,),),rules=SensitiveDataScannerRuleData(data=[],),),),)configuration=Configuration()withApiClient(configuration)asapi_client:api_instance=SensitiveDataScannerApi(api_client)response=api_instance.update_scanning_group(group_id=GROUP_DATA_ID,body=body)print(response)
# Update Scanning Group returns "OK" responserequire"datadog_api_client"api_instance=DatadogAPIClient::V2::SensitiveDataScannerAPI.new# there is a valid "scanning_group" in the systemGROUP_DATA_ID=ENV["GROUP_DATA_ID"]# a valid "configuration" in the systemCONFIGURATION_DATA_ID=ENV["CONFIGURATION_DATA_ID"]body=DatadogAPIClient::V2::SensitiveDataScannerGroupUpdateRequest.new({meta:DatadogAPIClient::V2::SensitiveDataScannerMetaVersionOnly.new({}),data:DatadogAPIClient::V2::SensitiveDataScannerGroupUpdate.new({id:GROUP_DATA_ID,type:DatadogAPIClient::V2::SensitiveDataScannerGroupType::SENSITIVE_DATA_SCANNER_GROUP,attributes:DatadogAPIClient::V2::SensitiveDataScannerGroupAttributes.new({name:"Example-Sensitive-Data-Scanner",is_enabled:false,product_list:[DatadogAPIClient::V2::SensitiveDataScannerProduct::LOGS,],filter:DatadogAPIClient::V2::SensitiveDataScannerFilter.new({query:"*",}),}),relationships:DatadogAPIClient::V2::SensitiveDataScannerGroupRelationships.new({configuration:DatadogAPIClient::V2::SensitiveDataScannerConfigurationData.new({data:DatadogAPIClient::V2::SensitiveDataScannerConfiguration.new({type:DatadogAPIClient::V2::SensitiveDataScannerConfigurationType::SENSITIVE_DATA_SCANNER_CONFIGURATIONS,id:CONFIGURATION_DATA_ID,}),}),rules:DatadogAPIClient::V2::SensitiveDataScannerRuleData.new({data:[],}),}),}),})papi_instance.update_scanning_group(GROUP_DATA_ID,body)
// Update Scanning Group returns "OK" response
usedatadog_api_client::datadog;usedatadog_api_client::datadogV2::api_sensitive_data_scanner::SensitiveDataScannerAPI;usedatadog_api_client::datadogV2::model::SensitiveDataScannerConfiguration;usedatadog_api_client::datadogV2::model::SensitiveDataScannerConfigurationData;usedatadog_api_client::datadogV2::model::SensitiveDataScannerConfigurationType;usedatadog_api_client::datadogV2::model::SensitiveDataScannerFilter;usedatadog_api_client::datadogV2::model::SensitiveDataScannerGroupAttributes;usedatadog_api_client::datadogV2::model::SensitiveDataScannerGroupRelationships;usedatadog_api_client::datadogV2::model::SensitiveDataScannerGroupType;usedatadog_api_client::datadogV2::model::SensitiveDataScannerGroupUpdate;usedatadog_api_client::datadogV2::model::SensitiveDataScannerGroupUpdateRequest;usedatadog_api_client::datadogV2::model::SensitiveDataScannerMetaVersionOnly;usedatadog_api_client::datadogV2::model::SensitiveDataScannerProduct;usedatadog_api_client::datadogV2::model::SensitiveDataScannerRuleData;#[tokio::main]asyncfnmain(){// there is a valid "scanning_group" in the system
letgroup_data_id=std::env::var("GROUP_DATA_ID").unwrap();// a valid "configuration" in the system
letconfiguration_data_id=std::env::var("CONFIGURATION_DATA_ID").unwrap();letbody=SensitiveDataScannerGroupUpdateRequest::new(SensitiveDataScannerGroupUpdate::new().attributes(SensitiveDataScannerGroupAttributes::new().filter(SensitiveDataScannerFilter::new().query("*".to_string())).is_enabled(false).name("Example-Sensitive-Data-Scanner".to_string()).product_list(vec![SensitiveDataScannerProduct::LOGS]),).id(group_data_id.clone()).relationships(SensitiveDataScannerGroupRelationships::new().configuration(SensitiveDataScannerConfigurationData::new().data(SensitiveDataScannerConfiguration::new().id(configuration_data_id.clone()).type_(SensitiveDataScannerConfigurationType::SENSITIVE_DATA_SCANNER_CONFIGURATIONS,),),).rules(SensitiveDataScannerRuleData::new().data(vec![])),).type_(SensitiveDataScannerGroupType::SENSITIVE_DATA_SCANNER_GROUP),SensitiveDataScannerMetaVersionOnly::new(),);letconfiguration=datadog::Configuration::new();letapi=SensitiveDataScannerAPI::with_config(configuration);letresp=api.update_scanning_group(group_data_id.clone(),body).await;ifletOk(value)=resp{println!("{:#?}",value);}else{println!("{:#?}",resp.unwrap_err());}}
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com"DD_API_KEY="<API-KEY>"DD_APP_KEY="<APP-KEY>"cargo run
/**
* Update Scanning Group returns "OK" response
*/import{client,v2}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv2.SensitiveDataScannerApi(configuration);// there is a valid "scanning_group" in the system
constGROUP_DATA_ID=process.env.GROUP_DATA_IDasstring;// a valid "configuration" in the system
constCONFIGURATION_DATA_ID=process.env.CONFIGURATION_DATA_IDasstring;constparams: v2.SensitiveDataScannerApiUpdateScanningGroupRequest={body:{meta:{},data:{id: GROUP_DATA_ID,type:"sensitive_data_scanner_group",attributes:{name:"Example-Sensitive-Data-Scanner",isEnabled: false,productList:["logs"],filter:{query:"*",},},relationships:{configuration:{data:{type:"sensitive_data_scanner_configuration",id: CONFIGURATION_DATA_ID,},},rules:{data:[],},},},},groupId: GROUP_DATA_ID,};apiInstance.updateScanningGroup(params).then((data: v2.SensitiveDataScannerGroupUpdateResponse)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));
// Delete Scanning Group returns "OK" response
packagemainimport("context""encoding/json""fmt""os""github.com/DataDog/datadog-api-client-go/v2/api/datadog""github.com/DataDog/datadog-api-client-go/v2/api/datadogV2")funcmain(){// there is a valid "scanning_group" in the system
GroupDataID:=os.Getenv("GROUP_DATA_ID")body:=datadogV2.SensitiveDataScannerGroupDeleteRequest{Meta:datadogV2.SensitiveDataScannerMetaVersionOnly{},}ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()apiClient:=datadog.NewAPIClient(configuration)api:=datadogV2.NewSensitiveDataScannerApi(apiClient)resp,r,err:=api.DeleteScanningGroup(ctx,GroupDataID,body)iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `SensitiveDataScannerApi.DeleteScanningGroup`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}responseContent,_:=json.MarshalIndent(resp,""," ")fmt.Fprintf(os.Stdout,"Response from `SensitiveDataScannerApi.DeleteScanningGroup`:\n%s\n",responseContent)}
// Delete Scanning Group returns "OK" responseimportcom.datadog.api.client.ApiClient;importcom.datadog.api.client.ApiException;importcom.datadog.api.client.v2.api.SensitiveDataScannerApi;importcom.datadog.api.client.v2.model.SensitiveDataScannerGroupDeleteRequest;importcom.datadog.api.client.v2.model.SensitiveDataScannerGroupDeleteResponse;importcom.datadog.api.client.v2.model.SensitiveDataScannerMetaVersionOnly;publicclassExample{publicstaticvoidmain(String[]args){ApiClientdefaultClient=ApiClient.getDefaultApiClient();SensitiveDataScannerApiapiInstance=newSensitiveDataScannerApi(defaultClient);// there is a valid "scanning_group" in the systemStringGROUP_DATA_ID=System.getenv("GROUP_DATA_ID");SensitiveDataScannerGroupDeleteRequestbody=newSensitiveDataScannerGroupDeleteRequest().meta(newSensitiveDataScannerMetaVersionOnly());try{SensitiveDataScannerGroupDeleteResponseresult=apiInstance.deleteScanningGroup(GROUP_DATA_ID,body);System.out.println(result);}catch(ApiExceptione){System.err.println("Exception when calling SensitiveDataScannerApi#deleteScanningGroup");System.err.println("Status code: "+e.getCode());System.err.println("Reason: "+e.getResponseBody());System.err.println("Response headers: "+e.getResponseHeaders());e.printStackTrace();}}}
"""
Delete Scanning Group returns "OK" response
"""fromosimportenvironfromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v2.api.sensitive_data_scanner_apiimportSensitiveDataScannerApifromdatadog_api_client.v2.model.sensitive_data_scanner_group_delete_requestimport(SensitiveDataScannerGroupDeleteRequest,)fromdatadog_api_client.v2.model.sensitive_data_scanner_meta_version_onlyimportSensitiveDataScannerMetaVersionOnly# there is a valid "scanning_group" in the systemGROUP_DATA_ID=environ["GROUP_DATA_ID"]body=SensitiveDataScannerGroupDeleteRequest(meta=SensitiveDataScannerMetaVersionOnly(),)configuration=Configuration()withApiClient(configuration)asapi_client:api_instance=SensitiveDataScannerApi(api_client)response=api_instance.delete_scanning_group(group_id=GROUP_DATA_ID,body=body)print(response)
# Delete Scanning Group returns "OK" responserequire"datadog_api_client"api_instance=DatadogAPIClient::V2::SensitiveDataScannerAPI.new# there is a valid "scanning_group" in the systemGROUP_DATA_ID=ENV["GROUP_DATA_ID"]body=DatadogAPIClient::V2::SensitiveDataScannerGroupDeleteRequest.new({meta:DatadogAPIClient::V2::SensitiveDataScannerMetaVersionOnly.new({}),})papi_instance.delete_scanning_group(GROUP_DATA_ID,body)
// Delete Scanning Group returns "OK" response
usedatadog_api_client::datadog;usedatadog_api_client::datadogV2::api_sensitive_data_scanner::SensitiveDataScannerAPI;usedatadog_api_client::datadogV2::model::SensitiveDataScannerGroupDeleteRequest;usedatadog_api_client::datadogV2::model::SensitiveDataScannerMetaVersionOnly;#[tokio::main]asyncfnmain(){// there is a valid "scanning_group" in the system
letgroup_data_id=std::env::var("GROUP_DATA_ID").unwrap();letbody=SensitiveDataScannerGroupDeleteRequest::new(SensitiveDataScannerMetaVersionOnly::new());letconfiguration=datadog::Configuration::new();letapi=SensitiveDataScannerAPI::with_config(configuration);letresp=api.delete_scanning_group(group_data_id.clone(),body).await;ifletOk(value)=resp{println!("{:#?}",value);}else{println!("{:#?}",resp.unwrap_err());}}
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com"DD_API_KEY="<API-KEY>"DD_APP_KEY="<APP-KEY>"cargo run
/**
* Delete Scanning Group returns "OK" response
*/import{client,v2}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv2.SensitiveDataScannerApi(configuration);// there is a valid "scanning_group" in the system
constGROUP_DATA_ID=process.env.GROUP_DATA_IDasstring;constparams: v2.SensitiveDataScannerApiDeleteScanningGroupRequest={body:{meta:{},},groupId: GROUP_DATA_ID,};apiInstance.deleteScanningGroup(params).then((data: v2.SensitiveDataScannerGroupDeleteResponse)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));
Create a scanning rule in a sensitive data scanner group, ordered last.
The posted rule MUST include a group relationship.
It MUST include either a standard_pattern relationship or a regex attribute, but not both.
If included_attributes is empty or missing, we will scan all attributes except
excluded_attributes. If both are missing, we will scan the whole event.
This endpoint requires the data_scanner_write permission.
Attributes excluded from the scan. If namespaces is provided, it has to be a sub-path of the namespaces array.
included_keyword_configuration
object
Object defining a set of keywords and a number of characters that help reduce noise.
You can provide a list of keywords you would like to check within a defined proximity of the matching pattern.
If any of the keywords are found within the proximity check, the match is kept.
If none are found, the match is discarded.
character_count [required]
int64
The number of characters behind a match detected by Sensitive Data Scanner to look for the keywords defined.
character_count should be greater than the maximum length of a keyword defined for a rule.
keywords [required]
[string]
Keyword list that will be checked during scanning in order to validate a match.
The number of keywords in the list must be less than or equal to 30.
use_recommended_keywords
boolean
Should the rule use the underlying standard pattern keyword configuration. If set to true, the rule must be tied
to a standard pattern. If set to false, the specified keywords and character_count are applied.
is_enabled
boolean
Whether or not the rule is enabled.
name
string
Name of the rule.
namespaces
[string]
Attributes included in the scan. If namespaces is empty or missing, all attributes except excluded_namespaces are scanned.
If both are missing the whole event is scanned.
pattern
string
Not included if there is a relationship to a standard pattern.
priority
int64
Integer from 1 (high) to 5 (low) indicating rule issue severity.
tags
[string]
List of tags.
text_replacement
object
Object describing how the scanned event will be replaced.
number_of_chars
int64
Required if type == 'partial_replacement_from_beginning'
or 'partial_replacement_from_end'. It must be > 0.
replacement_string
string
Required if type == 'replacement_string'.
type
enum
Type of the replacement text. None means no replacement.
hash means the data will be stubbed. replacement_string means that
one can chose a text to replace the data. partial_replacement_from_beginning
allows a user to partially replace the data from the beginning, and
partial_replacement_from_end on the other hand, allows to replace data from
the end.
Allowed enum values: none,hash,replacement_string,partial_replacement_from_beginning,partial_replacement_from_end
default: none
relationships [required]
object
Relationships of a scanning rule.
group
object
A scanning group data.
data
object
A scanning group.
id
string
ID of the group.
type
enum
Sensitive Data Scanner group type.
Allowed enum values: sensitive_data_scanner_group
default: sensitive_data_scanner_group
standard_pattern
object
A standard pattern.
data
object
Data containing the standard pattern id.
id
string
ID of the standard pattern.
type
enum
Sensitive Data Scanner standard pattern type.
Allowed enum values: sensitive_data_scanner_standard_pattern
default: sensitive_data_scanner_standard_pattern
type [required]
enum
Sensitive Data Scanner rule type.
Allowed enum values: sensitive_data_scanner_rule
default: sensitive_data_scanner_rule
meta [required]
object
Meta payload containing information about the API.
Attributes excluded from the scan. If namespaces is provided, it has to be a sub-path of the namespaces array.
included_keyword_configuration
object
Object defining a set of keywords and a number of characters that help reduce noise.
You can provide a list of keywords you would like to check within a defined proximity of the matching pattern.
If any of the keywords are found within the proximity check, the match is kept.
If none are found, the match is discarded.
character_count [required]
int64
The number of characters behind a match detected by Sensitive Data Scanner to look for the keywords defined.
character_count should be greater than the maximum length of a keyword defined for a rule.
keywords [required]
[string]
Keyword list that will be checked during scanning in order to validate a match.
The number of keywords in the list must be less than or equal to 30.
use_recommended_keywords
boolean
Should the rule use the underlying standard pattern keyword configuration. If set to true, the rule must be tied
to a standard pattern. If set to false, the specified keywords and character_count are applied.
is_enabled
boolean
Whether or not the rule is enabled.
name
string
Name of the rule.
namespaces
[string]
Attributes included in the scan. If namespaces is empty or missing, all attributes except excluded_namespaces are scanned.
If both are missing the whole event is scanned.
pattern
string
Not included if there is a relationship to a standard pattern.
priority
int64
Integer from 1 (high) to 5 (low) indicating rule issue severity.
tags
[string]
List of tags.
text_replacement
object
Object describing how the scanned event will be replaced.
number_of_chars
int64
Required if type == 'partial_replacement_from_beginning'
or 'partial_replacement_from_end'. It must be > 0.
replacement_string
string
Required if type == 'replacement_string'.
type
enum
Type of the replacement text. None means no replacement.
hash means the data will be stubbed. replacement_string means that
one can chose a text to replace the data. partial_replacement_from_beginning
allows a user to partially replace the data from the beginning, and
partial_replacement_from_end on the other hand, allows to replace data from
the end.
Allowed enum values: none,hash,replacement_string,partial_replacement_from_beginning,partial_replacement_from_end
default: none
id
string
ID of the rule.
relationships
object
Relationships of a scanning rule.
group
object
A scanning group data.
data
object
A scanning group.
id
string
ID of the group.
type
enum
Sensitive Data Scanner group type.
Allowed enum values: sensitive_data_scanner_group
default: sensitive_data_scanner_group
standard_pattern
object
A standard pattern.
data
object
Data containing the standard pattern id.
id
string
ID of the standard pattern.
type
enum
Sensitive Data Scanner standard pattern type.
Allowed enum values: sensitive_data_scanner_standard_pattern
default: sensitive_data_scanner_standard_pattern
type
enum
Sensitive Data Scanner rule type.
Allowed enum values: sensitive_data_scanner_rule
default: sensitive_data_scanner_rule
meta
object
Meta payload containing information about the API.
// Create Scanning Rule returns "OK" response
packagemainimport("context""encoding/json""fmt""os""github.com/DataDog/datadog-api-client-go/v2/api/datadog""github.com/DataDog/datadog-api-client-go/v2/api/datadogV2")funcmain(){// there is a valid "scanning_group" in the system
GroupDataID:=os.Getenv("GROUP_DATA_ID")body:=datadogV2.SensitiveDataScannerRuleCreateRequest{Meta:datadogV2.SensitiveDataScannerMetaVersionOnly{},Data:datadogV2.SensitiveDataScannerRuleCreate{Type:datadogV2.SENSITIVEDATASCANNERRULETYPE_SENSITIVE_DATA_SCANNER_RULE,Attributes:datadogV2.SensitiveDataScannerRuleAttributes{Name:datadog.PtrString("Example-Sensitive-Data-Scanner"),Pattern:datadog.PtrString("pattern"),Namespaces:[]string{"admin",},ExcludedNamespaces:[]string{"admin.name",},TextReplacement:&datadogV2.SensitiveDataScannerTextReplacement{Type:datadogV2.SENSITIVEDATASCANNERTEXTREPLACEMENTTYPE_NONE.Ptr(),},Tags:[]string{"sensitive_data:true",},IsEnabled:datadog.PtrBool(true),Priority:datadog.PtrInt64(1),IncludedKeywordConfiguration:&datadogV2.SensitiveDataScannerIncludedKeywordConfiguration{Keywords:[]string{"credit card",},CharacterCount:35,},},Relationships:datadogV2.SensitiveDataScannerRuleRelationships{Group:&datadogV2.SensitiveDataScannerGroupData{Data:&datadogV2.SensitiveDataScannerGroup{Type:datadogV2.SENSITIVEDATASCANNERGROUPTYPE_SENSITIVE_DATA_SCANNER_GROUP.Ptr(),Id:datadog.PtrString(GroupDataID),},},},},}ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()apiClient:=datadog.NewAPIClient(configuration)api:=datadogV2.NewSensitiveDataScannerApi(apiClient)resp,r,err:=api.CreateScanningRule(ctx,body)iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `SensitiveDataScannerApi.CreateScanningRule`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}responseContent,_:=json.MarshalIndent(resp,""," ")fmt.Fprintf(os.Stdout,"Response from `SensitiveDataScannerApi.CreateScanningRule`:\n%s\n",responseContent)}
// Create Scanning Rule returns "OK" responseimportcom.datadog.api.client.ApiClient;importcom.datadog.api.client.ApiException;importcom.datadog.api.client.v2.api.SensitiveDataScannerApi;importcom.datadog.api.client.v2.model.SensitiveDataScannerCreateRuleResponse;importcom.datadog.api.client.v2.model.SensitiveDataScannerGroup;importcom.datadog.api.client.v2.model.SensitiveDataScannerGroupData;importcom.datadog.api.client.v2.model.SensitiveDataScannerGroupType;importcom.datadog.api.client.v2.model.SensitiveDataScannerIncludedKeywordConfiguration;importcom.datadog.api.client.v2.model.SensitiveDataScannerMetaVersionOnly;importcom.datadog.api.client.v2.model.SensitiveDataScannerRuleAttributes;importcom.datadog.api.client.v2.model.SensitiveDataScannerRuleCreate;importcom.datadog.api.client.v2.model.SensitiveDataScannerRuleCreateRequest;importcom.datadog.api.client.v2.model.SensitiveDataScannerRuleRelationships;importcom.datadog.api.client.v2.model.SensitiveDataScannerRuleType;importcom.datadog.api.client.v2.model.SensitiveDataScannerTextReplacement;importcom.datadog.api.client.v2.model.SensitiveDataScannerTextReplacementType;importjava.util.Collections;publicclassExample{publicstaticvoidmain(String[]args){ApiClientdefaultClient=ApiClient.getDefaultApiClient();SensitiveDataScannerApiapiInstance=newSensitiveDataScannerApi(defaultClient);// there is a valid "scanning_group" in the systemStringGROUP_DATA_ID=System.getenv("GROUP_DATA_ID");SensitiveDataScannerRuleCreateRequestbody=newSensitiveDataScannerRuleCreateRequest().meta(newSensitiveDataScannerMetaVersionOnly()).data(newSensitiveDataScannerRuleCreate().type(SensitiveDataScannerRuleType.SENSITIVE_DATA_SCANNER_RULE).attributes(newSensitiveDataScannerRuleAttributes().name("Example-Sensitive-Data-Scanner").pattern("pattern").namespaces(Collections.singletonList("admin")).excludedNamespaces(Collections.singletonList("admin.name")).textReplacement(newSensitiveDataScannerTextReplacement().type(SensitiveDataScannerTextReplacementType.NONE)).tags(Collections.singletonList("sensitive_data:true")).isEnabled(true).priority(1L).includedKeywordConfiguration(newSensitiveDataScannerIncludedKeywordConfiguration().keywords(Collections.singletonList("credit card")).characterCount(35L))).relationships(newSensitiveDataScannerRuleRelationships().group(newSensitiveDataScannerGroupData().data(newSensitiveDataScannerGroup().type(SensitiveDataScannerGroupType.SENSITIVE_DATA_SCANNER_GROUP).id(GROUP_DATA_ID)))));try{SensitiveDataScannerCreateRuleResponseresult=apiInstance.createScanningRule(body);System.out.println(result);}catch(ApiExceptione){System.err.println("Exception when calling SensitiveDataScannerApi#createScanningRule");System.err.println("Status code: "+e.getCode());System.err.println("Reason: "+e.getResponseBody());System.err.println("Response headers: "+e.getResponseHeaders());e.printStackTrace();}}}
"""
Create Scanning Rule returns "OK" response
"""fromosimportenvironfromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v2.api.sensitive_data_scanner_apiimportSensitiveDataScannerApifromdatadog_api_client.v2.model.sensitive_data_scanner_groupimportSensitiveDataScannerGroupfromdatadog_api_client.v2.model.sensitive_data_scanner_group_dataimportSensitiveDataScannerGroupDatafromdatadog_api_client.v2.model.sensitive_data_scanner_group_typeimportSensitiveDataScannerGroupTypefromdatadog_api_client.v2.model.sensitive_data_scanner_included_keyword_configurationimport(SensitiveDataScannerIncludedKeywordConfiguration,)fromdatadog_api_client.v2.model.sensitive_data_scanner_meta_version_onlyimportSensitiveDataScannerMetaVersionOnlyfromdatadog_api_client.v2.model.sensitive_data_scanner_rule_attributesimportSensitiveDataScannerRuleAttributesfromdatadog_api_client.v2.model.sensitive_data_scanner_rule_createimportSensitiveDataScannerRuleCreatefromdatadog_api_client.v2.model.sensitive_data_scanner_rule_create_requestimportSensitiveDataScannerRuleCreateRequestfromdatadog_api_client.v2.model.sensitive_data_scanner_rule_relationshipsimportSensitiveDataScannerRuleRelationshipsfromdatadog_api_client.v2.model.sensitive_data_scanner_rule_typeimportSensitiveDataScannerRuleTypefromdatadog_api_client.v2.model.sensitive_data_scanner_text_replacementimportSensitiveDataScannerTextReplacementfromdatadog_api_client.v2.model.sensitive_data_scanner_text_replacement_typeimport(SensitiveDataScannerTextReplacementType,)# there is a valid "scanning_group" in the systemGROUP_DATA_ID=environ["GROUP_DATA_ID"]body=SensitiveDataScannerRuleCreateRequest(meta=SensitiveDataScannerMetaVersionOnly(),data=SensitiveDataScannerRuleCreate(type=SensitiveDataScannerRuleType.SENSITIVE_DATA_SCANNER_RULE,attributes=SensitiveDataScannerRuleAttributes(name="Example-Sensitive-Data-Scanner",pattern="pattern",namespaces=["admin",],excluded_namespaces=["admin.name",],text_replacement=SensitiveDataScannerTextReplacement(type=SensitiveDataScannerTextReplacementType.NONE,),tags=["sensitive_data:true",],is_enabled=True,priority=1,included_keyword_configuration=SensitiveDataScannerIncludedKeywordConfiguration(keywords=["credit card",],character_count=35,),),relationships=SensitiveDataScannerRuleRelationships(group=SensitiveDataScannerGroupData(data=SensitiveDataScannerGroup(type=SensitiveDataScannerGroupType.SENSITIVE_DATA_SCANNER_GROUP,id=GROUP_DATA_ID,),),),),)configuration=Configuration()withApiClient(configuration)asapi_client:api_instance=SensitiveDataScannerApi(api_client)response=api_instance.create_scanning_rule(body=body)print(response)
# Create Scanning Rule returns "OK" responserequire"datadog_api_client"api_instance=DatadogAPIClient::V2::SensitiveDataScannerAPI.new# there is a valid "scanning_group" in the systemGROUP_DATA_ID=ENV["GROUP_DATA_ID"]body=DatadogAPIClient::V2::SensitiveDataScannerRuleCreateRequest.new({meta:DatadogAPIClient::V2::SensitiveDataScannerMetaVersionOnly.new({}),data:DatadogAPIClient::V2::SensitiveDataScannerRuleCreate.new({type:DatadogAPIClient::V2::SensitiveDataScannerRuleType::SENSITIVE_DATA_SCANNER_RULE,attributes:DatadogAPIClient::V2::SensitiveDataScannerRuleAttributes.new({name:"Example-Sensitive-Data-Scanner",pattern:"pattern",namespaces:["admin",],excluded_namespaces:["admin.name",],text_replacement:DatadogAPIClient::V2::SensitiveDataScannerTextReplacement.new({type:DatadogAPIClient::V2::SensitiveDataScannerTextReplacementType::NONE,}),tags:["sensitive_data:true",],is_enabled:true,priority:1,included_keyword_configuration:DatadogAPIClient::V2::SensitiveDataScannerIncludedKeywordConfiguration.new({keywords:["credit card",],character_count:35,}),}),relationships:DatadogAPIClient::V2::SensitiveDataScannerRuleRelationships.new({group:DatadogAPIClient::V2::SensitiveDataScannerGroupData.new({data:DatadogAPIClient::V2::SensitiveDataScannerGroup.new({type:DatadogAPIClient::V2::SensitiveDataScannerGroupType::SENSITIVE_DATA_SCANNER_GROUP,id:GROUP_DATA_ID,}),}),}),}),})papi_instance.create_scanning_rule(body)
// Create Scanning Rule returns "OK" response
usedatadog_api_client::datadog;usedatadog_api_client::datadogV2::api_sensitive_data_scanner::SensitiveDataScannerAPI;usedatadog_api_client::datadogV2::model::SensitiveDataScannerGroup;usedatadog_api_client::datadogV2::model::SensitiveDataScannerGroupData;usedatadog_api_client::datadogV2::model::SensitiveDataScannerGroupType;usedatadog_api_client::datadogV2::model::SensitiveDataScannerIncludedKeywordConfiguration;usedatadog_api_client::datadogV2::model::SensitiveDataScannerMetaVersionOnly;usedatadog_api_client::datadogV2::model::SensitiveDataScannerRuleAttributes;usedatadog_api_client::datadogV2::model::SensitiveDataScannerRuleCreate;usedatadog_api_client::datadogV2::model::SensitiveDataScannerRuleCreateRequest;usedatadog_api_client::datadogV2::model::SensitiveDataScannerRuleRelationships;usedatadog_api_client::datadogV2::model::SensitiveDataScannerRuleType;usedatadog_api_client::datadogV2::model::SensitiveDataScannerTextReplacement;usedatadog_api_client::datadogV2::model::SensitiveDataScannerTextReplacementType;#[tokio::main]asyncfnmain(){// there is a valid "scanning_group" in the system
letgroup_data_id=std::env::var("GROUP_DATA_ID").unwrap();letbody=SensitiveDataScannerRuleCreateRequest::new(SensitiveDataScannerRuleCreate::new(SensitiveDataScannerRuleAttributes::new().excluded_namespaces(vec!["admin.name".to_string()]).included_keyword_configuration(SensitiveDataScannerIncludedKeywordConfiguration::new(35,vec!["credit card".to_string()],),).is_enabled(true).name("Example-Sensitive-Data-Scanner".to_string()).namespaces(vec!["admin".to_string()]).pattern("pattern".to_string()).priority(1).tags(vec!["sensitive_data:true".to_string()]).text_replacement(SensitiveDataScannerTextReplacement::new().type_(SensitiveDataScannerTextReplacementType::NONE),),SensitiveDataScannerRuleRelationships::new().group(SensitiveDataScannerGroupData::new().data(SensitiveDataScannerGroup::new().id(group_data_id.clone()).type_(SensitiveDataScannerGroupType::SENSITIVE_DATA_SCANNER_GROUP),),),SensitiveDataScannerRuleType::SENSITIVE_DATA_SCANNER_RULE,),SensitiveDataScannerMetaVersionOnly::new(),);letconfiguration=datadog::Configuration::new();letapi=SensitiveDataScannerAPI::with_config(configuration);letresp=api.create_scanning_rule(body).await;ifletOk(value)=resp{println!("{:#?}",value);}else{println!("{:#?}",resp.unwrap_err());}}
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com"DD_API_KEY="<API-KEY>"DD_APP_KEY="<APP-KEY>"cargo run
/**
* Create Scanning Rule returns "OK" response
*/import{client,v2}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv2.SensitiveDataScannerApi(configuration);// there is a valid "scanning_group" in the system
constGROUP_DATA_ID=process.env.GROUP_DATA_IDasstring;constparams: v2.SensitiveDataScannerApiCreateScanningRuleRequest={body:{meta:{},data:{type:"sensitive_data_scanner_rule",attributes:{name:"Example-Sensitive-Data-Scanner",pattern:"pattern",namespaces:["admin"],excludedNamespaces:["admin.name"],textReplacement:{type:"none",},tags:["sensitive_data:true"],isEnabled: true,priority: 1,includedKeywordConfiguration:{keywords:["credit card"],characterCount: 35,},},relationships:{group:{data:{type:"sensitive_data_scanner_group",id: GROUP_DATA_ID,},},},},},};apiInstance.createScanningRule(params).then((data: v2.SensitiveDataScannerCreateRuleResponse)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));
Update a scanning rule.
The request body MUST NOT include a standard_pattern relationship, as that relationship
is non-editable. Trying to edit the regex attribute of a rule with a standard_pattern
relationship will also result in an error.
This endpoint requires the data_scanner_write permission.
Attributes excluded from the scan. If namespaces is provided, it has to be a sub-path of the namespaces array.
included_keyword_configuration
object
Object defining a set of keywords and a number of characters that help reduce noise.
You can provide a list of keywords you would like to check within a defined proximity of the matching pattern.
If any of the keywords are found within the proximity check, the match is kept.
If none are found, the match is discarded.
character_count [required]
int64
The number of characters behind a match detected by Sensitive Data Scanner to look for the keywords defined.
character_count should be greater than the maximum length of a keyword defined for a rule.
keywords [required]
[string]
Keyword list that will be checked during scanning in order to validate a match.
The number of keywords in the list must be less than or equal to 30.
use_recommended_keywords
boolean
Should the rule use the underlying standard pattern keyword configuration. If set to true, the rule must be tied
to a standard pattern. If set to false, the specified keywords and character_count are applied.
is_enabled
boolean
Whether or not the rule is enabled.
name
string
Name of the rule.
namespaces
[string]
Attributes included in the scan. If namespaces is empty or missing, all attributes except excluded_namespaces are scanned.
If both are missing the whole event is scanned.
pattern
string
Not included if there is a relationship to a standard pattern.
priority
int64
Integer from 1 (high) to 5 (low) indicating rule issue severity.
tags
[string]
List of tags.
text_replacement
object
Object describing how the scanned event will be replaced.
number_of_chars
int64
Required if type == 'partial_replacement_from_beginning'
or 'partial_replacement_from_end'. It must be > 0.
replacement_string
string
Required if type == 'replacement_string'.
type
enum
Type of the replacement text. None means no replacement.
hash means the data will be stubbed. replacement_string means that
one can chose a text to replace the data. partial_replacement_from_beginning
allows a user to partially replace the data from the beginning, and
partial_replacement_from_end on the other hand, allows to replace data from
the end.
Allowed enum values: none,hash,replacement_string,partial_replacement_from_beginning,partial_replacement_from_end
default: none
id
string
ID of the rule.
relationships
object
Relationships of a scanning rule.
group
object
A scanning group data.
data
object
A scanning group.
id
string
ID of the group.
type
enum
Sensitive Data Scanner group type.
Allowed enum values: sensitive_data_scanner_group
default: sensitive_data_scanner_group
standard_pattern
object
A standard pattern.
data
object
Data containing the standard pattern id.
id
string
ID of the standard pattern.
type
enum
Sensitive Data Scanner standard pattern type.
Allowed enum values: sensitive_data_scanner_standard_pattern
default: sensitive_data_scanner_standard_pattern
type
enum
Sensitive Data Scanner rule type.
Allowed enum values: sensitive_data_scanner_rule
default: sensitive_data_scanner_rule
meta [required]
object
Meta payload containing information about the API.
// Update Scanning Rule returns "OK" response
packagemainimport("context""encoding/json""fmt""os""github.com/DataDog/datadog-api-client-go/v2/api/datadog""github.com/DataDog/datadog-api-client-go/v2/api/datadogV2")funcmain(){// the "scanning_group" has a "scanning_rule"
RuleDataID:=os.Getenv("RULE_DATA_ID")body:=datadogV2.SensitiveDataScannerRuleUpdateRequest{Meta:datadogV2.SensitiveDataScannerMetaVersionOnly{},Data:datadogV2.SensitiveDataScannerRuleUpdate{Id:datadog.PtrString(RuleDataID),Type:datadogV2.SENSITIVEDATASCANNERRULETYPE_SENSITIVE_DATA_SCANNER_RULE.Ptr(),Attributes:&datadogV2.SensitiveDataScannerRuleAttributes{Name:datadog.PtrString("Example-Sensitive-Data-Scanner"),Pattern:datadog.PtrString("pattern"),TextReplacement:&datadogV2.SensitiveDataScannerTextReplacement{Type:datadogV2.SENSITIVEDATASCANNERTEXTREPLACEMENTTYPE_NONE.Ptr(),},Tags:[]string{"sensitive_data:true",},IsEnabled:datadog.PtrBool(true),Priority:datadog.PtrInt64(5),IncludedKeywordConfiguration:&datadogV2.SensitiveDataScannerIncludedKeywordConfiguration{Keywords:[]string{"credit card","cc",},CharacterCount:35,},},},}ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()apiClient:=datadog.NewAPIClient(configuration)api:=datadogV2.NewSensitiveDataScannerApi(apiClient)resp,r,err:=api.UpdateScanningRule(ctx,RuleDataID,body)iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `SensitiveDataScannerApi.UpdateScanningRule`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}responseContent,_:=json.MarshalIndent(resp,""," ")fmt.Fprintf(os.Stdout,"Response from `SensitiveDataScannerApi.UpdateScanningRule`:\n%s\n",responseContent)}
"""
Update Scanning Rule returns "OK" response
"""fromosimportenvironfromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v2.api.sensitive_data_scanner_apiimportSensitiveDataScannerApifromdatadog_api_client.v2.model.sensitive_data_scanner_included_keyword_configurationimport(SensitiveDataScannerIncludedKeywordConfiguration,)fromdatadog_api_client.v2.model.sensitive_data_scanner_meta_version_onlyimportSensitiveDataScannerMetaVersionOnlyfromdatadog_api_client.v2.model.sensitive_data_scanner_rule_attributesimportSensitiveDataScannerRuleAttributesfromdatadog_api_client.v2.model.sensitive_data_scanner_rule_typeimportSensitiveDataScannerRuleTypefromdatadog_api_client.v2.model.sensitive_data_scanner_rule_updateimportSensitiveDataScannerRuleUpdatefromdatadog_api_client.v2.model.sensitive_data_scanner_rule_update_requestimportSensitiveDataScannerRuleUpdateRequestfromdatadog_api_client.v2.model.sensitive_data_scanner_text_replacementimportSensitiveDataScannerTextReplacementfromdatadog_api_client.v2.model.sensitive_data_scanner_text_replacement_typeimport(SensitiveDataScannerTextReplacementType,)# the "scanning_group" has a "scanning_rule"RULE_DATA_ID=environ["RULE_DATA_ID"]body=SensitiveDataScannerRuleUpdateRequest(meta=SensitiveDataScannerMetaVersionOnly(),data=SensitiveDataScannerRuleUpdate(id=RULE_DATA_ID,type=SensitiveDataScannerRuleType.SENSITIVE_DATA_SCANNER_RULE,attributes=SensitiveDataScannerRuleAttributes(name="Example-Sensitive-Data-Scanner",pattern="pattern",text_replacement=SensitiveDataScannerTextReplacement(type=SensitiveDataScannerTextReplacementType.NONE,),tags=["sensitive_data:true",],is_enabled=True,priority=5,included_keyword_configuration=SensitiveDataScannerIncludedKeywordConfiguration(keywords=["credit card","cc",],character_count=35,),),),)configuration=Configuration()withApiClient(configuration)asapi_client:api_instance=SensitiveDataScannerApi(api_client)response=api_instance.update_scanning_rule(rule_id=RULE_DATA_ID,body=body)print(response)
# Update Scanning Rule returns "OK" responserequire"datadog_api_client"api_instance=DatadogAPIClient::V2::SensitiveDataScannerAPI.new# the "scanning_group" has a "scanning_rule"RULE_DATA_ID=ENV["RULE_DATA_ID"]body=DatadogAPIClient::V2::SensitiveDataScannerRuleUpdateRequest.new({meta:DatadogAPIClient::V2::SensitiveDataScannerMetaVersionOnly.new({}),data:DatadogAPIClient::V2::SensitiveDataScannerRuleUpdate.new({id:RULE_DATA_ID,type:DatadogAPIClient::V2::SensitiveDataScannerRuleType::SENSITIVE_DATA_SCANNER_RULE,attributes:DatadogAPIClient::V2::SensitiveDataScannerRuleAttributes.new({name:"Example-Sensitive-Data-Scanner",pattern:"pattern",text_replacement:DatadogAPIClient::V2::SensitiveDataScannerTextReplacement.new({type:DatadogAPIClient::V2::SensitiveDataScannerTextReplacementType::NONE,}),tags:["sensitive_data:true",],is_enabled:true,priority:5,included_keyword_configuration:DatadogAPIClient::V2::SensitiveDataScannerIncludedKeywordConfiguration.new({keywords:["credit card","cc",],character_count:35,}),}),}),})papi_instance.update_scanning_rule(RULE_DATA_ID,body)
// Update Scanning Rule returns "OK" response
usedatadog_api_client::datadog;usedatadog_api_client::datadogV2::api_sensitive_data_scanner::SensitiveDataScannerAPI;usedatadog_api_client::datadogV2::model::SensitiveDataScannerIncludedKeywordConfiguration;usedatadog_api_client::datadogV2::model::SensitiveDataScannerMetaVersionOnly;usedatadog_api_client::datadogV2::model::SensitiveDataScannerRuleAttributes;usedatadog_api_client::datadogV2::model::SensitiveDataScannerRuleType;usedatadog_api_client::datadogV2::model::SensitiveDataScannerRuleUpdate;usedatadog_api_client::datadogV2::model::SensitiveDataScannerRuleUpdateRequest;usedatadog_api_client::datadogV2::model::SensitiveDataScannerTextReplacement;usedatadog_api_client::datadogV2::model::SensitiveDataScannerTextReplacementType;#[tokio::main]asyncfnmain(){// the "scanning_group" has a "scanning_rule"
letrule_data_id=std::env::var("RULE_DATA_ID").unwrap();letbody=SensitiveDataScannerRuleUpdateRequest::new(SensitiveDataScannerRuleUpdate::new().attributes(SensitiveDataScannerRuleAttributes::new().included_keyword_configuration(SensitiveDataScannerIncludedKeywordConfiguration::new(35,vec!["credit card".to_string(),"cc".to_string()],),).is_enabled(true).name("Example-Sensitive-Data-Scanner".to_string()).pattern("pattern".to_string()).priority(5).tags(vec!["sensitive_data:true".to_string()]).text_replacement(SensitiveDataScannerTextReplacement::new().type_(SensitiveDataScannerTextReplacementType::NONE),),).id(rule_data_id.clone()).type_(SensitiveDataScannerRuleType::SENSITIVE_DATA_SCANNER_RULE),SensitiveDataScannerMetaVersionOnly::new(),);letconfiguration=datadog::Configuration::new();letapi=SensitiveDataScannerAPI::with_config(configuration);letresp=api.update_scanning_rule(rule_data_id.clone(),body).await;ifletOk(value)=resp{println!("{:#?}",value);}else{println!("{:#?}",resp.unwrap_err());}}
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com"DD_API_KEY="<API-KEY>"DD_APP_KEY="<APP-KEY>"cargo run
/**
* Update Scanning Rule returns "OK" response
*/import{client,v2}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv2.SensitiveDataScannerApi(configuration);// the "scanning_group" has a "scanning_rule"
constRULE_DATA_ID=process.env.RULE_DATA_IDasstring;constparams: v2.SensitiveDataScannerApiUpdateScanningRuleRequest={body:{meta:{},data:{id: RULE_DATA_ID,type:"sensitive_data_scanner_rule",attributes:{name:"Example-Sensitive-Data-Scanner",pattern:"pattern",textReplacement:{type:"none",},tags:["sensitive_data:true"],isEnabled: true,priority: 5,includedKeywordConfiguration:{keywords:["credit card","cc"],characterCount: 35,},},},},ruleId: RULE_DATA_ID,};apiInstance.updateScanningRule(params).then((data: v2.SensitiveDataScannerRuleUpdateResponse)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));
// Delete Scanning Rule returns "OK" response
packagemainimport("context""encoding/json""fmt""os""github.com/DataDog/datadog-api-client-go/v2/api/datadog""github.com/DataDog/datadog-api-client-go/v2/api/datadogV2")funcmain(){// the "scanning_group" has a "scanning_rule"
RuleDataID:=os.Getenv("RULE_DATA_ID")body:=datadogV2.SensitiveDataScannerRuleDeleteRequest{Meta:datadogV2.SensitiveDataScannerMetaVersionOnly{},}ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()apiClient:=datadog.NewAPIClient(configuration)api:=datadogV2.NewSensitiveDataScannerApi(apiClient)resp,r,err:=api.DeleteScanningRule(ctx,RuleDataID,body)iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `SensitiveDataScannerApi.DeleteScanningRule`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}responseContent,_:=json.MarshalIndent(resp,""," ")fmt.Fprintf(os.Stdout,"Response from `SensitiveDataScannerApi.DeleteScanningRule`:\n%s\n",responseContent)}
// Delete Scanning Rule returns "OK" responseimportcom.datadog.api.client.ApiClient;importcom.datadog.api.client.ApiException;importcom.datadog.api.client.v2.api.SensitiveDataScannerApi;importcom.datadog.api.client.v2.model.SensitiveDataScannerMetaVersionOnly;importcom.datadog.api.client.v2.model.SensitiveDataScannerRuleDeleteRequest;importcom.datadog.api.client.v2.model.SensitiveDataScannerRuleDeleteResponse;publicclassExample{publicstaticvoidmain(String[]args){ApiClientdefaultClient=ApiClient.getDefaultApiClient();SensitiveDataScannerApiapiInstance=newSensitiveDataScannerApi(defaultClient);// the "scanning_group" has a "scanning_rule"StringRULE_DATA_ID=System.getenv("RULE_DATA_ID");SensitiveDataScannerRuleDeleteRequestbody=newSensitiveDataScannerRuleDeleteRequest().meta(newSensitiveDataScannerMetaVersionOnly());try{SensitiveDataScannerRuleDeleteResponseresult=apiInstance.deleteScanningRule(RULE_DATA_ID,body);System.out.println(result);}catch(ApiExceptione){System.err.println("Exception when calling SensitiveDataScannerApi#deleteScanningRule");System.err.println("Status code: "+e.getCode());System.err.println("Reason: "+e.getResponseBody());System.err.println("Response headers: "+e.getResponseHeaders());e.printStackTrace();}}}
"""
Delete Scanning Rule returns "OK" response
"""fromosimportenvironfromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v2.api.sensitive_data_scanner_apiimportSensitiveDataScannerApifromdatadog_api_client.v2.model.sensitive_data_scanner_meta_version_onlyimportSensitiveDataScannerMetaVersionOnlyfromdatadog_api_client.v2.model.sensitive_data_scanner_rule_delete_requestimportSensitiveDataScannerRuleDeleteRequest# the "scanning_group" has a "scanning_rule"RULE_DATA_ID=environ["RULE_DATA_ID"]body=SensitiveDataScannerRuleDeleteRequest(meta=SensitiveDataScannerMetaVersionOnly(),)configuration=Configuration()withApiClient(configuration)asapi_client:api_instance=SensitiveDataScannerApi(api_client)response=api_instance.delete_scanning_rule(rule_id=RULE_DATA_ID,body=body)print(response)
# Delete Scanning Rule returns "OK" responserequire"datadog_api_client"api_instance=DatadogAPIClient::V2::SensitiveDataScannerAPI.new# the "scanning_group" has a "scanning_rule"RULE_DATA_ID=ENV["RULE_DATA_ID"]body=DatadogAPIClient::V2::SensitiveDataScannerRuleDeleteRequest.new({meta:DatadogAPIClient::V2::SensitiveDataScannerMetaVersionOnly.new({}),})papi_instance.delete_scanning_rule(RULE_DATA_ID,body)
// Delete Scanning Rule returns "OK" response
usedatadog_api_client::datadog;usedatadog_api_client::datadogV2::api_sensitive_data_scanner::SensitiveDataScannerAPI;usedatadog_api_client::datadogV2::model::SensitiveDataScannerMetaVersionOnly;usedatadog_api_client::datadogV2::model::SensitiveDataScannerRuleDeleteRequest;#[tokio::main]asyncfnmain(){// the "scanning_group" has a "scanning_rule"
letrule_data_id=std::env::var("RULE_DATA_ID").unwrap();letbody=SensitiveDataScannerRuleDeleteRequest::new(SensitiveDataScannerMetaVersionOnly::new());letconfiguration=datadog::Configuration::new();letapi=SensitiveDataScannerAPI::with_config(configuration);letresp=api.delete_scanning_rule(rule_data_id.clone(),body).await;ifletOk(value)=resp{println!("{:#?}",value);}else{println!("{:#?}",resp.unwrap_err());}}
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com"DD_API_KEY="<API-KEY>"DD_APP_KEY="<APP-KEY>"cargo run
/**
* Delete Scanning Rule returns "OK" response
*/import{client,v2}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv2.SensitiveDataScannerApi(configuration);// the "scanning_group" has a "scanning_rule"
constRULE_DATA_ID=process.env.RULE_DATA_IDasstring;constparams: v2.SensitiveDataScannerApiDeleteScanningRuleRequest={body:{meta:{},},ruleId: RULE_DATA_ID,};apiInstance.deleteScanningRule(params).then((data: v2.SensitiveDataScannerRuleDeleteResponse)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));