Documentation ¶
Overview ¶
Package dlp is an auto-generated package for the DLP API.
NOTE: This package is in alpha. It is not stable, and is likely to change.
The Google Data Loss Prevention API provides methods for detection of privacy-sensitive fragments in text, images, and Google Cloud Platform storage repositories.
Index ¶
- func DefaultAuthScopes() []string
- type CallOptions
- type Client
- func (c *Client) AnalyzeDataSourceRisk(ctx context.Context, req *dlppb.AnalyzeDataSourceRiskRequest, ...) (*dlppb.DlpJob, error)
- func (c *Client) CancelDlpJob(ctx context.Context, req *dlppb.CancelDlpJobRequest, opts ...gax.CallOption) error
- func (c *Client) Close() error
- func (c *Client) Connection() *grpc.ClientConn
- func (c *Client) CreateDeidentifyTemplate(ctx context.Context, req *dlppb.CreateDeidentifyTemplateRequest, ...) (*dlppb.DeidentifyTemplate, error)
- func (c *Client) CreateInspectTemplate(ctx context.Context, req *dlppb.CreateInspectTemplateRequest, ...) (*dlppb.InspectTemplate, error)
- func (c *Client) DeidentifyContent(ctx context.Context, req *dlppb.DeidentifyContentRequest, ...) (*dlppb.DeidentifyContentResponse, error)
- func (c *Client) DeleteDeidentifyTemplate(ctx context.Context, req *dlppb.DeleteDeidentifyTemplateRequest, ...) error
- func (c *Client) DeleteDlpJob(ctx context.Context, req *dlppb.DeleteDlpJobRequest, opts ...gax.CallOption) error
- func (c *Client) DeleteInspectTemplate(ctx context.Context, req *dlppb.DeleteInspectTemplateRequest, ...) error
- func (c *Client) GetDeidentifyTemplate(ctx context.Context, req *dlppb.GetDeidentifyTemplateRequest, ...) (*dlppb.DeidentifyTemplate, error)
- func (c *Client) GetDlpJob(ctx context.Context, req *dlppb.GetDlpJobRequest, opts ...gax.CallOption) (*dlppb.DlpJob, error)
- func (c *Client) GetInspectTemplate(ctx context.Context, req *dlppb.GetInspectTemplateRequest, ...) (*dlppb.InspectTemplate, error)
- func (c *Client) InspectContent(ctx context.Context, req *dlppb.InspectContentRequest, opts ...gax.CallOption) (*dlppb.InspectContentResponse, error)
- func (c *Client) InspectDataSource(ctx context.Context, req *dlppb.InspectDataSourceRequest, ...) (*dlppb.DlpJob, error)
- func (c *Client) ListDeidentifyTemplates(ctx context.Context, req *dlppb.ListDeidentifyTemplatesRequest, ...) *DeidentifyTemplateIterator
- func (c *Client) ListDlpJobs(ctx context.Context, req *dlppb.ListDlpJobsRequest, opts ...gax.CallOption) *DlpJobIterator
- func (c *Client) ListInfoTypes(ctx context.Context, req *dlppb.ListInfoTypesRequest, opts ...gax.CallOption) (*dlppb.ListInfoTypesResponse, error)
- func (c *Client) ListInspectTemplates(ctx context.Context, req *dlppb.ListInspectTemplatesRequest, ...) *InspectTemplateIterator
- func (c *Client) RedactImage(ctx context.Context, req *dlppb.RedactImageRequest, opts ...gax.CallOption) (*dlppb.RedactImageResponse, error)
- func (c *Client) ReidentifyContent(ctx context.Context, req *dlppb.ReidentifyContentRequest, ...) (*dlppb.ReidentifyContentResponse, error)
- func (c *Client) UpdateDeidentifyTemplate(ctx context.Context, req *dlppb.UpdateDeidentifyTemplateRequest, ...) (*dlppb.DeidentifyTemplate, error)
- func (c *Client) UpdateInspectTemplate(ctx context.Context, req *dlppb.UpdateInspectTemplateRequest, ...) (*dlppb.InspectTemplate, error)
- type DeidentifyTemplateIterator
- type DlpJobIterator
- type InspectTemplateIterator
Examples ¶
- Client.AnalyzeDataSourceRisk
- Client.CancelDlpJob
- Client.CreateDeidentifyTemplate
- Client.CreateInspectTemplate
- Client.DeidentifyContent
- Client.DeleteDeidentifyTemplate
- Client.DeleteDlpJob
- Client.DeleteInspectTemplate
- Client.GetDeidentifyTemplate
- Client.GetDlpJob
- Client.GetInspectTemplate
- Client.InspectContent
- Client.InspectDataSource
- Client.ListDeidentifyTemplates
- Client.ListDlpJobs
- Client.ListInfoTypes
- Client.ListInspectTemplates
- Client.RedactImage
- Client.ReidentifyContent
- Client.UpdateDeidentifyTemplate
- Client.UpdateInspectTemplate
- NewClient
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultAuthScopes ¶
func DefaultAuthScopes() []string
DefaultAuthScopes reports the default set of authentication scopes to use with this package.
Types ¶
type CallOptions ¶
type CallOptions struct { InspectContent []gax.CallOption RedactImage []gax.CallOption DeidentifyContent []gax.CallOption ReidentifyContent []gax.CallOption InspectDataSource []gax.CallOption AnalyzeDataSourceRisk []gax.CallOption ListInfoTypes []gax.CallOption CreateInspectTemplate []gax.CallOption UpdateInspectTemplate []gax.CallOption GetInspectTemplate []gax.CallOption ListInspectTemplates []gax.CallOption DeleteInspectTemplate []gax.CallOption CreateDeidentifyTemplate []gax.CallOption UpdateDeidentifyTemplate []gax.CallOption GetDeidentifyTemplate []gax.CallOption ListDeidentifyTemplates []gax.CallOption DeleteDeidentifyTemplate []gax.CallOption ListDlpJobs []gax.CallOption GetDlpJob []gax.CallOption DeleteDlpJob []gax.CallOption CancelDlpJob []gax.CallOption }
CallOptions contains the retry settings for each method of Client.
type Client ¶
type Client struct { // The call options for this service. CallOptions *CallOptions // contains filtered or unexported fields }
Client is a client for interacting with DLP API.
func NewClient ¶
NewClient creates a new dlp service client.
The DLP API is a service that allows clients to detect the presence of Personally Identifiable Information (PII) and other privacy-sensitive data in user-supplied, unstructured data streams, like text blocks or images. The service also includes methods for sensitive data redaction and scheduling of data scans on Google Cloud Platform based data sets.
Example ¶
ctx := context.Background() c, err := dlp.NewClient(ctx) if err != nil { // TODO: Handle error. } // TODO: Use client. _ = c
Output:
func (*Client) AnalyzeDataSourceRisk ¶
func (c *Client) AnalyzeDataSourceRisk(ctx context.Context, req *dlppb.AnalyzeDataSourceRiskRequest, opts ...gax.CallOption) (*dlppb.DlpJob, error)
AnalyzeDataSourceRisk schedules a job to compute risk analysis metrics over content in a Google Cloud Platform repository. [How-to guide}(/dlp/docs/compute-risk-analysis)
Example ¶
ctx := context.Background() c, err := dlp.NewClient(ctx) if err != nil { // TODO: Handle error. } req := &dlppb.AnalyzeDataSourceRiskRequest{ // TODO: Fill request struct fields. } resp, err := c.AnalyzeDataSourceRisk(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp
Output:
func (*Client) CancelDlpJob ¶
func (c *Client) CancelDlpJob(ctx context.Context, req *dlppb.CancelDlpJobRequest, opts ...gax.CallOption) error
CancelDlpJob starts asynchronous cancellation on a long-running DlpJob. The server makes a best effort to cancel the DlpJob, but success is not guaranteed.
Example ¶
ctx := context.Background() c, err := dlp.NewClient(ctx) if err != nil { // TODO: Handle error. } req := &dlppb.CancelDlpJobRequest{ // TODO: Fill request struct fields. } err = c.CancelDlpJob(ctx, req) if err != nil { // TODO: Handle error. }
Output:
func (*Client) Close ¶
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*Client) Connection ¶
func (c *Client) Connection() *grpc.ClientConn
Connection returns the client's connection to the API service.
func (*Client) CreateDeidentifyTemplate ¶
func (c *Client) CreateDeidentifyTemplate(ctx context.Context, req *dlppb.CreateDeidentifyTemplateRequest, opts ...gax.CallOption) (*dlppb.DeidentifyTemplate, error)
CreateDeidentifyTemplate creates an Deidentify template for re-using frequently used configuration for Deidentifying content, images, and storage.
Example ¶
ctx := context.Background() c, err := dlp.NewClient(ctx) if err != nil { // TODO: Handle error. } req := &dlppb.CreateDeidentifyTemplateRequest{ // TODO: Fill request struct fields. } resp, err := c.CreateDeidentifyTemplate(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp
Output:
func (*Client) CreateInspectTemplate ¶
func (c *Client) CreateInspectTemplate(ctx context.Context, req *dlppb.CreateInspectTemplateRequest, opts ...gax.CallOption) (*dlppb.InspectTemplate, error)
CreateInspectTemplate creates an inspect template for re-using frequently used configuration for inspecting content, images, and storage.
Example ¶
ctx := context.Background() c, err := dlp.NewClient(ctx) if err != nil { // TODO: Handle error. } req := &dlppb.CreateInspectTemplateRequest{ // TODO: Fill request struct fields. } resp, err := c.CreateInspectTemplate(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp
Output:
func (*Client) DeidentifyContent ¶
func (c *Client) DeidentifyContent(ctx context.Context, req *dlppb.DeidentifyContentRequest, opts ...gax.CallOption) (*dlppb.DeidentifyContentResponse, error)
DeidentifyContent de-identifies potentially sensitive info from a ContentItem. This method has limits on input size and output size. How-to guide (at /dlp/docs/deidentify-sensitive-data)
Example ¶
ctx := context.Background() c, err := dlp.NewClient(ctx) if err != nil { // TODO: Handle error. } req := &dlppb.DeidentifyContentRequest{ // TODO: Fill request struct fields. } resp, err := c.DeidentifyContent(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp
Output:
func (*Client) DeleteDeidentifyTemplate ¶
func (c *Client) DeleteDeidentifyTemplate(ctx context.Context, req *dlppb.DeleteDeidentifyTemplateRequest, opts ...gax.CallOption) error
DeleteDeidentifyTemplate deletes inspect templates.
Example ¶
ctx := context.Background() c, err := dlp.NewClient(ctx) if err != nil { // TODO: Handle error. } req := &dlppb.DeleteDeidentifyTemplateRequest{ // TODO: Fill request struct fields. } err = c.DeleteDeidentifyTemplate(ctx, req) if err != nil { // TODO: Handle error. }
Output:
func (*Client) DeleteDlpJob ¶
func (c *Client) DeleteDlpJob(ctx context.Context, req *dlppb.DeleteDlpJobRequest, opts ...gax.CallOption) error
DeleteDlpJob deletes a long-running DlpJob. This method indicates that the client is no longer interested in the DlpJob result. The job will be cancelled if possible.
Example ¶
ctx := context.Background() c, err := dlp.NewClient(ctx) if err != nil { // TODO: Handle error. } req := &dlppb.DeleteDlpJobRequest{ // TODO: Fill request struct fields. } err = c.DeleteDlpJob(ctx, req) if err != nil { // TODO: Handle error. }
Output:
func (*Client) DeleteInspectTemplate ¶
func (c *Client) DeleteInspectTemplate(ctx context.Context, req *dlppb.DeleteInspectTemplateRequest, opts ...gax.CallOption) error
DeleteInspectTemplate deletes inspect templates.
Example ¶
ctx := context.Background() c, err := dlp.NewClient(ctx) if err != nil { // TODO: Handle error. } req := &dlppb.DeleteInspectTemplateRequest{ // TODO: Fill request struct fields. } err = c.DeleteInspectTemplate(ctx, req) if err != nil { // TODO: Handle error. }
Output:
func (*Client) GetDeidentifyTemplate ¶
func (c *Client) GetDeidentifyTemplate(ctx context.Context, req *dlppb.GetDeidentifyTemplateRequest, opts ...gax.CallOption) (*dlppb.DeidentifyTemplate, error)
GetDeidentifyTemplate gets an inspect template.
Example ¶
ctx := context.Background() c, err := dlp.NewClient(ctx) if err != nil { // TODO: Handle error. } req := &dlppb.GetDeidentifyTemplateRequest{ // TODO: Fill request struct fields. } resp, err := c.GetDeidentifyTemplate(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp
Output:
func (*Client) GetDlpJob ¶
func (c *Client) GetDlpJob(ctx context.Context, req *dlppb.GetDlpJobRequest, opts ...gax.CallOption) (*dlppb.DlpJob, error)
GetDlpJob gets the latest state of a long-running DlpJob.
Example ¶
ctx := context.Background() c, err := dlp.NewClient(ctx) if err != nil { // TODO: Handle error. } req := &dlppb.GetDlpJobRequest{ // TODO: Fill request struct fields. } resp, err := c.GetDlpJob(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp
Output:
func (*Client) GetInspectTemplate ¶
func (c *Client) GetInspectTemplate(ctx context.Context, req *dlppb.GetInspectTemplateRequest, opts ...gax.CallOption) (*dlppb.InspectTemplate, error)
GetInspectTemplate gets an inspect template.
Example ¶
ctx := context.Background() c, err := dlp.NewClient(ctx) if err != nil { // TODO: Handle error. } req := &dlppb.GetInspectTemplateRequest{ // TODO: Fill request struct fields. } resp, err := c.GetInspectTemplate(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp
Output:
func (*Client) InspectContent ¶
func (c *Client) InspectContent(ctx context.Context, req *dlppb.InspectContentRequest, opts ...gax.CallOption) (*dlppb.InspectContentResponse, error)
InspectContent finds potentially sensitive info in content. This method has limits on input size, processing time, and output size. How-to guide for text (at /dlp/docs/inspecting-text), How-to guide for images (at /dlp/docs/inspecting-images)
Example ¶
ctx := context.Background() c, err := dlp.NewClient(ctx) if err != nil { // TODO: Handle error. } req := &dlppb.InspectContentRequest{ // TODO: Fill request struct fields. } resp, err := c.InspectContent(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp
Output:
func (*Client) InspectDataSource ¶
func (c *Client) InspectDataSource(ctx context.Context, req *dlppb.InspectDataSourceRequest, opts ...gax.CallOption) (*dlppb.DlpJob, error)
InspectDataSource schedules a job scanning content in a Google Cloud Platform data repository. How-to guide (at /dlp/docs/inspecting-storage)
Example ¶
ctx := context.Background() c, err := dlp.NewClient(ctx) if err != nil { // TODO: Handle error. } req := &dlppb.InspectDataSourceRequest{ // TODO: Fill request struct fields. } resp, err := c.InspectDataSource(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp
Output:
func (*Client) ListDeidentifyTemplates ¶
func (c *Client) ListDeidentifyTemplates(ctx context.Context, req *dlppb.ListDeidentifyTemplatesRequest, opts ...gax.CallOption) *DeidentifyTemplateIterator
ListDeidentifyTemplates lists inspect templates.
Example ¶
ctx := context.Background() c, err := dlp.NewClient(ctx) if err != nil { // TODO: Handle error. } req := &dlppb.ListDeidentifyTemplatesRequest{ // TODO: Fill request struct fields. } it := c.ListDeidentifyTemplates(ctx, req) for { resp, err := it.Next() if err == iterator.Done { break } if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*Client) ListDlpJobs ¶
func (c *Client) ListDlpJobs(ctx context.Context, req *dlppb.ListDlpJobsRequest, opts ...gax.CallOption) *DlpJobIterator
ListDlpJobs lists DlpJobs that match the specified filter in the request.
Example ¶
ctx := context.Background() c, err := dlp.NewClient(ctx) if err != nil { // TODO: Handle error. } req := &dlppb.ListDlpJobsRequest{ // TODO: Fill request struct fields. } it := c.ListDlpJobs(ctx, req) for { resp, err := it.Next() if err == iterator.Done { break } if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*Client) ListInfoTypes ¶
func (c *Client) ListInfoTypes(ctx context.Context, req *dlppb.ListInfoTypesRequest, opts ...gax.CallOption) (*dlppb.ListInfoTypesResponse, error)
ListInfoTypes returns sensitive information types DLP supports.
Example ¶
ctx := context.Background() c, err := dlp.NewClient(ctx) if err != nil { // TODO: Handle error. } req := &dlppb.ListInfoTypesRequest{ // TODO: Fill request struct fields. } resp, err := c.ListInfoTypes(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp
Output:
func (*Client) ListInspectTemplates ¶
func (c *Client) ListInspectTemplates(ctx context.Context, req *dlppb.ListInspectTemplatesRequest, opts ...gax.CallOption) *InspectTemplateIterator
ListInspectTemplates lists inspect templates.
Example ¶
ctx := context.Background() c, err := dlp.NewClient(ctx) if err != nil { // TODO: Handle error. } req := &dlppb.ListInspectTemplatesRequest{ // TODO: Fill request struct fields. } it := c.ListInspectTemplates(ctx, req) for { resp, err := it.Next() if err == iterator.Done { break } if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*Client) RedactImage ¶
func (c *Client) RedactImage(ctx context.Context, req *dlppb.RedactImageRequest, opts ...gax.CallOption) (*dlppb.RedactImageResponse, error)
RedactImage redacts potentially sensitive info from an image. This method has limits on input size, processing time, and output size. How-to guide (at /dlp/docs/redacting-sensitive-data-images)
Example ¶
ctx := context.Background() c, err := dlp.NewClient(ctx) if err != nil { // TODO: Handle error. } req := &dlppb.RedactImageRequest{ // TODO: Fill request struct fields. } resp, err := c.RedactImage(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp
Output:
func (*Client) ReidentifyContent ¶
func (c *Client) ReidentifyContent(ctx context.Context, req *dlppb.ReidentifyContentRequest, opts ...gax.CallOption) (*dlppb.ReidentifyContentResponse, error)
ReidentifyContent re-identify content that has been de-identified.
Example ¶
ctx := context.Background() c, err := dlp.NewClient(ctx) if err != nil { // TODO: Handle error. } req := &dlppb.ReidentifyContentRequest{ // TODO: Fill request struct fields. } resp, err := c.ReidentifyContent(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp
Output:
func (*Client) UpdateDeidentifyTemplate ¶
func (c *Client) UpdateDeidentifyTemplate(ctx context.Context, req *dlppb.UpdateDeidentifyTemplateRequest, opts ...gax.CallOption) (*dlppb.DeidentifyTemplate, error)
UpdateDeidentifyTemplate updates the inspect template.
Example ¶
ctx := context.Background() c, err := dlp.NewClient(ctx) if err != nil { // TODO: Handle error. } req := &dlppb.UpdateDeidentifyTemplateRequest{ // TODO: Fill request struct fields. } resp, err := c.UpdateDeidentifyTemplate(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp
Output:
func (*Client) UpdateInspectTemplate ¶
func (c *Client) UpdateInspectTemplate(ctx context.Context, req *dlppb.UpdateInspectTemplateRequest, opts ...gax.CallOption) (*dlppb.InspectTemplate, error)
UpdateInspectTemplate updates the inspect template.
Example ¶
ctx := context.Background() c, err := dlp.NewClient(ctx) if err != nil { // TODO: Handle error. } req := &dlppb.UpdateInspectTemplateRequest{ // TODO: Fill request struct fields. } resp, err := c.UpdateInspectTemplate(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp
Output:
type DeidentifyTemplateIterator ¶
type DeidentifyTemplateIterator struct { // InternalFetch is for use by the Google Cloud Libraries only. // It is not part of the stable interface of this package. // // InternalFetch returns results from a single call to the underlying RPC. // The number of results is no greater than pageSize. // If there are no more results, nextPageToken is empty and err is nil. InternalFetch func(pageSize int, pageToken string) (results []*dlppb.DeidentifyTemplate, nextPageToken string, err error) // contains filtered or unexported fields }
DeidentifyTemplateIterator manages a stream of *dlppb.DeidentifyTemplate.
func (*DeidentifyTemplateIterator) Next ¶
func (it *DeidentifyTemplateIterator) Next() (*dlppb.DeidentifyTemplate, error)
Next returns the next result. Its second return value is iterator.Done if there are no more results. Once Next returns Done, all subsequent calls will return Done.
func (*DeidentifyTemplateIterator) PageInfo ¶
func (it *DeidentifyTemplateIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
type DlpJobIterator ¶
type DlpJobIterator struct { // InternalFetch is for use by the Google Cloud Libraries only. // It is not part of the stable interface of this package. // // InternalFetch returns results from a single call to the underlying RPC. // The number of results is no greater than pageSize. // If there are no more results, nextPageToken is empty and err is nil. InternalFetch func(pageSize int, pageToken string) (results []*dlppb.DlpJob, nextPageToken string, err error) // contains filtered or unexported fields }
DlpJobIterator manages a stream of *dlppb.DlpJob.
func (*DlpJobIterator) Next ¶
func (it *DlpJobIterator) Next() (*dlppb.DlpJob, error)
Next returns the next result. Its second return value is iterator.Done if there are no more results. Once Next returns Done, all subsequent calls will return Done.
func (*DlpJobIterator) PageInfo ¶
func (it *DlpJobIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
type InspectTemplateIterator ¶
type InspectTemplateIterator struct { // InternalFetch is for use by the Google Cloud Libraries only. // It is not part of the stable interface of this package. // // InternalFetch returns results from a single call to the underlying RPC. // The number of results is no greater than pageSize. // If there are no more results, nextPageToken is empty and err is nil. InternalFetch func(pageSize int, pageToken string) (results []*dlppb.InspectTemplate, nextPageToken string, err error) // contains filtered or unexported fields }
InspectTemplateIterator manages a stream of *dlppb.InspectTemplate.
func (*InspectTemplateIterator) Next ¶
func (it *InspectTemplateIterator) Next() (*dlppb.InspectTemplate, error)
Next returns the next result. Its second return value is iterator.Done if there are no more results. Once Next returns Done, all subsequent calls will return Done.
func (*InspectTemplateIterator) PageInfo ¶
func (it *InspectTemplateIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.