Skip to content

Commit

Permalink
Change rowsLimit to integer and add tests covering rowsLimit, rowsLim…
Browse files Browse the repository at this point in the history
…itPercent, and sampleMethod
  • Loading branch information
Wallace Davidson committed Oct 29, 2022
1 parent 285d4c1 commit dfd0fe1
Show file tree
Hide file tree
Showing 5 changed files with 91 additions and 3 deletions.
2 changes: 1 addition & 1 deletion mmv1/products/dlp/api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ objects:
required: true
description: |
The name of the table.
- !ruby/object:Api::Type::String
- !ruby/object:Api::Type::Integer
name: 'rowsLimit'
description: |
Max number of rows to scan. If the table has more rows than this value, the rest of the rows are omitted.
Expand Down
14 changes: 14 additions & 0 deletions mmv1/products/dlp/terraform.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,20 @@ overrides: !ruby/object:Overrides::ResourceOverrides
trigger: "trigger"
test_env_vars:
project: :PROJECT_NAME
- !ruby/object:Provider::Terraform::Examples
name: "dlp_job_trigger_bigquery_row_limit"
primary_resource_id: "bigquery_row_limit"
vars:
trigger: "trigger"
test_env_vars:
project: :PROJECT_NAME
- !ruby/object:Provider::Terraform::Examples
name: "dlp_job_trigger_bigquery_row_limit_percentage"
primary_resource_id: "bigquery_row_limit_percentage"
vars:
trigger: "trigger"
test_env_vars:
project: :PROJECT_NAME
custom_code: !ruby/object:Provider::Terraform::CustomCode
encoder: templates/terraform/encoders/wrap_object.go.erb
custom_import: templates/terraform/custom_import/dlp_import.go.erb
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ resource "google_data_loss_prevention_job_trigger" "<%= ctx[:primary_resource_id
save_findings {
output_config {
table {
project_id = "asdf"
dataset_id = "asdf"
project_id = "project"
dataset_id = "dataset"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
resource "google_data_loss_prevention_job_trigger" "<%= ctx[:primary_resource_id] %>" {
parent = "projects/<%= ctx[:test_env_vars]['project'] %>"
description = "Description"
display_name = "Displayname"

triggers {
schedule {
recurrence_period_duration = "86400s"
}
}

inspect_job {
inspect_template_name = "fake"
actions {
save_findings {
output_config {
table {
project_id = "project"
dataset_id = "dataset"
}
}
}
}
storage_config {
big_query_options {
table_reference {
project_id = "project"
dataset_id = "dataset"
table_id = "table_to_scan"
}

rowsLimit = 1000
sampleMethod = "RANDOM_START"
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
resource "google_data_loss_prevention_job_trigger" "<%= ctx[:primary_resource_id] %>" {
parent = "projects/<%= ctx[:test_env_vars]['project'] %>"
description = "Description"
display_name = "Displayname"

triggers {
schedule {
recurrence_period_duration = "86400s"
}
}

inspect_job {
inspect_template_name = "fake"
actions {
save_findings {
output_config {
table {
project_id = "project"
dataset_id = "dataset"
}
}
}
}
storage_config {
big_query_options {
table_reference {
project_id = "project"
dataset_id = "dataset"
table_id = "table_to_scan"
}

rowsLimitPercent = 50
sampleMethod = "RANDOM_START"
}
}
}
}

0 comments on commit dfd0fe1

Please sign in to comment.