Skip to content

Commit c020833

Browse files
omerdemirokactions-user
authored andcommitted
Add GCP Dataplex Data Scan adapter (#2549)
## Summary - Creates new adapter for Dataplex data scans - Supports GET and SEARCH operations with location-based queries - Defines blast propagation rules for Dataplex entities and storage resources - Includes terraform mapping support GitOrigin-RevId: c5f6e05282f76d45e45aface0eebbb3eb1259f60
1 parent 2179833 commit c020833

File tree

3 files changed

+64
-0
lines changed

3 files changed

+64
-0
lines changed
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
package adapters
2+
3+
import (
4+
"github.com/overmindtech/cli/sdp-go"
5+
gcpshared "github.com/overmindtech/cli/sources/gcp/shared"
6+
)
7+
8+
// Dataplex Data Scan allows you to perform data quality checks, profiling, and discovery within data assets in Dataplex
9+
// GCP Ref (GET): https://cloud.google.com/dataplex/docs/reference/rest/v1/projects.locations.dataScans/get
10+
// GCP Ref (Schema): https://cloud.google.com/dataplex/docs/reference/rest/v1/projects.locations.dataScans#DataScan
11+
// GET https://dataplex.googleapis.com/v1/projects/{project}/locations/{location}/dataScans/{dataScan}
12+
// LIST https://dataplex.googleapis.com/v1/projects/{project}/locations/{location}/dataScans
13+
var _ = registerableAdapter{
14+
sdpType: gcpshared.DataplexDataScan,
15+
meta: gcpshared.AdapterMeta{
16+
SDPAdapterCategory: sdp.AdapterCategory_ADAPTER_CATEGORY_OBSERVABILITY,
17+
Scope: gcpshared.ScopeProject,
18+
GetEndpointBaseURLFunc: gcpshared.ProjectLevelEndpointFuncWithTwoQueries(
19+
"https://dataplex.googleapis.com/v1/projects/%s/locations/%s/dataScans/%s",
20+
),
21+
SearchEndpointFunc: gcpshared.ProjectLevelEndpointFuncWithSingleQuery(
22+
"https://dataplex.googleapis.com/v1/projects/%s/locations/%s/dataScans",
23+
),
24+
SearchDescription: "Search for Dataplex data scans in a location. Use the location name e.g., 'us-central1' or the format \"projects/project_id/locations/location/dataScans/data_scan_id\" which is supported for terraform mappings.",
25+
UniqueAttributeKeys: []string{"locations", "dataScans"},
26+
IAMPermissions: []string{
27+
"dataplex.dataScans.get",
28+
"dataplex.dataScans.list",
29+
},
30+
// TODO: https://linear.app/overmind/issue/ENG-631 state
31+
// https://cloud.google.com/dataplex/docs/reference/rest/v1/projects.locations.dataScans#DataScan
32+
},
33+
blastPropagation: map[string]*gcpshared.Impact{
34+
// Data source references - can scan various data sources
35+
"data.entity": {
36+
ToSDPItemType: gcpshared.DataplexEntity,
37+
Description: "If the Dataplex Entity is deleted: The data scan will fail to access the data source. If the data scan is updated: The dataplex entity remains unaffected.",
38+
BlastPropagation: &sdp.BlastPropagation{
39+
In: true,
40+
},
41+
},
42+
"data.resource": {
43+
ToSDPItemType: gcpshared.StorageBucket,
44+
Description: "If the storage resource is deleted or inaccessible: The data scan will fail to access the data source. If the data scan is updated: The storage resource remains unaffected.",
45+
BlastPropagation: &sdp.BlastPropagation{
46+
In: true,
47+
},
48+
},
49+
},
50+
terraformMapping: gcpshared.TerraformMapping{
51+
Reference: "https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/dataplex_datascan",
52+
Description: "id => projects/{{project}}/locations/{{location}}/dataScans/{{data_scan_id}}",
53+
Mappings: []*sdp.TerraformMapping{
54+
{
55+
TerraformMethod: sdp.QueryMethod_SEARCH,
56+
TerraformQueryMap: "google_dataplex_datascan.id",
57+
},
58+
},
59+
},
60+
}.Register()

sources/gcp/shared/item-types.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ var (
6868
CloudBuildBuild = shared.NewItemType(GCP, CloudBuild, Build)
6969
DataplexEntryGroup = shared.NewItemType(GCP, DataPlex, EntryGroup)
7070
DataplexAspectType = shared.NewItemType(GCP, DataPlex, AspectType)
71+
DataplexDataScan = shared.NewItemType(GCP, DataPlex, DataScan)
72+
DataplexEntity = shared.NewItemType(GCP, DataPlex, Entity)
7173
ServiceUsageService = shared.NewItemType(GCP, ServiceUsage, Service)
7274
RunRevision = shared.NewItemType(GCP, Run, Revision)
7375
SQLAdminBackup = shared.NewItemType(GCP, SqlAdmin, Backup)

sources/gcp/shared/models.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,8 @@ const (
117117
Build shared.Resource = "build"
118118
EntryGroup shared.Resource = "entry-group"
119119
AspectType shared.Resource = "aspect-type"
120+
DataScan shared.Resource = "data-scan"
121+
Entity shared.Resource = "entity"
120122
Service shared.Resource = "service"
121123
Revision shared.Resource = "revision"
122124
BackupRun shared.Resource = "backup-run"

0 commit comments

Comments
 (0)