I have the following Go code that creates a new project in Google Cloud Platform (GCP):
import (
gcpapi "cloud.google.com/go/resourcemanager/apiv3/resourcemanagerpb"
)
client := *gcpapi.ProjectsClient
request := &gcpapi.CreateProjectRequest{
Project: &gcpapi.Project{
ProjectId: "XYZ",
DisplayName: "XYZ",
Parent: "123",
Labels: "a:b,c:d,e:f",
},
}
_, err := p.client.CreateProject(ctx, request)
I want to enable Cloud Data Loss Prevention (DLP) on this project. Is there a way I can do so in the above CreateProjectRequest
? How?
I looked up the definition of the struct Project
and I found this. It doesn’t seem to have any argument that would be used to enable Cloud Data Loss Prevention. So I’m not sure it can be done via API.
Maybe this is something that must be done exclusively through the GCP’s DLP console? I know it can be enabled there.