google-cloud-dlp 0.14.0 → 1.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/LICENSE DELETED
@@ -1,201 +0,0 @@
1
- Apache License
2
- Version 2.0, January 2004
3
- https://www.apache.org/licenses/
4
-
5
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
-
7
- 1. Definitions.
8
-
9
- "License" shall mean the terms and conditions for use, reproduction,
10
- and distribution as defined by Sections 1 through 9 of this document.
11
-
12
- "Licensor" shall mean the copyright owner or entity authorized by
13
- the copyright owner that is granting the License.
14
-
15
- "Legal Entity" shall mean the union of the acting entity and all
16
- other entities that control, are controlled by, or are under common
17
- control with that entity. For the purposes of this definition,
18
- "control" means (i) the power, direct or indirect, to cause the
19
- direction or management of such entity, whether by contract or
20
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
- outstanding shares, or (iii) beneficial ownership of such entity.
22
-
23
- "You" (or "Your") shall mean an individual or Legal Entity
24
- exercising permissions granted by this License.
25
-
26
- "Source" form shall mean the preferred form for making modifications,
27
- including but not limited to software source code, documentation
28
- source, and configuration files.
29
-
30
- "Object" form shall mean any form resulting from mechanical
31
- transformation or translation of a Source form, including but
32
- not limited to compiled object code, generated documentation,
33
- and conversions to other media types.
34
-
35
- "Work" shall mean the work of authorship, whether in Source or
36
- Object form, made available under the License, as indicated by a
37
- copyright notice that is included in or attached to the work
38
- (an example is provided in the Appendix below).
39
-
40
- "Derivative Works" shall mean any work, whether in Source or Object
41
- form, that is based on (or derived from) the Work and for which the
42
- editorial revisions, annotations, elaborations, or other modifications
43
- represent, as a whole, an original work of authorship. For the purposes
44
- of this License, Derivative Works shall not include works that remain
45
- separable from, or merely link (or bind by name) to the interfaces of,
46
- the Work and Derivative Works thereof.
47
-
48
- "Contribution" shall mean any work of authorship, including
49
- the original version of the Work and any modifications or additions
50
- to that Work or Derivative Works thereof, that is intentionally
51
- submitted to Licensor for inclusion in the Work by the copyright owner
52
- or by an individual or Legal Entity authorized to submit on behalf of
53
- the copyright owner. For the purposes of this definition, "submitted"
54
- means any form of electronic, verbal, or written communication sent
55
- to the Licensor or its representatives, including but not limited to
56
- communication on electronic mailing lists, source code control systems,
57
- and issue tracking systems that are managed by, or on behalf of, the
58
- Licensor for the purpose of discussing and improving the Work, but
59
- excluding communication that is conspicuously marked or otherwise
60
- designated in writing by the copyright owner as "Not a Contribution."
61
-
62
- "Contributor" shall mean Licensor and any individual or Legal Entity
63
- on behalf of whom a Contribution has been received by Licensor and
64
- subsequently incorporated within the Work.
65
-
66
- 2. Grant of Copyright License. Subject to the terms and conditions of
67
- this License, each Contributor hereby grants to You a perpetual,
68
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
- copyright license to reproduce, prepare Derivative Works of,
70
- publicly display, publicly perform, sublicense, and distribute the
71
- Work and such Derivative Works in Source or Object form.
72
-
73
- 3. Grant of Patent License. Subject to the terms and conditions of
74
- this License, each Contributor hereby grants to You a perpetual,
75
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
- (except as stated in this section) patent license to make, have made,
77
- use, offer to sell, sell, import, and otherwise transfer the Work,
78
- where such license applies only to those patent claims licensable
79
- by such Contributor that are necessarily infringed by their
80
- Contribution(s) alone or by combination of their Contribution(s)
81
- with the Work to which such Contribution(s) was submitted. If You
82
- institute patent litigation against any entity (including a
83
- cross-claim or counterclaim in a lawsuit) alleging that the Work
84
- or a Contribution incorporated within the Work constitutes direct
85
- or contributory patent infringement, then any patent licenses
86
- granted to You under this License for that Work shall terminate
87
- as of the date such litigation is filed.
88
-
89
- 4. Redistribution. You may reproduce and distribute copies of the
90
- Work or Derivative Works thereof in any medium, with or without
91
- modifications, and in Source or Object form, provided that You
92
- meet the following conditions:
93
-
94
- (a) You must give any other recipients of the Work or
95
- Derivative Works a copy of this License; and
96
-
97
- (b) You must cause any modified files to carry prominent notices
98
- stating that You changed the files; and
99
-
100
- (c) You must retain, in the Source form of any Derivative Works
101
- that You distribute, all copyright, patent, trademark, and
102
- attribution notices from the Source form of the Work,
103
- excluding those notices that do not pertain to any part of
104
- the Derivative Works; and
105
-
106
- (d) If the Work includes a "NOTICE" text file as part of its
107
- distribution, then any Derivative Works that You distribute must
108
- include a readable copy of the attribution notices contained
109
- within such NOTICE file, excluding those notices that do not
110
- pertain to any part of the Derivative Works, in at least one
111
- of the following places: within a NOTICE text file distributed
112
- as part of the Derivative Works; within the Source form or
113
- documentation, if provided along with the Derivative Works; or,
114
- within a display generated by the Derivative Works, if and
115
- wherever such third-party notices normally appear. The contents
116
- of the NOTICE file are for informational purposes only and
117
- do not modify the License. You may add Your own attribution
118
- notices within Derivative Works that You distribute, alongside
119
- or as an addendum to the NOTICE text from the Work, provided
120
- that such additional attribution notices cannot be construed
121
- as modifying the License.
122
-
123
- You may add Your own copyright statement to Your modifications and
124
- may provide additional or different license terms and conditions
125
- for use, reproduction, or distribution of Your modifications, or
126
- for any such Derivative Works as a whole, provided Your use,
127
- reproduction, and distribution of the Work otherwise complies with
128
- the conditions stated in this License.
129
-
130
- 5. Submission of Contributions. Unless You explicitly state otherwise,
131
- any Contribution intentionally submitted for inclusion in the Work
132
- by You to the Licensor shall be under the terms and conditions of
133
- this License, without any additional terms or conditions.
134
- Notwithstanding the above, nothing herein shall supersede or modify
135
- the terms of any separate license agreement you may have executed
136
- with Licensor regarding such Contributions.
137
-
138
- 6. Trademarks. This License does not grant permission to use the trade
139
- names, trademarks, service marks, or product names of the Licensor,
140
- except as required for reasonable and customary use in describing the
141
- origin of the Work and reproducing the content of the NOTICE file.
142
-
143
- 7. Disclaimer of Warranty. Unless required by applicable law or
144
- agreed to in writing, Licensor provides the Work (and each
145
- Contributor provides its Contributions) on an "AS IS" BASIS,
146
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
- implied, including, without limitation, any warranties or conditions
148
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
- PARTICULAR PURPOSE. You are solely responsible for determining the
150
- appropriateness of using or redistributing the Work and assume any
151
- risks associated with Your exercise of permissions under this License.
152
-
153
- 8. Limitation of Liability. In no event and under no legal theory,
154
- whether in tort (including negligence), contract, or otherwise,
155
- unless required by applicable law (such as deliberate and grossly
156
- negligent acts) or agreed to in writing, shall any Contributor be
157
- liable to You for damages, including any direct, indirect, special,
158
- incidental, or consequential damages of any character arising as a
159
- result of this License or out of the use or inability to use the
160
- Work (including but not limited to damages for loss of goodwill,
161
- work stoppage, computer failure or malfunction, or any and all
162
- other commercial damages or losses), even if such Contributor
163
- has been advised of the possibility of such damages.
164
-
165
- 9. Accepting Warranty or Additional Liability. While redistributing
166
- the Work or Derivative Works thereof, You may choose to offer,
167
- and charge a fee for, acceptance of support, warranty, indemnity,
168
- or other liability obligations and/or rights consistent with this
169
- License. However, in accepting such obligations, You may act only
170
- on Your own behalf and on Your sole responsibility, not on behalf
171
- of any other Contributor, and only if You agree to indemnify,
172
- defend, and hold each Contributor harmless for any liability
173
- incurred by, or claims asserted against, such Contributor by reason
174
- of your accepting any such warranty or additional liability.
175
-
176
- END OF TERMS AND CONDITIONS
177
-
178
- APPENDIX: How to apply the Apache License to your work.
179
-
180
- To apply the Apache License to your work, attach the following
181
- boilerplate notice, with the fields enclosed by brackets "[]"
182
- replaced with your own identifying information. (Don't include
183
- the brackets!) The text should be enclosed in the appropriate
184
- comment syntax for the file format. We also recommend that a
185
- file or class name and description of purpose be included on the
186
- same "printed page" as the copyright notice for easier
187
- identification within third-party archives.
188
-
189
- Copyright [yyyy] [name of copyright owner]
190
-
191
- Licensed under the Apache License, Version 2.0 (the "License");
192
- you may not use this file except in compliance with the License.
193
- You may obtain a copy of the License at
194
-
195
- https://www.apache.org/licenses/LICENSE-2.0
196
-
197
- Unless required by applicable law or agreed to in writing, software
198
- distributed under the License is distributed on an "AS IS" BASIS,
199
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
- See the License for the specific language governing permissions and
201
- limitations under the License.
@@ -1,155 +0,0 @@
1
- # Copyright 2020 Google LLC
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # https://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
-
16
- require "google/cloud/dlp/v2/dlp_service_client"
17
-
18
- module Google
19
- module Cloud
20
- module Dlp
21
- # rubocop:disable LineLength
22
-
23
- ##
24
- # # Ruby Client for Cloud Data Loss Prevention (DLP) API
25
- #
26
- # [Cloud Data Loss Prevention (DLP) API][Product Documentation]:
27
- # Provides methods for detection, risk analysis, and de-identification of
28
- # privacy-sensitive fragments in text, images, and Google Cloud Platform
29
- # storage repositories.
30
- # - [Product Documentation][]
31
- #
32
- # ## Quick Start
33
- # In order to use this library, you first need to go through the following
34
- # steps:
35
- #
36
- # 1. [Select or create a Cloud Platform project.](https://console.cloud.google.com/project)
37
- # 2. [Enable billing for your project.](https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project)
38
- # 3. [Enable the Cloud Data Loss Prevention (DLP) API.](https://console.cloud.google.com/apis/library/dlp.googleapis.com)
39
- # 4. [Setup Authentication.](https://googleapis.dev/ruby/google-cloud-dlp/latest/file.AUTHENTICATION.html)
40
- #
41
- # ### Installation
42
- # ```
43
- # $ gem install google-cloud-dlp
44
- # ```
45
- #
46
- # ### Next Steps
47
- # - Read the [Cloud Data Loss Prevention (DLP) API Product documentation][Product Documentation]
48
- # to learn more about the product and see How-to Guides.
49
- # - View this [repository's main README](https://github.com/googleapis/google-cloud-ruby/blob/master/README.md)
50
- # to see the full list of Cloud APIs that we cover.
51
- #
52
- # [Product Documentation]: https://cloud.google.com/dlp
53
- #
54
- # ## Enabling Logging
55
- #
56
- # To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
57
- # The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/stdlib-2.5.0/libdoc/logger/rdoc/Logger.html) as shown below,
58
- # or a [`Google::Cloud::Logging::Logger`](https://googleapis.dev/ruby/google-cloud-logging/latest)
59
- # that will write logs to [Stackdriver Logging](https://cloud.google.com/logging/). See [grpc/logconfig.rb](https://github.com/grpc/grpc/blob/master/src/ruby/lib/grpc/logconfig.rb)
60
- # and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
61
- #
62
- # Configuring a Ruby stdlib logger:
63
- #
64
- # ```ruby
65
- # require "logger"
66
- #
67
- # module MyLogger
68
- # LOGGER = Logger.new $stderr, level: Logger::WARN
69
- # def logger
70
- # LOGGER
71
- # end
72
- # end
73
- #
74
- # # Define a gRPC module-level logger method before grpc/logconfig.rb loads.
75
- # module GRPC
76
- # extend MyLogger
77
- # end
78
- # ```
79
- #
80
- module V2
81
- # rubocop:enable LineLength
82
-
83
- ##
84
- # The Cloud Data Loss Prevention (DLP) API is a service that allows clients
85
- # to detect the presence of Personally Identifiable Information (PII) and other
86
- # privacy-sensitive data in user-supplied, unstructured data streams, like text
87
- # blocks or images.
88
- # The service also includes methods for sensitive data redaction and
89
- # scheduling of data scans on Google Cloud Platform based data sets.
90
- #
91
- # To learn more about concepts and find how-to guides see
92
- # https://cloud.google.com/dlp/docs/.
93
- #
94
- # @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
95
- # Provides the means for authenticating requests made by the client. This parameter can
96
- # be many types.
97
- # A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
98
- # authenticating requests made by this client.
99
- # A `String` will be treated as the path to the keyfile to be used for the construction of
100
- # credentials for this client.
101
- # A `Hash` will be treated as the contents of a keyfile to be used for the construction of
102
- # credentials for this client.
103
- # A `GRPC::Core::Channel` will be used to make calls through.
104
- # A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
105
- # should already be composed with a `GRPC::Core::CallCredentials` object.
106
- # A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
107
- # metadata for requests, generally, to give OAuth credentials.
108
- # @param scopes [Array<String>]
109
- # The OAuth scopes for this service. This parameter is ignored if
110
- # an updater_proc is supplied.
111
- # @param client_config [Hash]
112
- # A Hash for call options for each method. See
113
- # Google::Gax#construct_settings for the structure of
114
- # this data. Falls back to the default config if not specified
115
- # or the specified config is missing data points.
116
- # @param timeout [Numeric]
117
- # The default timeout, in seconds, for calls made through this client.
118
- # @param metadata [Hash]
119
- # Default metadata to be sent with each request. This can be overridden on a per call basis.
120
- # @param service_address [String]
121
- # Override for the service hostname, or `nil` to leave as the default.
122
- # @param service_port [Integer]
123
- # Override for the service port, or `nil` to leave as the default.
124
- # @param exception_transformer [Proc]
125
- # An optional proc that intercepts any exceptions raised during an API call to inject
126
- # custom error handling.
127
- def self.new \
128
- credentials: nil,
129
- scopes: nil,
130
- client_config: nil,
131
- timeout: nil,
132
- metadata: nil,
133
- service_address: nil,
134
- service_port: nil,
135
- exception_transformer: nil,
136
- lib_name: nil,
137
- lib_version: nil
138
- kwargs = {
139
- credentials: credentials,
140
- scopes: scopes,
141
- client_config: client_config,
142
- timeout: timeout,
143
- metadata: metadata,
144
- exception_transformer: exception_transformer,
145
- lib_name: lib_name,
146
- service_address: service_address,
147
- service_port: service_port,
148
- lib_version: lib_version
149
- }.select { |_, v| v != nil }
150
- Google::Cloud::Dlp::V2::DlpServiceClient.new(**kwargs)
151
- end
152
- end
153
- end
154
- end
155
- end
@@ -1,41 +0,0 @@
1
- # Copyright 2020 Google LLC
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # https://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
-
16
- require "googleauth"
17
-
18
- module Google
19
- module Cloud
20
- module Dlp
21
- module V2
22
- class Credentials < Google::Auth::Credentials
23
- SCOPE = [
24
- "https://www.googleapis.com/auth/cloud-platform"
25
- ].freeze
26
- PATH_ENV_VARS = %w(DLP_CREDENTIALS
27
- DLP_KEYFILE
28
- GOOGLE_CLOUD_CREDENTIALS
29
- GOOGLE_CLOUD_KEYFILE
30
- GCLOUD_KEYFILE)
31
- JSON_ENV_VARS = %w(DLP_CREDENTIALS_JSON
32
- DLP_KEYFILE_JSON
33
- GOOGLE_CLOUD_CREDENTIALS_JSON
34
- GOOGLE_CLOUD_KEYFILE_JSON
35
- GCLOUD_KEYFILE_JSON)
36
- DEFAULT_PATHS = ["~/.config/gcloud/application_default_credentials.json"]
37
- end
38
- end
39
- end
40
- end
41
- end
@@ -1,2220 +0,0 @@
1
- # Copyright 2020 Google LLC
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # https://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
- #
15
- # EDITING INSTRUCTIONS
16
- # This file was generated from the file
17
- # https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto,
18
- # and updates to that file get reflected here through a refresh process.
19
- # For the short term, the refresh process will only be runnable by Google
20
- # engineers.
21
-
22
-
23
- require "json"
24
- require "pathname"
25
-
26
- require "google/gax"
27
-
28
- require "google/privacy/dlp/v2/dlp_pb"
29
- require "google/cloud/dlp/v2/credentials"
30
- require "google/cloud/dlp/version"
31
-
32
- module Google
33
- module Cloud
34
- module Dlp
35
- module V2
36
- # The Cloud Data Loss Prevention (DLP) API is a service that allows clients
37
- # to detect the presence of Personally Identifiable Information (PII) and other
38
- # privacy-sensitive data in user-supplied, unstructured data streams, like text
39
- # blocks or images.
40
- # The service also includes methods for sensitive data redaction and
41
- # scheduling of data scans on Google Cloud Platform based data sets.
42
- #
43
- # To learn more about concepts and find how-to guides see
44
- # https://cloud.google.com/dlp/docs/.
45
- #
46
- # @!attribute [r] dlp_service_stub
47
- # @return [Google::Privacy::Dlp::V2::DlpService::Stub]
48
- class DlpServiceClient
49
- # @private
50
- attr_reader :dlp_service_stub
51
-
52
- # The default address of the service.
53
- SERVICE_ADDRESS = "dlp.googleapis.com".freeze
54
-
55
- # The default port of the service.
56
- DEFAULT_SERVICE_PORT = 443
57
-
58
- # The default set of gRPC interceptors.
59
- GRPC_INTERCEPTORS = []
60
-
61
- DEFAULT_TIMEOUT = 30
62
-
63
- PAGE_DESCRIPTORS = {
64
- "list_inspect_templates" => Google::Gax::PageDescriptor.new(
65
- "page_token",
66
- "next_page_token",
67
- "inspect_templates"),
68
- "list_deidentify_templates" => Google::Gax::PageDescriptor.new(
69
- "page_token",
70
- "next_page_token",
71
- "deidentify_templates"),
72
- "list_dlp_jobs" => Google::Gax::PageDescriptor.new(
73
- "page_token",
74
- "next_page_token",
75
- "jobs"),
76
- "list_job_triggers" => Google::Gax::PageDescriptor.new(
77
- "page_token",
78
- "next_page_token",
79
- "job_triggers"),
80
- "list_stored_info_types" => Google::Gax::PageDescriptor.new(
81
- "page_token",
82
- "next_page_token",
83
- "stored_info_types")
84
- }.freeze
85
-
86
- private_constant :PAGE_DESCRIPTORS
87
-
88
- # The scopes needed to make gRPC calls to all of the methods defined in
89
- # this service.
90
- ALL_SCOPES = [
91
- "https://www.googleapis.com/auth/cloud-platform"
92
- ].freeze
93
-
94
-
95
- DLP_JOB_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
96
- "projects/{project}/dlpJobs/{dlp_job}"
97
- )
98
-
99
- private_constant :DLP_JOB_PATH_TEMPLATE
100
-
101
- ORGANIZATION_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
102
- "organizations/{organization}"
103
- )
104
-
105
- private_constant :ORGANIZATION_PATH_TEMPLATE
106
-
107
- ORGANIZATION_DEIDENTIFY_TEMPLATE_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
108
- "organizations/{organization}/deidentifyTemplates/{deidentify_template}"
109
- )
110
-
111
- private_constant :ORGANIZATION_DEIDENTIFY_TEMPLATE_PATH_TEMPLATE
112
-
113
- ORGANIZATION_INSPECT_TEMPLATE_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
114
- "organizations/{organization}/inspectTemplates/{inspect_template}"
115
- )
116
-
117
- private_constant :ORGANIZATION_INSPECT_TEMPLATE_PATH_TEMPLATE
118
-
119
- ORGANIZATION_STORED_INFO_TYPE_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
120
- "organizations/{organization}/storedInfoTypes/{stored_info_type}"
121
- )
122
-
123
- private_constant :ORGANIZATION_STORED_INFO_TYPE_PATH_TEMPLATE
124
-
125
- PROJECT_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
126
- "projects/{project}"
127
- )
128
-
129
- private_constant :PROJECT_PATH_TEMPLATE
130
-
131
- PROJECT_DEIDENTIFY_TEMPLATE_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
132
- "projects/{project}/deidentifyTemplates/{deidentify_template}"
133
- )
134
-
135
- private_constant :PROJECT_DEIDENTIFY_TEMPLATE_PATH_TEMPLATE
136
-
137
- PROJECT_INSPECT_TEMPLATE_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
138
- "projects/{project}/inspectTemplates/{inspect_template}"
139
- )
140
-
141
- private_constant :PROJECT_INSPECT_TEMPLATE_PATH_TEMPLATE
142
-
143
- PROJECT_JOB_TRIGGER_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
144
- "projects/{project}/jobTriggers/{job_trigger}"
145
- )
146
-
147
- private_constant :PROJECT_JOB_TRIGGER_PATH_TEMPLATE
148
-
149
- PROJECT_STORED_INFO_TYPE_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
150
- "projects/{project}/storedInfoTypes/{stored_info_type}"
151
- )
152
-
153
- private_constant :PROJECT_STORED_INFO_TYPE_PATH_TEMPLATE
154
-
155
- # Returns a fully-qualified dlp_job resource name string.
156
- # @param project [String]
157
- # @param dlp_job [String]
158
- # @return [String]
159
- def self.dlp_job_path project, dlp_job
160
- DLP_JOB_PATH_TEMPLATE.render(
161
- :"project" => project,
162
- :"dlp_job" => dlp_job
163
- )
164
- end
165
-
166
- # Returns a fully-qualified organization resource name string.
167
- # @param organization [String]
168
- # @return [String]
169
- def self.organization_path organization
170
- ORGANIZATION_PATH_TEMPLATE.render(
171
- :"organization" => organization
172
- )
173
- end
174
-
175
- # Returns a fully-qualified organization_deidentify_template resource name string.
176
- # @param organization [String]
177
- # @param deidentify_template [String]
178
- # @return [String]
179
- def self.organization_deidentify_template_path organization, deidentify_template
180
- ORGANIZATION_DEIDENTIFY_TEMPLATE_PATH_TEMPLATE.render(
181
- :"organization" => organization,
182
- :"deidentify_template" => deidentify_template
183
- )
184
- end
185
-
186
- # Returns a fully-qualified organization_inspect_template resource name string.
187
- # @param organization [String]
188
- # @param inspect_template [String]
189
- # @return [String]
190
- def self.organization_inspect_template_path organization, inspect_template
191
- ORGANIZATION_INSPECT_TEMPLATE_PATH_TEMPLATE.render(
192
- :"organization" => organization,
193
- :"inspect_template" => inspect_template
194
- )
195
- end
196
-
197
- # Returns a fully-qualified organization_stored_info_type resource name string.
198
- # @param organization [String]
199
- # @param stored_info_type [String]
200
- # @return [String]
201
- def self.organization_stored_info_type_path organization, stored_info_type
202
- ORGANIZATION_STORED_INFO_TYPE_PATH_TEMPLATE.render(
203
- :"organization" => organization,
204
- :"stored_info_type" => stored_info_type
205
- )
206
- end
207
-
208
- # Returns a fully-qualified project resource name string.
209
- # @param project [String]
210
- # @return [String]
211
- def self.project_path project
212
- PROJECT_PATH_TEMPLATE.render(
213
- :"project" => project
214
- )
215
- end
216
-
217
- # Returns a fully-qualified project_deidentify_template resource name string.
218
- # @param project [String]
219
- # @param deidentify_template [String]
220
- # @return [String]
221
- def self.project_deidentify_template_path project, deidentify_template
222
- PROJECT_DEIDENTIFY_TEMPLATE_PATH_TEMPLATE.render(
223
- :"project" => project,
224
- :"deidentify_template" => deidentify_template
225
- )
226
- end
227
-
228
- # Returns a fully-qualified project_inspect_template resource name string.
229
- # @param project [String]
230
- # @param inspect_template [String]
231
- # @return [String]
232
- def self.project_inspect_template_path project, inspect_template
233
- PROJECT_INSPECT_TEMPLATE_PATH_TEMPLATE.render(
234
- :"project" => project,
235
- :"inspect_template" => inspect_template
236
- )
237
- end
238
-
239
- # Returns a fully-qualified project_job_trigger resource name string.
240
- # @param project [String]
241
- # @param job_trigger [String]
242
- # @return [String]
243
- def self.project_job_trigger_path project, job_trigger
244
- PROJECT_JOB_TRIGGER_PATH_TEMPLATE.render(
245
- :"project" => project,
246
- :"job_trigger" => job_trigger
247
- )
248
- end
249
-
250
- # Returns a fully-qualified project_stored_info_type resource name string.
251
- # @param project [String]
252
- # @param stored_info_type [String]
253
- # @return [String]
254
- def self.project_stored_info_type_path project, stored_info_type
255
- PROJECT_STORED_INFO_TYPE_PATH_TEMPLATE.render(
256
- :"project" => project,
257
- :"stored_info_type" => stored_info_type
258
- )
259
- end
260
-
261
- # @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
262
- # Provides the means for authenticating requests made by the client. This parameter can
263
- # be many types.
264
- # A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
265
- # authenticating requests made by this client.
266
- # A `String` will be treated as the path to the keyfile to be used for the construction of
267
- # credentials for this client.
268
- # A `Hash` will be treated as the contents of a keyfile to be used for the construction of
269
- # credentials for this client.
270
- # A `GRPC::Core::Channel` will be used to make calls through.
271
- # A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
272
- # should already be composed with a `GRPC::Core::CallCredentials` object.
273
- # A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
274
- # metadata for requests, generally, to give OAuth credentials.
275
- # @param scopes [Array<String>]
276
- # The OAuth scopes for this service. This parameter is ignored if
277
- # an updater_proc is supplied.
278
- # @param client_config [Hash]
279
- # A Hash for call options for each method. See
280
- # Google::Gax#construct_settings for the structure of
281
- # this data. Falls back to the default config if not specified
282
- # or the specified config is missing data points.
283
- # @param timeout [Numeric]
284
- # The default timeout, in seconds, for calls made through this client.
285
- # @param metadata [Hash]
286
- # Default metadata to be sent with each request. This can be overridden on a per call basis.
287
- # @param service_address [String]
288
- # Override for the service hostname, or `nil` to leave as the default.
289
- # @param service_port [Integer]
290
- # Override for the service port, or `nil` to leave as the default.
291
- # @param exception_transformer [Proc]
292
- # An optional proc that intercepts any exceptions raised during an API call to inject
293
- # custom error handling.
294
- def initialize \
295
- credentials: nil,
296
- scopes: ALL_SCOPES,
297
- client_config: {},
298
- timeout: DEFAULT_TIMEOUT,
299
- metadata: nil,
300
- service_address: nil,
301
- service_port: nil,
302
- exception_transformer: nil,
303
- lib_name: nil,
304
- lib_version: ""
305
- # These require statements are intentionally placed here to initialize
306
- # the gRPC module only when it's required.
307
- # See https://github.com/googleapis/toolkit/issues/446
308
- require "google/gax/grpc"
309
- require "google/privacy/dlp/v2/dlp_services_pb"
310
-
311
- credentials ||= Google::Cloud::Dlp::V2::Credentials.default
312
-
313
- if credentials.is_a?(String) || credentials.is_a?(Hash)
314
- updater_proc = Google::Cloud::Dlp::V2::Credentials.new(credentials).updater_proc
315
- end
316
- if credentials.is_a?(GRPC::Core::Channel)
317
- channel = credentials
318
- end
319
- if credentials.is_a?(GRPC::Core::ChannelCredentials)
320
- chan_creds = credentials
321
- end
322
- if credentials.is_a?(Proc)
323
- updater_proc = credentials
324
- end
325
- if credentials.is_a?(Google::Auth::Credentials)
326
- updater_proc = credentials.updater_proc
327
- end
328
-
329
- package_version = Google::Cloud::Dlp::VERSION
330
-
331
- google_api_client = "gl-ruby/#{RUBY_VERSION}"
332
- google_api_client << " #{lib_name}/#{lib_version}" if lib_name
333
- google_api_client << " gapic/#{package_version} gax/#{Google::Gax::VERSION}"
334
- google_api_client << " grpc/#{GRPC::VERSION}"
335
- google_api_client.freeze
336
-
337
- headers = { :"x-goog-api-client" => google_api_client }
338
- if credentials.respond_to?(:quota_project_id) && credentials.quota_project_id
339
- headers[:"x-goog-user-project"] = credentials.quota_project_id
340
- end
341
- headers.merge!(metadata) unless metadata.nil?
342
- client_config_file = Pathname.new(__dir__).join(
343
- "dlp_service_client_config.json"
344
- )
345
- defaults = client_config_file.open do |f|
346
- Google::Gax.construct_settings(
347
- "google.privacy.dlp.v2.DlpService",
348
- JSON.parse(f.read),
349
- client_config,
350
- Google::Gax::Grpc::STATUS_CODE_NAMES,
351
- timeout,
352
- page_descriptors: PAGE_DESCRIPTORS,
353
- errors: Google::Gax::Grpc::API_ERRORS,
354
- metadata: headers
355
- )
356
- end
357
-
358
- # Allow overriding the service path/port in subclasses.
359
- service_path = service_address || self.class::SERVICE_ADDRESS
360
- port = service_port || self.class::DEFAULT_SERVICE_PORT
361
- interceptors = self.class::GRPC_INTERCEPTORS
362
- @dlp_service_stub = Google::Gax::Grpc.create_stub(
363
- service_path,
364
- port,
365
- chan_creds: chan_creds,
366
- channel: channel,
367
- updater_proc: updater_proc,
368
- scopes: scopes,
369
- interceptors: interceptors,
370
- &Google::Privacy::Dlp::V2::DlpService::Stub.method(:new)
371
- )
372
-
373
- @inspect_content = Google::Gax.create_api_call(
374
- @dlp_service_stub.method(:inspect_content),
375
- defaults["inspect_content"],
376
- exception_transformer: exception_transformer,
377
- params_extractor: proc do |request|
378
- {'parent' => request.parent}
379
- end
380
- )
381
- @redact_image = Google::Gax.create_api_call(
382
- @dlp_service_stub.method(:redact_image),
383
- defaults["redact_image"],
384
- exception_transformer: exception_transformer,
385
- params_extractor: proc do |request|
386
- {'parent' => request.parent}
387
- end
388
- )
389
- @deidentify_content = Google::Gax.create_api_call(
390
- @dlp_service_stub.method(:deidentify_content),
391
- defaults["deidentify_content"],
392
- exception_transformer: exception_transformer,
393
- params_extractor: proc do |request|
394
- {'parent' => request.parent}
395
- end
396
- )
397
- @reidentify_content = Google::Gax.create_api_call(
398
- @dlp_service_stub.method(:reidentify_content),
399
- defaults["reidentify_content"],
400
- exception_transformer: exception_transformer,
401
- params_extractor: proc do |request|
402
- {'parent' => request.parent}
403
- end
404
- )
405
- @list_info_types = Google::Gax.create_api_call(
406
- @dlp_service_stub.method(:list_info_types),
407
- defaults["list_info_types"],
408
- exception_transformer: exception_transformer,
409
- params_extractor: proc do |request|
410
- {'location_id' => request.location_id}
411
- end
412
- )
413
- @create_inspect_template = Google::Gax.create_api_call(
414
- @dlp_service_stub.method(:create_inspect_template),
415
- defaults["create_inspect_template"],
416
- exception_transformer: exception_transformer,
417
- params_extractor: proc do |request|
418
- {'parent' => request.parent}
419
- end
420
- )
421
- @update_inspect_template = Google::Gax.create_api_call(
422
- @dlp_service_stub.method(:update_inspect_template),
423
- defaults["update_inspect_template"],
424
- exception_transformer: exception_transformer,
425
- params_extractor: proc do |request|
426
- {'name' => request.name}
427
- end
428
- )
429
- @get_inspect_template = Google::Gax.create_api_call(
430
- @dlp_service_stub.method(:get_inspect_template),
431
- defaults["get_inspect_template"],
432
- exception_transformer: exception_transformer,
433
- params_extractor: proc do |request|
434
- {'name' => request.name}
435
- end
436
- )
437
- @list_inspect_templates = Google::Gax.create_api_call(
438
- @dlp_service_stub.method(:list_inspect_templates),
439
- defaults["list_inspect_templates"],
440
- exception_transformer: exception_transformer,
441
- params_extractor: proc do |request|
442
- {'parent' => request.parent}
443
- end
444
- )
445
- @delete_inspect_template = Google::Gax.create_api_call(
446
- @dlp_service_stub.method(:delete_inspect_template),
447
- defaults["delete_inspect_template"],
448
- exception_transformer: exception_transformer,
449
- params_extractor: proc do |request|
450
- {'name' => request.name}
451
- end
452
- )
453
- @create_deidentify_template = Google::Gax.create_api_call(
454
- @dlp_service_stub.method(:create_deidentify_template),
455
- defaults["create_deidentify_template"],
456
- exception_transformer: exception_transformer,
457
- params_extractor: proc do |request|
458
- {'parent' => request.parent}
459
- end
460
- )
461
- @update_deidentify_template = Google::Gax.create_api_call(
462
- @dlp_service_stub.method(:update_deidentify_template),
463
- defaults["update_deidentify_template"],
464
- exception_transformer: exception_transformer,
465
- params_extractor: proc do |request|
466
- {'name' => request.name}
467
- end
468
- )
469
- @get_deidentify_template = Google::Gax.create_api_call(
470
- @dlp_service_stub.method(:get_deidentify_template),
471
- defaults["get_deidentify_template"],
472
- exception_transformer: exception_transformer,
473
- params_extractor: proc do |request|
474
- {'name' => request.name}
475
- end
476
- )
477
- @list_deidentify_templates = Google::Gax.create_api_call(
478
- @dlp_service_stub.method(:list_deidentify_templates),
479
- defaults["list_deidentify_templates"],
480
- exception_transformer: exception_transformer,
481
- params_extractor: proc do |request|
482
- {'parent' => request.parent}
483
- end
484
- )
485
- @delete_deidentify_template = Google::Gax.create_api_call(
486
- @dlp_service_stub.method(:delete_deidentify_template),
487
- defaults["delete_deidentify_template"],
488
- exception_transformer: exception_transformer,
489
- params_extractor: proc do |request|
490
- {'name' => request.name}
491
- end
492
- )
493
- @create_dlp_job = Google::Gax.create_api_call(
494
- @dlp_service_stub.method(:create_dlp_job),
495
- defaults["create_dlp_job"],
496
- exception_transformer: exception_transformer,
497
- params_extractor: proc do |request|
498
- {'parent' => request.parent}
499
- end
500
- )
501
- @list_dlp_jobs = Google::Gax.create_api_call(
502
- @dlp_service_stub.method(:list_dlp_jobs),
503
- defaults["list_dlp_jobs"],
504
- exception_transformer: exception_transformer,
505
- params_extractor: proc do |request|
506
- {'parent' => request.parent}
507
- end
508
- )
509
- @get_dlp_job = Google::Gax.create_api_call(
510
- @dlp_service_stub.method(:get_dlp_job),
511
- defaults["get_dlp_job"],
512
- exception_transformer: exception_transformer,
513
- params_extractor: proc do |request|
514
- {'name' => request.name}
515
- end
516
- )
517
- @delete_dlp_job = Google::Gax.create_api_call(
518
- @dlp_service_stub.method(:delete_dlp_job),
519
- defaults["delete_dlp_job"],
520
- exception_transformer: exception_transformer,
521
- params_extractor: proc do |request|
522
- {'name' => request.name}
523
- end
524
- )
525
- @cancel_dlp_job = Google::Gax.create_api_call(
526
- @dlp_service_stub.method(:cancel_dlp_job),
527
- defaults["cancel_dlp_job"],
528
- exception_transformer: exception_transformer,
529
- params_extractor: proc do |request|
530
- {'name' => request.name}
531
- end
532
- )
533
- @list_job_triggers = Google::Gax.create_api_call(
534
- @dlp_service_stub.method(:list_job_triggers),
535
- defaults["list_job_triggers"],
536
- exception_transformer: exception_transformer,
537
- params_extractor: proc do |request|
538
- {'parent' => request.parent}
539
- end
540
- )
541
- @get_job_trigger = Google::Gax.create_api_call(
542
- @dlp_service_stub.method(:get_job_trigger),
543
- defaults["get_job_trigger"],
544
- exception_transformer: exception_transformer,
545
- params_extractor: proc do |request|
546
- {'name' => request.name}
547
- end
548
- )
549
- @delete_job_trigger = Google::Gax.create_api_call(
550
- @dlp_service_stub.method(:delete_job_trigger),
551
- defaults["delete_job_trigger"],
552
- exception_transformer: exception_transformer,
553
- params_extractor: proc do |request|
554
- {'name' => request.name}
555
- end
556
- )
557
- @update_job_trigger = Google::Gax.create_api_call(
558
- @dlp_service_stub.method(:update_job_trigger),
559
- defaults["update_job_trigger"],
560
- exception_transformer: exception_transformer,
561
- params_extractor: proc do |request|
562
- {'name' => request.name}
563
- end
564
- )
565
- @create_job_trigger = Google::Gax.create_api_call(
566
- @dlp_service_stub.method(:create_job_trigger),
567
- defaults["create_job_trigger"],
568
- exception_transformer: exception_transformer,
569
- params_extractor: proc do |request|
570
- {'parent' => request.parent}
571
- end
572
- )
573
- @create_stored_info_type = Google::Gax.create_api_call(
574
- @dlp_service_stub.method(:create_stored_info_type),
575
- defaults["create_stored_info_type"],
576
- exception_transformer: exception_transformer,
577
- params_extractor: proc do |request|
578
- {'parent' => request.parent}
579
- end
580
- )
581
- @update_stored_info_type = Google::Gax.create_api_call(
582
- @dlp_service_stub.method(:update_stored_info_type),
583
- defaults["update_stored_info_type"],
584
- exception_transformer: exception_transformer,
585
- params_extractor: proc do |request|
586
- {'name' => request.name}
587
- end
588
- )
589
- @get_stored_info_type = Google::Gax.create_api_call(
590
- @dlp_service_stub.method(:get_stored_info_type),
591
- defaults["get_stored_info_type"],
592
- exception_transformer: exception_transformer,
593
- params_extractor: proc do |request|
594
- {'name' => request.name}
595
- end
596
- )
597
- @list_stored_info_types = Google::Gax.create_api_call(
598
- @dlp_service_stub.method(:list_stored_info_types),
599
- defaults["list_stored_info_types"],
600
- exception_transformer: exception_transformer,
601
- params_extractor: proc do |request|
602
- {'parent' => request.parent}
603
- end
604
- )
605
- @delete_stored_info_type = Google::Gax.create_api_call(
606
- @dlp_service_stub.method(:delete_stored_info_type),
607
- defaults["delete_stored_info_type"],
608
- exception_transformer: exception_transformer,
609
- params_extractor: proc do |request|
610
- {'name' => request.name}
611
- end
612
- )
613
- end
614
-
615
- # Service calls
616
-
617
- # Finds potentially sensitive info in content.
618
- # This method has limits on input size, processing time, and output size.
619
- #
620
- # When no InfoTypes or CustomInfoTypes are specified in this request, the
621
- # system will automatically choose what detectors to run. By default this may
622
- # be all types, but may change over time as detectors are updated.
623
- #
624
- # For how to guides, see https://cloud.google.com/dlp/docs/inspecting-images
625
- # and https://cloud.google.com/dlp/docs/inspecting-text,
626
- #
627
- # @param parent [String]
628
- # The parent resource name, for example projects/my-project-id.
629
- # @param inspect_config [Google::Privacy::Dlp::V2::InspectConfig | Hash]
630
- # Configuration for the inspector. What specified here will override
631
- # the template referenced by the inspect_template_name argument.
632
- # A hash of the same form as `Google::Privacy::Dlp::V2::InspectConfig`
633
- # can also be provided.
634
- # @param item [Google::Privacy::Dlp::V2::ContentItem | Hash]
635
- # The item to inspect.
636
- # A hash of the same form as `Google::Privacy::Dlp::V2::ContentItem`
637
- # can also be provided.
638
- # @param inspect_template_name [String]
639
- # Template to use. Any configuration directly specified in
640
- # inspect_config will override those set in the template. Singular fields
641
- # that are set in this request will replace their corresponding fields in the
642
- # template. Repeated fields are appended. Singular sub-messages and groups
643
- # are recursively merged.
644
- # @param location_id [String]
645
- # The geographic location to process content inspection. Reserved for future
646
- # extensions.
647
- # @param options [Google::Gax::CallOptions]
648
- # Overrides the default settings for this call, e.g, timeout,
649
- # retries, etc.
650
- # @yield [result, operation] Access the result along with the RPC operation
651
- # @yieldparam result [Google::Privacy::Dlp::V2::InspectContentResponse]
652
- # @yieldparam operation [GRPC::ActiveCall::Operation]
653
- # @return [Google::Privacy::Dlp::V2::InspectContentResponse]
654
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
655
- # @example
656
- # require "google/cloud/dlp"
657
- #
658
- # dlp_client = Google::Cloud::Dlp.new(version: :v2)
659
- # formatted_parent = Google::Cloud::Dlp::V2::DlpServiceClient.project_path("[PROJECT]")
660
- # response = dlp_client.inspect_content(formatted_parent)
661
-
662
- def inspect_content \
663
- parent,
664
- inspect_config: nil,
665
- item: nil,
666
- inspect_template_name: nil,
667
- location_id: nil,
668
- options: nil,
669
- &block
670
- req = {
671
- parent: parent,
672
- inspect_config: inspect_config,
673
- item: item,
674
- inspect_template_name: inspect_template_name,
675
- location_id: location_id
676
- }.delete_if { |_, v| v.nil? }
677
- req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::InspectContentRequest)
678
- @inspect_content.call(req, options, &block)
679
- end
680
-
681
- # Redacts potentially sensitive info from an image.
682
- # This method has limits on input size, processing time, and output size.
683
- # See https://cloud.google.com/dlp/docs/redacting-sensitive-data-images to
684
- # learn more.
685
- #
686
- # When no InfoTypes or CustomInfoTypes are specified in this request, the
687
- # system will automatically choose what detectors to run. By default this may
688
- # be all types, but may change over time as detectors are updated.
689
- #
690
- # @param parent [String]
691
- # The parent resource name, for example projects/my-project-id.
692
- # @param location_id [String]
693
- # The geographic location to process the request. Reserved for future
694
- # extensions.
695
- # @param inspect_config [Google::Privacy::Dlp::V2::InspectConfig | Hash]
696
- # Configuration for the inspector.
697
- # A hash of the same form as `Google::Privacy::Dlp::V2::InspectConfig`
698
- # can also be provided.
699
- # @param image_redaction_configs [Array<Google::Privacy::Dlp::V2::RedactImageRequest::ImageRedactionConfig | Hash>]
700
- # The configuration for specifying what content to redact from images.
701
- # A hash of the same form as `Google::Privacy::Dlp::V2::RedactImageRequest::ImageRedactionConfig`
702
- # can also be provided.
703
- # @param include_findings [true, false]
704
- # Whether the response should include findings along with the redacted
705
- # image.
706
- # @param byte_item [Google::Privacy::Dlp::V2::ByteContentItem | Hash]
707
- # The content must be PNG, JPEG, SVG or BMP.
708
- # A hash of the same form as `Google::Privacy::Dlp::V2::ByteContentItem`
709
- # can also be provided.
710
- # @param options [Google::Gax::CallOptions]
711
- # Overrides the default settings for this call, e.g, timeout,
712
- # retries, etc.
713
- # @yield [result, operation] Access the result along with the RPC operation
714
- # @yieldparam result [Google::Privacy::Dlp::V2::RedactImageResponse]
715
- # @yieldparam operation [GRPC::ActiveCall::Operation]
716
- # @return [Google::Privacy::Dlp::V2::RedactImageResponse]
717
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
718
- # @example
719
- # require "google/cloud/dlp"
720
- #
721
- # dlp_client = Google::Cloud::Dlp.new(version: :v2)
722
- # formatted_parent = Google::Cloud::Dlp::V2::DlpServiceClient.project_path("[PROJECT]")
723
- # response = dlp_client.redact_image(formatted_parent)
724
-
725
- def redact_image \
726
- parent,
727
- location_id: nil,
728
- inspect_config: nil,
729
- image_redaction_configs: nil,
730
- include_findings: nil,
731
- byte_item: nil,
732
- options: nil,
733
- &block
734
- req = {
735
- parent: parent,
736
- location_id: location_id,
737
- inspect_config: inspect_config,
738
- image_redaction_configs: image_redaction_configs,
739
- include_findings: include_findings,
740
- byte_item: byte_item
741
- }.delete_if { |_, v| v.nil? }
742
- req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::RedactImageRequest)
743
- @redact_image.call(req, options, &block)
744
- end
745
-
746
- # De-identifies potentially sensitive info from a ContentItem.
747
- # This method has limits on input size and output size.
748
- # See https://cloud.google.com/dlp/docs/deidentify-sensitive-data to
749
- # learn more.
750
- #
751
- # When no InfoTypes or CustomInfoTypes are specified in this request, the
752
- # system will automatically choose what detectors to run. By default this may
753
- # be all types, but may change over time as detectors are updated.
754
- #
755
- # @param parent [String]
756
- # The parent resource name, for example projects/my-project-id.
757
- # @param deidentify_config [Google::Privacy::Dlp::V2::DeidentifyConfig | Hash]
758
- # Configuration for the de-identification of the content item.
759
- # Items specified here will override the template referenced by the
760
- # deidentify_template_name argument.
761
- # A hash of the same form as `Google::Privacy::Dlp::V2::DeidentifyConfig`
762
- # can also be provided.
763
- # @param inspect_config [Google::Privacy::Dlp::V2::InspectConfig | Hash]
764
- # Configuration for the inspector.
765
- # Items specified here will override the template referenced by the
766
- # inspect_template_name argument.
767
- # A hash of the same form as `Google::Privacy::Dlp::V2::InspectConfig`
768
- # can also be provided.
769
- # @param item [Google::Privacy::Dlp::V2::ContentItem | Hash]
770
- # The item to de-identify. Will be treated as text.
771
- # A hash of the same form as `Google::Privacy::Dlp::V2::ContentItem`
772
- # can also be provided.
773
- # @param inspect_template_name [String]
774
- # Template to use. Any configuration directly specified in
775
- # inspect_config will override those set in the template. Singular fields
776
- # that are set in this request will replace their corresponding fields in the
777
- # template. Repeated fields are appended. Singular sub-messages and groups
778
- # are recursively merged.
779
- # @param deidentify_template_name [String]
780
- # Template to use. Any configuration directly specified in
781
- # deidentify_config will override those set in the template. Singular fields
782
- # that are set in this request will replace their corresponding fields in the
783
- # template. Repeated fields are appended. Singular sub-messages and groups
784
- # are recursively merged.
785
- # @param location_id [String]
786
- # The geographic location to process de-identification. Reserved for future
787
- # extensions.
788
- # @param options [Google::Gax::CallOptions]
789
- # Overrides the default settings for this call, e.g, timeout,
790
- # retries, etc.
791
- # @yield [result, operation] Access the result along with the RPC operation
792
- # @yieldparam result [Google::Privacy::Dlp::V2::DeidentifyContentResponse]
793
- # @yieldparam operation [GRPC::ActiveCall::Operation]
794
- # @return [Google::Privacy::Dlp::V2::DeidentifyContentResponse]
795
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
796
- # @example
797
- # require "google/cloud/dlp"
798
- #
799
- # dlp_client = Google::Cloud::Dlp.new(version: :v2)
800
- # formatted_parent = Google::Cloud::Dlp::V2::DlpServiceClient.project_path("[PROJECT]")
801
- # response = dlp_client.deidentify_content(formatted_parent)
802
-
803
- def deidentify_content \
804
- parent,
805
- deidentify_config: nil,
806
- inspect_config: nil,
807
- item: nil,
808
- inspect_template_name: nil,
809
- deidentify_template_name: nil,
810
- location_id: nil,
811
- options: nil,
812
- &block
813
- req = {
814
- parent: parent,
815
- deidentify_config: deidentify_config,
816
- inspect_config: inspect_config,
817
- item: item,
818
- inspect_template_name: inspect_template_name,
819
- deidentify_template_name: deidentify_template_name,
820
- location_id: location_id
821
- }.delete_if { |_, v| v.nil? }
822
- req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::DeidentifyContentRequest)
823
- @deidentify_content.call(req, options, &block)
824
- end
825
-
826
- # Re-identifies content that has been de-identified.
827
- # See
828
- # https://cloud.google.com/dlp/docs/pseudonymization#re-identification_in_free_text_code_example
829
- # to learn more.
830
- #
831
- # @param parent [String]
832
- # Required. The parent resource name.
833
- # @param reidentify_config [Google::Privacy::Dlp::V2::DeidentifyConfig | Hash]
834
- # Configuration for the re-identification of the content item.
835
- # This field shares the same proto message type that is used for
836
- # de-identification, however its usage here is for the reversal of the
837
- # previous de-identification. Re-identification is performed by examining
838
- # the transformations used to de-identify the items and executing the
839
- # reverse. This requires that only reversible transformations
840
- # be provided here. The reversible transformations are:
841
- #
842
- # * `CryptoDeterministicConfig`
843
- # * `CryptoReplaceFfxFpeConfig`
844
- # A hash of the same form as `Google::Privacy::Dlp::V2::DeidentifyConfig`
845
- # can also be provided.
846
- # @param inspect_config [Google::Privacy::Dlp::V2::InspectConfig | Hash]
847
- # Configuration for the inspector.
848
- # A hash of the same form as `Google::Privacy::Dlp::V2::InspectConfig`
849
- # can also be provided.
850
- # @param item [Google::Privacy::Dlp::V2::ContentItem | Hash]
851
- # The item to re-identify. Will be treated as text.
852
- # A hash of the same form as `Google::Privacy::Dlp::V2::ContentItem`
853
- # can also be provided.
854
- # @param inspect_template_name [String]
855
- # Template to use. Any configuration directly specified in
856
- # `inspect_config` will override those set in the template. Singular fields
857
- # that are set in this request will replace their corresponding fields in the
858
- # template. Repeated fields are appended. Singular sub-messages and groups
859
- # are recursively merged.
860
- # @param reidentify_template_name [String]
861
- # Template to use. References an instance of `DeidentifyTemplate`.
862
- # Any configuration directly specified in `reidentify_config` or
863
- # `inspect_config` will override those set in the template. Singular fields
864
- # that are set in this request will replace their corresponding fields in the
865
- # template. Repeated fields are appended. Singular sub-messages and groups
866
- # are recursively merged.
867
- # @param location_id [String]
868
- # The geographic location to process content reidentification. Reserved for
869
- # future extensions.
870
- # @param options [Google::Gax::CallOptions]
871
- # Overrides the default settings for this call, e.g, timeout,
872
- # retries, etc.
873
- # @yield [result, operation] Access the result along with the RPC operation
874
- # @yieldparam result [Google::Privacy::Dlp::V2::ReidentifyContentResponse]
875
- # @yieldparam operation [GRPC::ActiveCall::Operation]
876
- # @return [Google::Privacy::Dlp::V2::ReidentifyContentResponse]
877
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
878
- # @example
879
- # require "google/cloud/dlp"
880
- #
881
- # dlp_client = Google::Cloud::Dlp.new(version: :v2)
882
- # formatted_parent = Google::Cloud::Dlp::V2::DlpServiceClient.project_path("[PROJECT]")
883
- # response = dlp_client.reidentify_content(formatted_parent)
884
-
885
- def reidentify_content \
886
- parent,
887
- reidentify_config: nil,
888
- inspect_config: nil,
889
- item: nil,
890
- inspect_template_name: nil,
891
- reidentify_template_name: nil,
892
- location_id: nil,
893
- options: nil,
894
- &block
895
- req = {
896
- parent: parent,
897
- reidentify_config: reidentify_config,
898
- inspect_config: inspect_config,
899
- item: item,
900
- inspect_template_name: inspect_template_name,
901
- reidentify_template_name: reidentify_template_name,
902
- location_id: location_id
903
- }.delete_if { |_, v| v.nil? }
904
- req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::ReidentifyContentRequest)
905
- @reidentify_content.call(req, options, &block)
906
- end
907
-
908
- # Returns a list of the sensitive information types that the DLP API
909
- # supports. See https://cloud.google.com/dlp/docs/infotypes-reference to
910
- # learn more.
911
- #
912
- # @param language_code [String]
913
- # BCP-47 language code for localized infoType friendly
914
- # names. If omitted, or if localized strings are not available,
915
- # en-US strings will be returned.
916
- # @param filter [String]
917
- # filter to only return infoTypes supported by certain parts of the
918
- # API. Defaults to supported_by=INSPECT.
919
- # @param location_id [String]
920
- # The geographic location to list info types. Reserved for future
921
- # extensions.
922
- # @param options [Google::Gax::CallOptions]
923
- # Overrides the default settings for this call, e.g, timeout,
924
- # retries, etc.
925
- # @yield [result, operation] Access the result along with the RPC operation
926
- # @yieldparam result [Google::Privacy::Dlp::V2::ListInfoTypesResponse]
927
- # @yieldparam operation [GRPC::ActiveCall::Operation]
928
- # @return [Google::Privacy::Dlp::V2::ListInfoTypesResponse]
929
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
930
- # @example
931
- # require "google/cloud/dlp"
932
- #
933
- # dlp_client = Google::Cloud::Dlp.new(version: :v2)
934
- # response = dlp_client.list_info_types
935
-
936
- def list_info_types \
937
- language_code: nil,
938
- filter: nil,
939
- location_id: nil,
940
- options: nil,
941
- &block
942
- req = {
943
- language_code: language_code,
944
- filter: filter,
945
- location_id: location_id
946
- }.delete_if { |_, v| v.nil? }
947
- req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::ListInfoTypesRequest)
948
- @list_info_types.call(req, options, &block)
949
- end
950
-
951
- # Creates an InspectTemplate for re-using frequently used configuration
952
- # for inspecting content, images, and storage.
953
- # See https://cloud.google.com/dlp/docs/creating-templates to learn more.
954
- #
955
- # @param parent [String]
956
- # Required. The parent resource name, for example projects/my-project-id or
957
- # organizations/my-org-id.
958
- # @param inspect_template [Google::Privacy::Dlp::V2::InspectTemplate | Hash]
959
- # Required. The InspectTemplate to create.
960
- # A hash of the same form as `Google::Privacy::Dlp::V2::InspectTemplate`
961
- # can also be provided.
962
- # @param template_id [String]
963
- # The template id can contain uppercase and lowercase letters,
964
- # numbers, and hyphens; that is, it must match the regular
965
- # expression: `[a-zA-Z\\d-_]+`. The maximum length is 100
966
- # characters. Can be empty to allow the system to generate one.
967
- # @param location_id [String]
968
- # The geographic location to store the inspection template. Reserved for
969
- # future extensions.
970
- # @param options [Google::Gax::CallOptions]
971
- # Overrides the default settings for this call, e.g, timeout,
972
- # retries, etc.
973
- # @yield [result, operation] Access the result along with the RPC operation
974
- # @yieldparam result [Google::Privacy::Dlp::V2::InspectTemplate]
975
- # @yieldparam operation [GRPC::ActiveCall::Operation]
976
- # @return [Google::Privacy::Dlp::V2::InspectTemplate]
977
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
978
- # @example
979
- # require "google/cloud/dlp"
980
- #
981
- # dlp_client = Google::Cloud::Dlp.new(version: :v2)
982
- # formatted_parent = Google::Cloud::Dlp::V2::DlpServiceClient.organization_path("[ORGANIZATION]")
983
- # response = dlp_client.create_inspect_template(formatted_parent)
984
-
985
- def create_inspect_template \
986
- parent,
987
- inspect_template: nil,
988
- template_id: nil,
989
- location_id: nil,
990
- options: nil,
991
- &block
992
- req = {
993
- parent: parent,
994
- inspect_template: inspect_template,
995
- template_id: template_id,
996
- location_id: location_id
997
- }.delete_if { |_, v| v.nil? }
998
- req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::CreateInspectTemplateRequest)
999
- @create_inspect_template.call(req, options, &block)
1000
- end
1001
-
1002
- # Updates the InspectTemplate.
1003
- # See https://cloud.google.com/dlp/docs/creating-templates to learn more.
1004
- #
1005
- # @param name [String]
1006
- # Required. Resource name of organization and inspectTemplate to be updated, for
1007
- # example `organizations/433245324/inspectTemplates/432452342` or
1008
- # projects/project-id/inspectTemplates/432452342.
1009
- # @param inspect_template [Google::Privacy::Dlp::V2::InspectTemplate | Hash]
1010
- # New InspectTemplate value.
1011
- # A hash of the same form as `Google::Privacy::Dlp::V2::InspectTemplate`
1012
- # can also be provided.
1013
- # @param update_mask [Google::Protobuf::FieldMask | Hash]
1014
- # Mask to control which fields get updated.
1015
- # A hash of the same form as `Google::Protobuf::FieldMask`
1016
- # can also be provided.
1017
- # @param options [Google::Gax::CallOptions]
1018
- # Overrides the default settings for this call, e.g, timeout,
1019
- # retries, etc.
1020
- # @yield [result, operation] Access the result along with the RPC operation
1021
- # @yieldparam result [Google::Privacy::Dlp::V2::InspectTemplate]
1022
- # @yieldparam operation [GRPC::ActiveCall::Operation]
1023
- # @return [Google::Privacy::Dlp::V2::InspectTemplate]
1024
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1025
- # @example
1026
- # require "google/cloud/dlp"
1027
- #
1028
- # dlp_client = Google::Cloud::Dlp.new(version: :v2)
1029
- # formatted_name = Google::Cloud::Dlp::V2::DlpServiceClient.organization_inspect_template_path("[ORGANIZATION]", "[INSPECT_TEMPLATE]")
1030
- # response = dlp_client.update_inspect_template(formatted_name)
1031
-
1032
- def update_inspect_template \
1033
- name,
1034
- inspect_template: nil,
1035
- update_mask: nil,
1036
- options: nil,
1037
- &block
1038
- req = {
1039
- name: name,
1040
- inspect_template: inspect_template,
1041
- update_mask: update_mask
1042
- }.delete_if { |_, v| v.nil? }
1043
- req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::UpdateInspectTemplateRequest)
1044
- @update_inspect_template.call(req, options, &block)
1045
- end
1046
-
1047
- # Gets an InspectTemplate.
1048
- # See https://cloud.google.com/dlp/docs/creating-templates to learn more.
1049
- #
1050
- # @param name [String]
1051
- # Required. Resource name of the organization and inspectTemplate to be read, for
1052
- # example `organizations/433245324/inspectTemplates/432452342` or
1053
- # projects/project-id/inspectTemplates/432452342.
1054
- # @param options [Google::Gax::CallOptions]
1055
- # Overrides the default settings for this call, e.g, timeout,
1056
- # retries, etc.
1057
- # @yield [result, operation] Access the result along with the RPC operation
1058
- # @yieldparam result [Google::Privacy::Dlp::V2::InspectTemplate]
1059
- # @yieldparam operation [GRPC::ActiveCall::Operation]
1060
- # @return [Google::Privacy::Dlp::V2::InspectTemplate]
1061
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1062
- # @example
1063
- # require "google/cloud/dlp"
1064
- #
1065
- # dlp_client = Google::Cloud::Dlp.new(version: :v2)
1066
- # response = dlp_client.get_inspect_template
1067
-
1068
- def get_inspect_template \
1069
- name: nil,
1070
- options: nil,
1071
- &block
1072
- req = {
1073
- name: name
1074
- }.delete_if { |_, v| v.nil? }
1075
- req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::GetInspectTemplateRequest)
1076
- @get_inspect_template.call(req, options, &block)
1077
- end
1078
-
1079
- # Lists InspectTemplates.
1080
- # See https://cloud.google.com/dlp/docs/creating-templates to learn more.
1081
- #
1082
- # @param parent [String]
1083
- # Required. The parent resource name, for example projects/my-project-id or
1084
- # organizations/my-org-id.
1085
- # @param page_size [Integer]
1086
- # The maximum number of resources contained in the underlying API
1087
- # response. If page streaming is performed per-resource, this
1088
- # parameter does not affect the return value. If page streaming is
1089
- # performed per-page, this determines the maximum number of
1090
- # resources in a page.
1091
- # @param order_by [String]
1092
- # Comma separated list of fields to order by,
1093
- # followed by `asc` or `desc` postfix. This list is case-insensitive,
1094
- # default sorting order is ascending, redundant space characters are
1095
- # insignificant.
1096
- #
1097
- # Example: `name asc,update_time, create_time desc`
1098
- #
1099
- # Supported fields are:
1100
- #
1101
- # * `create_time`: corresponds to time the template was created.
1102
- # * `update_time`: corresponds to time the template was last updated.
1103
- # * `name`: corresponds to template's name.
1104
- # * `display_name`: corresponds to template's display name.
1105
- # @param location_id [String]
1106
- # The geographic location where inspection templates will be retrieved from.
1107
- # Use `-` for all locations. Reserved for future extensions.
1108
- # @param options [Google::Gax::CallOptions]
1109
- # Overrides the default settings for this call, e.g, timeout,
1110
- # retries, etc.
1111
- # @yield [result, operation] Access the result along with the RPC operation
1112
- # @yieldparam result [Google::Gax::PagedEnumerable<Google::Privacy::Dlp::V2::InspectTemplate>]
1113
- # @yieldparam operation [GRPC::ActiveCall::Operation]
1114
- # @return [Google::Gax::PagedEnumerable<Google::Privacy::Dlp::V2::InspectTemplate>]
1115
- # An enumerable of Google::Privacy::Dlp::V2::InspectTemplate instances.
1116
- # See Google::Gax::PagedEnumerable documentation for other
1117
- # operations such as per-page iteration or access to the response
1118
- # object.
1119
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1120
- # @example
1121
- # require "google/cloud/dlp"
1122
- #
1123
- # dlp_client = Google::Cloud::Dlp.new(version: :v2)
1124
- # formatted_parent = Google::Cloud::Dlp::V2::DlpServiceClient.organization_path("[ORGANIZATION]")
1125
- #
1126
- # # Iterate over all results.
1127
- # dlp_client.list_inspect_templates(formatted_parent).each do |element|
1128
- # # Process element.
1129
- # end
1130
- #
1131
- # # Or iterate over results one page at a time.
1132
- # dlp_client.list_inspect_templates(formatted_parent).each_page do |page|
1133
- # # Process each page at a time.
1134
- # page.each do |element|
1135
- # # Process element.
1136
- # end
1137
- # end
1138
-
1139
- def list_inspect_templates \
1140
- parent,
1141
- page_size: nil,
1142
- order_by: nil,
1143
- location_id: nil,
1144
- options: nil,
1145
- &block
1146
- req = {
1147
- parent: parent,
1148
- page_size: page_size,
1149
- order_by: order_by,
1150
- location_id: location_id
1151
- }.delete_if { |_, v| v.nil? }
1152
- req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::ListInspectTemplatesRequest)
1153
- @list_inspect_templates.call(req, options, &block)
1154
- end
1155
-
1156
- # Deletes an InspectTemplate.
1157
- # See https://cloud.google.com/dlp/docs/creating-templates to learn more.
1158
- #
1159
- # @param name [String]
1160
- # Required. Resource name of the organization and inspectTemplate to be deleted, for
1161
- # example `organizations/433245324/inspectTemplates/432452342` or
1162
- # projects/project-id/inspectTemplates/432452342.
1163
- # @param options [Google::Gax::CallOptions]
1164
- # Overrides the default settings for this call, e.g, timeout,
1165
- # retries, etc.
1166
- # @yield [result, operation] Access the result along with the RPC operation
1167
- # @yieldparam result []
1168
- # @yieldparam operation [GRPC::ActiveCall::Operation]
1169
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1170
- # @example
1171
- # require "google/cloud/dlp"
1172
- #
1173
- # dlp_client = Google::Cloud::Dlp.new(version: :v2)
1174
- # formatted_name = Google::Cloud::Dlp::V2::DlpServiceClient.organization_inspect_template_path("[ORGANIZATION]", "[INSPECT_TEMPLATE]")
1175
- # dlp_client.delete_inspect_template(formatted_name)
1176
-
1177
- def delete_inspect_template \
1178
- name,
1179
- options: nil,
1180
- &block
1181
- req = {
1182
- name: name
1183
- }.delete_if { |_, v| v.nil? }
1184
- req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::DeleteInspectTemplateRequest)
1185
- @delete_inspect_template.call(req, options, &block)
1186
- nil
1187
- end
1188
-
1189
- # Creates a DeidentifyTemplate for re-using frequently used configuration
1190
- # for de-identifying content, images, and storage.
1191
- # See https://cloud.google.com/dlp/docs/creating-templates-deid to learn
1192
- # more.
1193
- #
1194
- # @param parent [String]
1195
- # Required. The parent resource name, for example projects/my-project-id or
1196
- # organizations/my-org-id.
1197
- # @param deidentify_template [Google::Privacy::Dlp::V2::DeidentifyTemplate | Hash]
1198
- # Required. The DeidentifyTemplate to create.
1199
- # A hash of the same form as `Google::Privacy::Dlp::V2::DeidentifyTemplate`
1200
- # can also be provided.
1201
- # @param template_id [String]
1202
- # The template id can contain uppercase and lowercase letters,
1203
- # numbers, and hyphens; that is, it must match the regular
1204
- # expression: `[a-zA-Z\\d-_]+`. The maximum length is 100
1205
- # characters. Can be empty to allow the system to generate one.
1206
- # @param location_id [String]
1207
- # The geographic location to store the deidentification template. Reserved
1208
- # for future extensions.
1209
- # @param options [Google::Gax::CallOptions]
1210
- # Overrides the default settings for this call, e.g, timeout,
1211
- # retries, etc.
1212
- # @yield [result, operation] Access the result along with the RPC operation
1213
- # @yieldparam result [Google::Privacy::Dlp::V2::DeidentifyTemplate]
1214
- # @yieldparam operation [GRPC::ActiveCall::Operation]
1215
- # @return [Google::Privacy::Dlp::V2::DeidentifyTemplate]
1216
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1217
- # @example
1218
- # require "google/cloud/dlp"
1219
- #
1220
- # dlp_client = Google::Cloud::Dlp.new(version: :v2)
1221
- # formatted_parent = Google::Cloud::Dlp::V2::DlpServiceClient.organization_path("[ORGANIZATION]")
1222
- # response = dlp_client.create_deidentify_template(formatted_parent)
1223
-
1224
- def create_deidentify_template \
1225
- parent,
1226
- deidentify_template: nil,
1227
- template_id: nil,
1228
- location_id: nil,
1229
- options: nil,
1230
- &block
1231
- req = {
1232
- parent: parent,
1233
- deidentify_template: deidentify_template,
1234
- template_id: template_id,
1235
- location_id: location_id
1236
- }.delete_if { |_, v| v.nil? }
1237
- req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::CreateDeidentifyTemplateRequest)
1238
- @create_deidentify_template.call(req, options, &block)
1239
- end
1240
-
1241
- # Updates the DeidentifyTemplate.
1242
- # See https://cloud.google.com/dlp/docs/creating-templates-deid to learn
1243
- # more.
1244
- #
1245
- # @param name [String]
1246
- # Required. Resource name of organization and deidentify template to be updated, for
1247
- # example `organizations/433245324/deidentifyTemplates/432452342` or
1248
- # projects/project-id/deidentifyTemplates/432452342.
1249
- # @param deidentify_template [Google::Privacy::Dlp::V2::DeidentifyTemplate | Hash]
1250
- # New DeidentifyTemplate value.
1251
- # A hash of the same form as `Google::Privacy::Dlp::V2::DeidentifyTemplate`
1252
- # can also be provided.
1253
- # @param update_mask [Google::Protobuf::FieldMask | Hash]
1254
- # Mask to control which fields get updated.
1255
- # A hash of the same form as `Google::Protobuf::FieldMask`
1256
- # can also be provided.
1257
- # @param options [Google::Gax::CallOptions]
1258
- # Overrides the default settings for this call, e.g, timeout,
1259
- # retries, etc.
1260
- # @yield [result, operation] Access the result along with the RPC operation
1261
- # @yieldparam result [Google::Privacy::Dlp::V2::DeidentifyTemplate]
1262
- # @yieldparam operation [GRPC::ActiveCall::Operation]
1263
- # @return [Google::Privacy::Dlp::V2::DeidentifyTemplate]
1264
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1265
- # @example
1266
- # require "google/cloud/dlp"
1267
- #
1268
- # dlp_client = Google::Cloud::Dlp.new(version: :v2)
1269
- # formatted_name = Google::Cloud::Dlp::V2::DlpServiceClient.organization_deidentify_template_path("[ORGANIZATION]", "[DEIDENTIFY_TEMPLATE]")
1270
- # response = dlp_client.update_deidentify_template(formatted_name)
1271
-
1272
- def update_deidentify_template \
1273
- name,
1274
- deidentify_template: nil,
1275
- update_mask: nil,
1276
- options: nil,
1277
- &block
1278
- req = {
1279
- name: name,
1280
- deidentify_template: deidentify_template,
1281
- update_mask: update_mask
1282
- }.delete_if { |_, v| v.nil? }
1283
- req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::UpdateDeidentifyTemplateRequest)
1284
- @update_deidentify_template.call(req, options, &block)
1285
- end
1286
-
1287
- # Gets a DeidentifyTemplate.
1288
- # See https://cloud.google.com/dlp/docs/creating-templates-deid to learn
1289
- # more.
1290
- #
1291
- # @param name [String]
1292
- # Required. Resource name of the organization and deidentify template to be read, for
1293
- # example `organizations/433245324/deidentifyTemplates/432452342` or
1294
- # projects/project-id/deidentifyTemplates/432452342.
1295
- # @param options [Google::Gax::CallOptions]
1296
- # Overrides the default settings for this call, e.g, timeout,
1297
- # retries, etc.
1298
- # @yield [result, operation] Access the result along with the RPC operation
1299
- # @yieldparam result [Google::Privacy::Dlp::V2::DeidentifyTemplate]
1300
- # @yieldparam operation [GRPC::ActiveCall::Operation]
1301
- # @return [Google::Privacy::Dlp::V2::DeidentifyTemplate]
1302
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1303
- # @example
1304
- # require "google/cloud/dlp"
1305
- #
1306
- # dlp_client = Google::Cloud::Dlp.new(version: :v2)
1307
- # formatted_name = Google::Cloud::Dlp::V2::DlpServiceClient.organization_deidentify_template_path("[ORGANIZATION]", "[DEIDENTIFY_TEMPLATE]")
1308
- # response = dlp_client.get_deidentify_template(formatted_name)
1309
-
1310
- def get_deidentify_template \
1311
- name,
1312
- options: nil,
1313
- &block
1314
- req = {
1315
- name: name
1316
- }.delete_if { |_, v| v.nil? }
1317
- req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::GetDeidentifyTemplateRequest)
1318
- @get_deidentify_template.call(req, options, &block)
1319
- end
1320
-
1321
- # Lists DeidentifyTemplates.
1322
- # See https://cloud.google.com/dlp/docs/creating-templates-deid to learn
1323
- # more.
1324
- #
1325
- # @param parent [String]
1326
- # Required. The parent resource name, for example projects/my-project-id or
1327
- # organizations/my-org-id.
1328
- # @param page_size [Integer]
1329
- # The maximum number of resources contained in the underlying API
1330
- # response. If page streaming is performed per-resource, this
1331
- # parameter does not affect the return value. If page streaming is
1332
- # performed per-page, this determines the maximum number of
1333
- # resources in a page.
1334
- # @param order_by [String]
1335
- # Comma separated list of fields to order by,
1336
- # followed by `asc` or `desc` postfix. This list is case-insensitive,
1337
- # default sorting order is ascending, redundant space characters are
1338
- # insignificant.
1339
- #
1340
- # Example: `name asc,update_time, create_time desc`
1341
- #
1342
- # Supported fields are:
1343
- #
1344
- # * `create_time`: corresponds to time the template was created.
1345
- # * `update_time`: corresponds to time the template was last updated.
1346
- # * `name`: corresponds to template's name.
1347
- # * `display_name`: corresponds to template's display name.
1348
- # @param location_id [String]
1349
- # The geographic location where deidentifications templates will be retrieved
1350
- # from. Use `-` for all locations. Reserved for future extensions.
1351
- # @param options [Google::Gax::CallOptions]
1352
- # Overrides the default settings for this call, e.g, timeout,
1353
- # retries, etc.
1354
- # @yield [result, operation] Access the result along with the RPC operation
1355
- # @yieldparam result [Google::Gax::PagedEnumerable<Google::Privacy::Dlp::V2::DeidentifyTemplate>]
1356
- # @yieldparam operation [GRPC::ActiveCall::Operation]
1357
- # @return [Google::Gax::PagedEnumerable<Google::Privacy::Dlp::V2::DeidentifyTemplate>]
1358
- # An enumerable of Google::Privacy::Dlp::V2::DeidentifyTemplate instances.
1359
- # See Google::Gax::PagedEnumerable documentation for other
1360
- # operations such as per-page iteration or access to the response
1361
- # object.
1362
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1363
- # @example
1364
- # require "google/cloud/dlp"
1365
- #
1366
- # dlp_client = Google::Cloud::Dlp.new(version: :v2)
1367
- # formatted_parent = Google::Cloud::Dlp::V2::DlpServiceClient.organization_path("[ORGANIZATION]")
1368
- #
1369
- # # Iterate over all results.
1370
- # dlp_client.list_deidentify_templates(formatted_parent).each do |element|
1371
- # # Process element.
1372
- # end
1373
- #
1374
- # # Or iterate over results one page at a time.
1375
- # dlp_client.list_deidentify_templates(formatted_parent).each_page do |page|
1376
- # # Process each page at a time.
1377
- # page.each do |element|
1378
- # # Process element.
1379
- # end
1380
- # end
1381
-
1382
- def list_deidentify_templates \
1383
- parent,
1384
- page_size: nil,
1385
- order_by: nil,
1386
- location_id: nil,
1387
- options: nil,
1388
- &block
1389
- req = {
1390
- parent: parent,
1391
- page_size: page_size,
1392
- order_by: order_by,
1393
- location_id: location_id
1394
- }.delete_if { |_, v| v.nil? }
1395
- req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::ListDeidentifyTemplatesRequest)
1396
- @list_deidentify_templates.call(req, options, &block)
1397
- end
1398
-
1399
- # Deletes a DeidentifyTemplate.
1400
- # See https://cloud.google.com/dlp/docs/creating-templates-deid to learn
1401
- # more.
1402
- #
1403
- # @param name [String]
1404
- # Required. Resource name of the organization and deidentify template to be deleted,
1405
- # for example `organizations/433245324/deidentifyTemplates/432452342` or
1406
- # projects/project-id/deidentifyTemplates/432452342.
1407
- # @param options [Google::Gax::CallOptions]
1408
- # Overrides the default settings for this call, e.g, timeout,
1409
- # retries, etc.
1410
- # @yield [result, operation] Access the result along with the RPC operation
1411
- # @yieldparam result []
1412
- # @yieldparam operation [GRPC::ActiveCall::Operation]
1413
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1414
- # @example
1415
- # require "google/cloud/dlp"
1416
- #
1417
- # dlp_client = Google::Cloud::Dlp.new(version: :v2)
1418
- # formatted_name = Google::Cloud::Dlp::V2::DlpServiceClient.organization_deidentify_template_path("[ORGANIZATION]", "[DEIDENTIFY_TEMPLATE]")
1419
- # dlp_client.delete_deidentify_template(formatted_name)
1420
-
1421
- def delete_deidentify_template \
1422
- name,
1423
- options: nil,
1424
- &block
1425
- req = {
1426
- name: name
1427
- }.delete_if { |_, v| v.nil? }
1428
- req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::DeleteDeidentifyTemplateRequest)
1429
- @delete_deidentify_template.call(req, options, &block)
1430
- nil
1431
- end
1432
-
1433
- # Creates a new job to inspect storage or calculate risk metrics.
1434
- # See https://cloud.google.com/dlp/docs/inspecting-storage and
1435
- # https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more.
1436
- #
1437
- # When no InfoTypes or CustomInfoTypes are specified in inspect jobs, the
1438
- # system will automatically choose what detectors to run. By default this may
1439
- # be all types, but may change over time as detectors are updated.
1440
- #
1441
- # @param parent [String]
1442
- # Required. The parent resource name, for example projects/my-project-id.
1443
- # @param inspect_job [Google::Privacy::Dlp::V2::InspectJobConfig | Hash]
1444
- # Set to control what and how to inspect.
1445
- # A hash of the same form as `Google::Privacy::Dlp::V2::InspectJobConfig`
1446
- # can also be provided.
1447
- # @param risk_job [Google::Privacy::Dlp::V2::RiskAnalysisJobConfig | Hash]
1448
- # Set to choose what metric to calculate.
1449
- # A hash of the same form as `Google::Privacy::Dlp::V2::RiskAnalysisJobConfig`
1450
- # can also be provided.
1451
- # @param job_id [String]
1452
- # The job id can contain uppercase and lowercase letters,
1453
- # numbers, and hyphens; that is, it must match the regular
1454
- # expression: `[a-zA-Z\\d-_]+`. The maximum length is 100
1455
- # characters. Can be empty to allow the system to generate one.
1456
- # @param location_id [String]
1457
- # The geographic location to store and process the job. Reserved for
1458
- # future extensions.
1459
- # @param options [Google::Gax::CallOptions]
1460
- # Overrides the default settings for this call, e.g, timeout,
1461
- # retries, etc.
1462
- # @yield [result, operation] Access the result along with the RPC operation
1463
- # @yieldparam result [Google::Privacy::Dlp::V2::DlpJob]
1464
- # @yieldparam operation [GRPC::ActiveCall::Operation]
1465
- # @return [Google::Privacy::Dlp::V2::DlpJob]
1466
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1467
- # @example
1468
- # require "google/cloud/dlp"
1469
- #
1470
- # dlp_client = Google::Cloud::Dlp.new(version: :v2)
1471
- # formatted_parent = Google::Cloud::Dlp::V2::DlpServiceClient.project_path("[PROJECT]")
1472
- # response = dlp_client.create_dlp_job(formatted_parent)
1473
-
1474
- def create_dlp_job \
1475
- parent,
1476
- inspect_job: nil,
1477
- risk_job: nil,
1478
- job_id: nil,
1479
- location_id: nil,
1480
- options: nil,
1481
- &block
1482
- req = {
1483
- parent: parent,
1484
- inspect_job: inspect_job,
1485
- risk_job: risk_job,
1486
- job_id: job_id,
1487
- location_id: location_id
1488
- }.delete_if { |_, v| v.nil? }
1489
- req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::CreateDlpJobRequest)
1490
- @create_dlp_job.call(req, options, &block)
1491
- end
1492
-
1493
- # Lists DlpJobs that match the specified filter in the request.
1494
- # See https://cloud.google.com/dlp/docs/inspecting-storage and
1495
- # https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more.
1496
- #
1497
- # @param parent [String]
1498
- # Required. The parent resource name, for example projects/my-project-id.
1499
- # @param filter [String]
1500
- # Allows filtering.
1501
- #
1502
- # Supported syntax:
1503
- #
1504
- # * Filter expressions are made up of one or more restrictions.
1505
- # * Restrictions can be combined by `AND` or `OR` logical operators. A
1506
- # sequence of restrictions implicitly uses `AND`.
1507
- # * A restriction has the form of `{field} {operator} {value}`.
1508
- # * Supported fields/values for inspect jobs:
1509
- # * `state` - PENDING|RUNNING|CANCELED|FINISHED|FAILED
1510
- # * `inspected_storage` - DATASTORE|CLOUD_STORAGE|BIGQUERY
1511
- # * `trigger_name` - The resource name of the trigger that created job.
1512
- # * 'end_time` - Corresponds to time the job finished.
1513
- # * 'start_time` - Corresponds to time the job finished.
1514
- # * Supported fields for risk analysis jobs:
1515
- # * `state` - RUNNING|CANCELED|FINISHED|FAILED
1516
- # * 'end_time` - Corresponds to time the job finished.
1517
- # * 'start_time` - Corresponds to time the job finished.
1518
- # * The operator must be `=` or `!=`.
1519
- #
1520
- # Examples:
1521
- #
1522
- # * inspected_storage = cloud_storage AND state = done
1523
- # * inspected_storage = cloud_storage OR inspected_storage = bigquery
1524
- # * inspected_storage = cloud_storage AND (state = done OR state = canceled)
1525
- # * end_time > \"2017-12-12T00:00:00+00:00\"
1526
- #
1527
- # The length of this field should be no more than 500 characters.
1528
- # @param page_size [Integer]
1529
- # The maximum number of resources contained in the underlying API
1530
- # response. If page streaming is performed per-resource, this
1531
- # parameter does not affect the return value. If page streaming is
1532
- # performed per-page, this determines the maximum number of
1533
- # resources in a page.
1534
- # @param type [Google::Privacy::Dlp::V2::DlpJobType]
1535
- # The type of job. Defaults to `DlpJobType.INSPECT`
1536
- # @param order_by [String]
1537
- # Comma separated list of fields to order by,
1538
- # followed by `asc` or `desc` postfix. This list is case-insensitive,
1539
- # default sorting order is ascending, redundant space characters are
1540
- # insignificant.
1541
- #
1542
- # Example: `name asc, end_time asc, create_time desc`
1543
- #
1544
- # Supported fields are:
1545
- #
1546
- # * `create_time`: corresponds to time the job was created.
1547
- # * `end_time`: corresponds to time the job ended.
1548
- # * `name`: corresponds to job's name.
1549
- # * `state`: corresponds to `state`
1550
- # @param location_id [String]
1551
- # The geographic location where jobs will be retrieved from.
1552
- # Use `-` for all locations. Reserved for future extensions.
1553
- # @param options [Google::Gax::CallOptions]
1554
- # Overrides the default settings for this call, e.g, timeout,
1555
- # retries, etc.
1556
- # @yield [result, operation] Access the result along with the RPC operation
1557
- # @yieldparam result [Google::Gax::PagedEnumerable<Google::Privacy::Dlp::V2::DlpJob>]
1558
- # @yieldparam operation [GRPC::ActiveCall::Operation]
1559
- # @return [Google::Gax::PagedEnumerable<Google::Privacy::Dlp::V2::DlpJob>]
1560
- # An enumerable of Google::Privacy::Dlp::V2::DlpJob instances.
1561
- # See Google::Gax::PagedEnumerable documentation for other
1562
- # operations such as per-page iteration or access to the response
1563
- # object.
1564
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1565
- # @example
1566
- # require "google/cloud/dlp"
1567
- #
1568
- # dlp_client = Google::Cloud::Dlp.new(version: :v2)
1569
- # formatted_parent = Google::Cloud::Dlp::V2::DlpServiceClient.project_path("[PROJECT]")
1570
- #
1571
- # # Iterate over all results.
1572
- # dlp_client.list_dlp_jobs(formatted_parent).each do |element|
1573
- # # Process element.
1574
- # end
1575
- #
1576
- # # Or iterate over results one page at a time.
1577
- # dlp_client.list_dlp_jobs(formatted_parent).each_page do |page|
1578
- # # Process each page at a time.
1579
- # page.each do |element|
1580
- # # Process element.
1581
- # end
1582
- # end
1583
-
1584
- def list_dlp_jobs \
1585
- parent,
1586
- filter: nil,
1587
- page_size: nil,
1588
- type: nil,
1589
- order_by: nil,
1590
- location_id: nil,
1591
- options: nil,
1592
- &block
1593
- req = {
1594
- parent: parent,
1595
- filter: filter,
1596
- page_size: page_size,
1597
- type: type,
1598
- order_by: order_by,
1599
- location_id: location_id
1600
- }.delete_if { |_, v| v.nil? }
1601
- req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::ListDlpJobsRequest)
1602
- @list_dlp_jobs.call(req, options, &block)
1603
- end
1604
-
1605
- # Gets the latest state of a long-running DlpJob.
1606
- # See https://cloud.google.com/dlp/docs/inspecting-storage and
1607
- # https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more.
1608
- #
1609
- # @param name [String]
1610
- # Required. The name of the DlpJob resource.
1611
- # @param options [Google::Gax::CallOptions]
1612
- # Overrides the default settings for this call, e.g, timeout,
1613
- # retries, etc.
1614
- # @yield [result, operation] Access the result along with the RPC operation
1615
- # @yieldparam result [Google::Privacy::Dlp::V2::DlpJob]
1616
- # @yieldparam operation [GRPC::ActiveCall::Operation]
1617
- # @return [Google::Privacy::Dlp::V2::DlpJob]
1618
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1619
- # @example
1620
- # require "google/cloud/dlp"
1621
- #
1622
- # dlp_client = Google::Cloud::Dlp.new(version: :v2)
1623
- # formatted_name = Google::Cloud::Dlp::V2::DlpServiceClient.dlp_job_path("[PROJECT]", "[DLP_JOB]")
1624
- # response = dlp_client.get_dlp_job(formatted_name)
1625
-
1626
- def get_dlp_job \
1627
- name,
1628
- options: nil,
1629
- &block
1630
- req = {
1631
- name: name
1632
- }.delete_if { |_, v| v.nil? }
1633
- req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::GetDlpJobRequest)
1634
- @get_dlp_job.call(req, options, &block)
1635
- end
1636
-
1637
- # Deletes a long-running DlpJob. This method indicates that the client is
1638
- # no longer interested in the DlpJob result. The job will be cancelled if
1639
- # possible.
1640
- # See https://cloud.google.com/dlp/docs/inspecting-storage and
1641
- # https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more.
1642
- #
1643
- # @param name [String]
1644
- # Required. The name of the DlpJob resource to be deleted.
1645
- # @param options [Google::Gax::CallOptions]
1646
- # Overrides the default settings for this call, e.g, timeout,
1647
- # retries, etc.
1648
- # @yield [result, operation] Access the result along with the RPC operation
1649
- # @yieldparam result []
1650
- # @yieldparam operation [GRPC::ActiveCall::Operation]
1651
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1652
- # @example
1653
- # require "google/cloud/dlp"
1654
- #
1655
- # dlp_client = Google::Cloud::Dlp.new(version: :v2)
1656
- # formatted_name = Google::Cloud::Dlp::V2::DlpServiceClient.dlp_job_path("[PROJECT]", "[DLP_JOB]")
1657
- # dlp_client.delete_dlp_job(formatted_name)
1658
-
1659
- def delete_dlp_job \
1660
- name,
1661
- options: nil,
1662
- &block
1663
- req = {
1664
- name: name
1665
- }.delete_if { |_, v| v.nil? }
1666
- req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::DeleteDlpJobRequest)
1667
- @delete_dlp_job.call(req, options, &block)
1668
- nil
1669
- end
1670
-
1671
- # Starts asynchronous cancellation on a long-running DlpJob. The server
1672
- # makes a best effort to cancel the DlpJob, but success is not
1673
- # guaranteed.
1674
- # See https://cloud.google.com/dlp/docs/inspecting-storage and
1675
- # https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more.
1676
- #
1677
- # @param name [String]
1678
- # Required. The name of the DlpJob resource to be cancelled.
1679
- # @param options [Google::Gax::CallOptions]
1680
- # Overrides the default settings for this call, e.g, timeout,
1681
- # retries, etc.
1682
- # @yield [result, operation] Access the result along with the RPC operation
1683
- # @yieldparam result []
1684
- # @yieldparam operation [GRPC::ActiveCall::Operation]
1685
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1686
- # @example
1687
- # require "google/cloud/dlp"
1688
- #
1689
- # dlp_client = Google::Cloud::Dlp.new(version: :v2)
1690
- # formatted_name = Google::Cloud::Dlp::V2::DlpServiceClient.dlp_job_path("[PROJECT]", "[DLP_JOB]")
1691
- # dlp_client.cancel_dlp_job(formatted_name)
1692
-
1693
- def cancel_dlp_job \
1694
- name,
1695
- options: nil,
1696
- &block
1697
- req = {
1698
- name: name
1699
- }.delete_if { |_, v| v.nil? }
1700
- req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::CancelDlpJobRequest)
1701
- @cancel_dlp_job.call(req, options, &block)
1702
- nil
1703
- end
1704
-
1705
- # Lists job triggers.
1706
- # See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more.
1707
- #
1708
- # @param parent [String]
1709
- # Required. The parent resource name, for example `projects/my-project-id`.
1710
- # @param page_size [Integer]
1711
- # The maximum number of resources contained in the underlying API
1712
- # response. If page streaming is performed per-resource, this
1713
- # parameter does not affect the return value. If page streaming is
1714
- # performed per-page, this determines the maximum number of
1715
- # resources in a page.
1716
- # @param order_by [String]
1717
- # Comma separated list of triggeredJob fields to order by,
1718
- # followed by `asc` or `desc` postfix. This list is case-insensitive,
1719
- # default sorting order is ascending, redundant space characters are
1720
- # insignificant.
1721
- #
1722
- # Example: `name asc,update_time, create_time desc`
1723
- #
1724
- # Supported fields are:
1725
- #
1726
- # * `create_time`: corresponds to time the JobTrigger was created.
1727
- # * `update_time`: corresponds to time the JobTrigger was last updated.
1728
- # * `last_run_time`: corresponds to the last time the JobTrigger ran.
1729
- # * `name`: corresponds to JobTrigger's name.
1730
- # * `display_name`: corresponds to JobTrigger's display name.
1731
- # * `status`: corresponds to JobTrigger's status.
1732
- # @param filter [String]
1733
- # Allows filtering.
1734
- #
1735
- # Supported syntax:
1736
- #
1737
- # * Filter expressions are made up of one or more restrictions.
1738
- # * Restrictions can be combined by `AND` or `OR` logical operators. A
1739
- # sequence of restrictions implicitly uses `AND`.
1740
- # * A restriction has the form of `{field} {operator} {value}`.
1741
- # * Supported fields/values for inspect jobs:
1742
- # * `status` - HEALTHY|PAUSED|CANCELLED
1743
- # * `inspected_storage` - DATASTORE|CLOUD_STORAGE|BIGQUERY
1744
- # * 'last_run_time` - RFC 3339 formatted timestamp, surrounded by
1745
- # quotation marks. Nanoseconds are ignored.
1746
- # * 'error_count' - Number of errors that have occurred while running.
1747
- # * The operator must be `=` or `!=` for status and inspected_storage.
1748
- #
1749
- # Examples:
1750
- #
1751
- # * inspected_storage = cloud_storage AND status = HEALTHY
1752
- # * inspected_storage = cloud_storage OR inspected_storage = bigquery
1753
- # * inspected_storage = cloud_storage AND (state = PAUSED OR state = HEALTHY)
1754
- # * last_run_time > \"2017-12-12T00:00:00+00:00\"
1755
- #
1756
- # The length of this field should be no more than 500 characters.
1757
- # @param location_id [String]
1758
- # The geographic location where job triggers will be retrieved from.
1759
- # Use `-` for all locations. Reserved for future extensions.
1760
- # @param options [Google::Gax::CallOptions]
1761
- # Overrides the default settings for this call, e.g, timeout,
1762
- # retries, etc.
1763
- # @yield [result, operation] Access the result along with the RPC operation
1764
- # @yieldparam result [Google::Gax::PagedEnumerable<Google::Privacy::Dlp::V2::JobTrigger>]
1765
- # @yieldparam operation [GRPC::ActiveCall::Operation]
1766
- # @return [Google::Gax::PagedEnumerable<Google::Privacy::Dlp::V2::JobTrigger>]
1767
- # An enumerable of Google::Privacy::Dlp::V2::JobTrigger instances.
1768
- # See Google::Gax::PagedEnumerable documentation for other
1769
- # operations such as per-page iteration or access to the response
1770
- # object.
1771
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1772
- # @example
1773
- # require "google/cloud/dlp"
1774
- #
1775
- # dlp_client = Google::Cloud::Dlp.new(version: :v2)
1776
- # formatted_parent = Google::Cloud::Dlp::V2::DlpServiceClient.project_path("[PROJECT]")
1777
- #
1778
- # # Iterate over all results.
1779
- # dlp_client.list_job_triggers(formatted_parent).each do |element|
1780
- # # Process element.
1781
- # end
1782
- #
1783
- # # Or iterate over results one page at a time.
1784
- # dlp_client.list_job_triggers(formatted_parent).each_page do |page|
1785
- # # Process each page at a time.
1786
- # page.each do |element|
1787
- # # Process element.
1788
- # end
1789
- # end
1790
-
1791
- def list_job_triggers \
1792
- parent,
1793
- page_size: nil,
1794
- order_by: nil,
1795
- filter: nil,
1796
- location_id: nil,
1797
- options: nil,
1798
- &block
1799
- req = {
1800
- parent: parent,
1801
- page_size: page_size,
1802
- order_by: order_by,
1803
- filter: filter,
1804
- location_id: location_id
1805
- }.delete_if { |_, v| v.nil? }
1806
- req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::ListJobTriggersRequest)
1807
- @list_job_triggers.call(req, options, &block)
1808
- end
1809
-
1810
- # Gets a job trigger.
1811
- # See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more.
1812
- #
1813
- # @param name [String]
1814
- # Required. Resource name of the project and the triggeredJob, for example
1815
- # `projects/dlp-test-project/jobTriggers/53234423`.
1816
- # @param options [Google::Gax::CallOptions]
1817
- # Overrides the default settings for this call, e.g, timeout,
1818
- # retries, etc.
1819
- # @yield [result, operation] Access the result along with the RPC operation
1820
- # @yieldparam result [Google::Privacy::Dlp::V2::JobTrigger]
1821
- # @yieldparam operation [GRPC::ActiveCall::Operation]
1822
- # @return [Google::Privacy::Dlp::V2::JobTrigger]
1823
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1824
- # @example
1825
- # require "google/cloud/dlp"
1826
- #
1827
- # dlp_client = Google::Cloud::Dlp.new(version: :v2)
1828
- # formatted_name = Google::Cloud::Dlp::V2::DlpServiceClient.project_job_trigger_path("[PROJECT]", "[JOB_TRIGGER]")
1829
- # response = dlp_client.get_job_trigger(formatted_name)
1830
-
1831
- def get_job_trigger \
1832
- name,
1833
- options: nil,
1834
- &block
1835
- req = {
1836
- name: name
1837
- }.delete_if { |_, v| v.nil? }
1838
- req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::GetJobTriggerRequest)
1839
- @get_job_trigger.call(req, options, &block)
1840
- end
1841
-
1842
- # Deletes a job trigger.
1843
- # See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more.
1844
- #
1845
- # @param name [String]
1846
- # Required. Resource name of the project and the triggeredJob, for example
1847
- # `projects/dlp-test-project/jobTriggers/53234423`.
1848
- # @param options [Google::Gax::CallOptions]
1849
- # Overrides the default settings for this call, e.g, timeout,
1850
- # retries, etc.
1851
- # @yield [result, operation] Access the result along with the RPC operation
1852
- # @yieldparam result []
1853
- # @yieldparam operation [GRPC::ActiveCall::Operation]
1854
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1855
- # @example
1856
- # require "google/cloud/dlp"
1857
- #
1858
- # dlp_client = Google::Cloud::Dlp.new(version: :v2)
1859
- #
1860
- # # TODO: Initialize `name`:
1861
- # name = ''
1862
- # dlp_client.delete_job_trigger(name)
1863
-
1864
- def delete_job_trigger \
1865
- name,
1866
- options: nil,
1867
- &block
1868
- req = {
1869
- name: name
1870
- }.delete_if { |_, v| v.nil? }
1871
- req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::DeleteJobTriggerRequest)
1872
- @delete_job_trigger.call(req, options, &block)
1873
- nil
1874
- end
1875
-
1876
- # Updates a job trigger.
1877
- # See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more.
1878
- #
1879
- # @param name [String]
1880
- # Required. Resource name of the project and the triggeredJob, for example
1881
- # `projects/dlp-test-project/jobTriggers/53234423`.
1882
- # @param job_trigger [Google::Privacy::Dlp::V2::JobTrigger | Hash]
1883
- # New JobTrigger value.
1884
- # A hash of the same form as `Google::Privacy::Dlp::V2::JobTrigger`
1885
- # can also be provided.
1886
- # @param update_mask [Google::Protobuf::FieldMask | Hash]
1887
- # Mask to control which fields get updated.
1888
- # A hash of the same form as `Google::Protobuf::FieldMask`
1889
- # can also be provided.
1890
- # @param options [Google::Gax::CallOptions]
1891
- # Overrides the default settings for this call, e.g, timeout,
1892
- # retries, etc.
1893
- # @yield [result, operation] Access the result along with the RPC operation
1894
- # @yieldparam result [Google::Privacy::Dlp::V2::JobTrigger]
1895
- # @yieldparam operation [GRPC::ActiveCall::Operation]
1896
- # @return [Google::Privacy::Dlp::V2::JobTrigger]
1897
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1898
- # @example
1899
- # require "google/cloud/dlp"
1900
- #
1901
- # dlp_client = Google::Cloud::Dlp.new(version: :v2)
1902
- # formatted_name = Google::Cloud::Dlp::V2::DlpServiceClient.project_job_trigger_path("[PROJECT]", "[JOB_TRIGGER]")
1903
- # response = dlp_client.update_job_trigger(formatted_name)
1904
-
1905
- def update_job_trigger \
1906
- name,
1907
- job_trigger: nil,
1908
- update_mask: nil,
1909
- options: nil,
1910
- &block
1911
- req = {
1912
- name: name,
1913
- job_trigger: job_trigger,
1914
- update_mask: update_mask
1915
- }.delete_if { |_, v| v.nil? }
1916
- req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::UpdateJobTriggerRequest)
1917
- @update_job_trigger.call(req, options, &block)
1918
- end
1919
-
1920
- # Creates a job trigger to run DLP actions such as scanning storage for
1921
- # sensitive information on a set schedule.
1922
- # See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more.
1923
- #
1924
- # @param parent [String]
1925
- # Required. The parent resource name, for example projects/my-project-id.
1926
- # @param job_trigger [Google::Privacy::Dlp::V2::JobTrigger | Hash]
1927
- # Required. The JobTrigger to create.
1928
- # A hash of the same form as `Google::Privacy::Dlp::V2::JobTrigger`
1929
- # can also be provided.
1930
- # @param trigger_id [String]
1931
- # The trigger id can contain uppercase and lowercase letters,
1932
- # numbers, and hyphens; that is, it must match the regular
1933
- # expression: `[a-zA-Z\\d-_]+`. The maximum length is 100
1934
- # characters. Can be empty to allow the system to generate one.
1935
- # @param location_id [String]
1936
- # The geographic location to store the job trigger. Reserved for
1937
- # future extensions.
1938
- # @param options [Google::Gax::CallOptions]
1939
- # Overrides the default settings for this call, e.g, timeout,
1940
- # retries, etc.
1941
- # @yield [result, operation] Access the result along with the RPC operation
1942
- # @yieldparam result [Google::Privacy::Dlp::V2::JobTrigger]
1943
- # @yieldparam operation [GRPC::ActiveCall::Operation]
1944
- # @return [Google::Privacy::Dlp::V2::JobTrigger]
1945
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1946
- # @example
1947
- # require "google/cloud/dlp"
1948
- #
1949
- # dlp_client = Google::Cloud::Dlp.new(version: :v2)
1950
- # formatted_parent = Google::Cloud::Dlp::V2::DlpServiceClient.project_path("[PROJECT]")
1951
- # response = dlp_client.create_job_trigger(formatted_parent)
1952
-
1953
- def create_job_trigger \
1954
- parent,
1955
- job_trigger: nil,
1956
- trigger_id: nil,
1957
- location_id: nil,
1958
- options: nil,
1959
- &block
1960
- req = {
1961
- parent: parent,
1962
- job_trigger: job_trigger,
1963
- trigger_id: trigger_id,
1964
- location_id: location_id
1965
- }.delete_if { |_, v| v.nil? }
1966
- req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::CreateJobTriggerRequest)
1967
- @create_job_trigger.call(req, options, &block)
1968
- end
1969
-
1970
- # Creates a pre-built stored infoType to be used for inspection.
1971
- # See https://cloud.google.com/dlp/docs/creating-stored-infotypes to
1972
- # learn more.
1973
- #
1974
- # @param parent [String]
1975
- # Required. The parent resource name, for example projects/my-project-id or
1976
- # organizations/my-org-id.
1977
- # @param config [Google::Privacy::Dlp::V2::StoredInfoTypeConfig | Hash]
1978
- # Required. Configuration of the storedInfoType to create.
1979
- # A hash of the same form as `Google::Privacy::Dlp::V2::StoredInfoTypeConfig`
1980
- # can also be provided.
1981
- # @param stored_info_type_id [String]
1982
- # The storedInfoType ID can contain uppercase and lowercase letters,
1983
- # numbers, and hyphens; that is, it must match the regular
1984
- # expression: `[a-zA-Z\\d-_]+`. The maximum length is 100
1985
- # characters. Can be empty to allow the system to generate one.
1986
- # @param location_id [String]
1987
- # The geographic location to store the stored infoType. Reserved for
1988
- # future extensions.
1989
- # @param options [Google::Gax::CallOptions]
1990
- # Overrides the default settings for this call, e.g, timeout,
1991
- # retries, etc.
1992
- # @yield [result, operation] Access the result along with the RPC operation
1993
- # @yieldparam result [Google::Privacy::Dlp::V2::StoredInfoType]
1994
- # @yieldparam operation [GRPC::ActiveCall::Operation]
1995
- # @return [Google::Privacy::Dlp::V2::StoredInfoType]
1996
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1997
- # @example
1998
- # require "google/cloud/dlp"
1999
- #
2000
- # dlp_client = Google::Cloud::Dlp.new(version: :v2)
2001
- # formatted_parent = Google::Cloud::Dlp::V2::DlpServiceClient.organization_path("[ORGANIZATION]")
2002
- # response = dlp_client.create_stored_info_type(formatted_parent)
2003
-
2004
- def create_stored_info_type \
2005
- parent,
2006
- config: nil,
2007
- stored_info_type_id: nil,
2008
- location_id: nil,
2009
- options: nil,
2010
- &block
2011
- req = {
2012
- parent: parent,
2013
- config: config,
2014
- stored_info_type_id: stored_info_type_id,
2015
- location_id: location_id
2016
- }.delete_if { |_, v| v.nil? }
2017
- req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::CreateStoredInfoTypeRequest)
2018
- @create_stored_info_type.call(req, options, &block)
2019
- end
2020
-
2021
- # Updates the stored infoType by creating a new version. The existing version
2022
- # will continue to be used until the new version is ready.
2023
- # See https://cloud.google.com/dlp/docs/creating-stored-infotypes to
2024
- # learn more.
2025
- #
2026
- # @param name [String]
2027
- # Required. Resource name of organization and storedInfoType to be updated, for
2028
- # example `organizations/433245324/storedInfoTypes/432452342` or
2029
- # projects/project-id/storedInfoTypes/432452342.
2030
- # @param config [Google::Privacy::Dlp::V2::StoredInfoTypeConfig | Hash]
2031
- # Updated configuration for the storedInfoType. If not provided, a new
2032
- # version of the storedInfoType will be created with the existing
2033
- # configuration.
2034
- # A hash of the same form as `Google::Privacy::Dlp::V2::StoredInfoTypeConfig`
2035
- # can also be provided.
2036
- # @param update_mask [Google::Protobuf::FieldMask | Hash]
2037
- # Mask to control which fields get updated.
2038
- # A hash of the same form as `Google::Protobuf::FieldMask`
2039
- # can also be provided.
2040
- # @param options [Google::Gax::CallOptions]
2041
- # Overrides the default settings for this call, e.g, timeout,
2042
- # retries, etc.
2043
- # @yield [result, operation] Access the result along with the RPC operation
2044
- # @yieldparam result [Google::Privacy::Dlp::V2::StoredInfoType]
2045
- # @yieldparam operation [GRPC::ActiveCall::Operation]
2046
- # @return [Google::Privacy::Dlp::V2::StoredInfoType]
2047
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
2048
- # @example
2049
- # require "google/cloud/dlp"
2050
- #
2051
- # dlp_client = Google::Cloud::Dlp.new(version: :v2)
2052
- # formatted_name = Google::Cloud::Dlp::V2::DlpServiceClient.organization_stored_info_type_path("[ORGANIZATION]", "[STORED_INFO_TYPE]")
2053
- # response = dlp_client.update_stored_info_type(formatted_name)
2054
-
2055
- def update_stored_info_type \
2056
- name,
2057
- config: nil,
2058
- update_mask: nil,
2059
- options: nil,
2060
- &block
2061
- req = {
2062
- name: name,
2063
- config: config,
2064
- update_mask: update_mask
2065
- }.delete_if { |_, v| v.nil? }
2066
- req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::UpdateStoredInfoTypeRequest)
2067
- @update_stored_info_type.call(req, options, &block)
2068
- end
2069
-
2070
- # Gets a stored infoType.
2071
- # See https://cloud.google.com/dlp/docs/creating-stored-infotypes to
2072
- # learn more.
2073
- #
2074
- # @param name [String]
2075
- # Required. Resource name of the organization and storedInfoType to be read, for
2076
- # example `organizations/433245324/storedInfoTypes/432452342` or
2077
- # projects/project-id/storedInfoTypes/432452342.
2078
- # @param options [Google::Gax::CallOptions]
2079
- # Overrides the default settings for this call, e.g, timeout,
2080
- # retries, etc.
2081
- # @yield [result, operation] Access the result along with the RPC operation
2082
- # @yieldparam result [Google::Privacy::Dlp::V2::StoredInfoType]
2083
- # @yieldparam operation [GRPC::ActiveCall::Operation]
2084
- # @return [Google::Privacy::Dlp::V2::StoredInfoType]
2085
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
2086
- # @example
2087
- # require "google/cloud/dlp"
2088
- #
2089
- # dlp_client = Google::Cloud::Dlp.new(version: :v2)
2090
- # formatted_name = Google::Cloud::Dlp::V2::DlpServiceClient.organization_stored_info_type_path("[ORGANIZATION]", "[STORED_INFO_TYPE]")
2091
- # response = dlp_client.get_stored_info_type(formatted_name)
2092
-
2093
- def get_stored_info_type \
2094
- name,
2095
- options: nil,
2096
- &block
2097
- req = {
2098
- name: name
2099
- }.delete_if { |_, v| v.nil? }
2100
- req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::GetStoredInfoTypeRequest)
2101
- @get_stored_info_type.call(req, options, &block)
2102
- end
2103
-
2104
- # Lists stored infoTypes.
2105
- # See https://cloud.google.com/dlp/docs/creating-stored-infotypes to
2106
- # learn more.
2107
- #
2108
- # @param parent [String]
2109
- # Required. The parent resource name, for example projects/my-project-id or
2110
- # organizations/my-org-id.
2111
- # @param page_size [Integer]
2112
- # The maximum number of resources contained in the underlying API
2113
- # response. If page streaming is performed per-resource, this
2114
- # parameter does not affect the return value. If page streaming is
2115
- # performed per-page, this determines the maximum number of
2116
- # resources in a page.
2117
- # @param order_by [String]
2118
- # Comma separated list of fields to order by,
2119
- # followed by `asc` or `desc` postfix. This list is case-insensitive,
2120
- # default sorting order is ascending, redundant space characters are
2121
- # insignificant.
2122
- #
2123
- # Example: `name asc, display_name, create_time desc`
2124
- #
2125
- # Supported fields are:
2126
- #
2127
- # * `create_time`: corresponds to time the most recent version of the
2128
- # resource was created.
2129
- # * `state`: corresponds to the state of the resource.
2130
- # * `name`: corresponds to resource name.
2131
- # * `display_name`: corresponds to info type's display name.
2132
- # @param location_id [String]
2133
- # The geographic location where stored infoTypes will be retrieved from.
2134
- # Use `-` for all locations. Reserved for future extensions.
2135
- # @param options [Google::Gax::CallOptions]
2136
- # Overrides the default settings for this call, e.g, timeout,
2137
- # retries, etc.
2138
- # @yield [result, operation] Access the result along with the RPC operation
2139
- # @yieldparam result [Google::Gax::PagedEnumerable<Google::Privacy::Dlp::V2::StoredInfoType>]
2140
- # @yieldparam operation [GRPC::ActiveCall::Operation]
2141
- # @return [Google::Gax::PagedEnumerable<Google::Privacy::Dlp::V2::StoredInfoType>]
2142
- # An enumerable of Google::Privacy::Dlp::V2::StoredInfoType instances.
2143
- # See Google::Gax::PagedEnumerable documentation for other
2144
- # operations such as per-page iteration or access to the response
2145
- # object.
2146
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
2147
- # @example
2148
- # require "google/cloud/dlp"
2149
- #
2150
- # dlp_client = Google::Cloud::Dlp.new(version: :v2)
2151
- # formatted_parent = Google::Cloud::Dlp::V2::DlpServiceClient.organization_path("[ORGANIZATION]")
2152
- #
2153
- # # Iterate over all results.
2154
- # dlp_client.list_stored_info_types(formatted_parent).each do |element|
2155
- # # Process element.
2156
- # end
2157
- #
2158
- # # Or iterate over results one page at a time.
2159
- # dlp_client.list_stored_info_types(formatted_parent).each_page do |page|
2160
- # # Process each page at a time.
2161
- # page.each do |element|
2162
- # # Process element.
2163
- # end
2164
- # end
2165
-
2166
- def list_stored_info_types \
2167
- parent,
2168
- page_size: nil,
2169
- order_by: nil,
2170
- location_id: nil,
2171
- options: nil,
2172
- &block
2173
- req = {
2174
- parent: parent,
2175
- page_size: page_size,
2176
- order_by: order_by,
2177
- location_id: location_id
2178
- }.delete_if { |_, v| v.nil? }
2179
- req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::ListStoredInfoTypesRequest)
2180
- @list_stored_info_types.call(req, options, &block)
2181
- end
2182
-
2183
- # Deletes a stored infoType.
2184
- # See https://cloud.google.com/dlp/docs/creating-stored-infotypes to
2185
- # learn more.
2186
- #
2187
- # @param name [String]
2188
- # Required. Resource name of the organization and storedInfoType to be deleted, for
2189
- # example `organizations/433245324/storedInfoTypes/432452342` or
2190
- # projects/project-id/storedInfoTypes/432452342.
2191
- # @param options [Google::Gax::CallOptions]
2192
- # Overrides the default settings for this call, e.g, timeout,
2193
- # retries, etc.
2194
- # @yield [result, operation] Access the result along with the RPC operation
2195
- # @yieldparam result []
2196
- # @yieldparam operation [GRPC::ActiveCall::Operation]
2197
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
2198
- # @example
2199
- # require "google/cloud/dlp"
2200
- #
2201
- # dlp_client = Google::Cloud::Dlp.new(version: :v2)
2202
- # formatted_name = Google::Cloud::Dlp::V2::DlpServiceClient.organization_stored_info_type_path("[ORGANIZATION]", "[STORED_INFO_TYPE]")
2203
- # dlp_client.delete_stored_info_type(formatted_name)
2204
-
2205
- def delete_stored_info_type \
2206
- name,
2207
- options: nil,
2208
- &block
2209
- req = {
2210
- name: name
2211
- }.delete_if { |_, v| v.nil? }
2212
- req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::DeleteStoredInfoTypeRequest)
2213
- @delete_stored_info_type.call(req, options, &block)
2214
- nil
2215
- end
2216
- end
2217
- end
2218
- end
2219
- end
2220
- end