google-cloud-dlp 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1e4904110763b53a181c60de690ae2211f281a746e6163698fa9a67b2a5e809a
4
- data.tar.gz: 2baf5b639f97e81027351671172f94a17c389632cb83446ed69bc1c5d8be4e71
3
+ metadata.gz: fc445302ca7be0cf9903cf20f83a3930933ad9684ec465033326738d10196623
4
+ data.tar.gz: e80addd408ffab2209d291af7d669967bf74e05c89c55817c860fbf929aa7c41
5
5
  SHA512:
6
- metadata.gz: 83000b850221c7c62a4531bcda662abe992729962dcd45c925087c6ca6a3f82001fecf626497cdf4d5c10b081e2d305c39d603a94eae115044df2b7d019b98aa
7
- data.tar.gz: 373488210f2fc213b8325a92d1dc8d6ea9839d883bda350a3de8923b649563c59f1f284dc899d668677d85a3f6754f258547847bcf1fa46cce8cb1f4dbc7262b
6
+ metadata.gz: '092b7d9876ec62cfa77ddb2ccaa7fb5164da82a52dc92310ffe8561529248f0f0a95159e2a0c53ab530c663caa597465b83a9225f3ace02c00b65503fd7367b8'
7
+ data.tar.gz: 25270a7d9ce146e253c59ed19a12a32378215652759160c9353743d651475f0ebdf84cf7c0ae9ad09c324b7ce05bcd03ff7af77433ac835d7fb189fafa5ba6e2
data/README.md CHANGED
@@ -21,19 +21,34 @@ steps:
21
21
  $ gem install google-cloud-dlp
22
22
  ```
23
23
 
24
+ ### Supported Ruby Versions
25
+
26
+ This library is supported on Ruby 2.0+.
27
+
28
+ However, Ruby 2.3 or later is strongly recommended, as earlier releases have
29
+ reached or are nearing end-of-life. After June 1, 2018, Google will provide
30
+ official support only for Ruby versions that are considered current and
31
+ supported by Ruby Core (that is, Ruby versions that are either in normal
32
+ maintenance or in security maintenance).
33
+ See https://www.ruby-lang.org/en/downloads/branches/ for further details.
34
+
24
35
  ### Preview
25
36
  #### DlpServiceClient
26
37
  ```rb
27
38
  require "google/cloud/dlp"
28
39
 
29
- dlp_service_client = Google::Cloud::Dlp.new
30
- min_likelihood = :POSSIBLE
31
- inspect_config = { min_likelihood: min_likelihood }
32
- type = "text/plain"
33
- value = "my phone number is 215-512-1212"
34
- items_element = { type: type, value: value }
35
- items = [items_element]
36
- response = dlp_service_client.inspect_content(inspect_config, items)
40
+ dlp = Google::Cloud::Dlp.new
41
+
42
+ inspect_config = {
43
+ info_types: [{ name: "PHONE_NUMBER" }],
44
+ min_likelihood: :POSSIBLE
45
+ }
46
+ item = { value: "my phone number is 215-512-1212" }
47
+ parent = "projects/#{ENV["MY_PROJECT"]}"
48
+
49
+ response = dlp.inspect_content parent,
50
+ inspect_config: inspect_config,
51
+ item: item
37
52
  ```
38
53
 
39
54
  ### Next Steps
@@ -44,5 +59,5 @@ response = dlp_service_client.inspect_content(inspect_config, items)
44
59
  - View this [repository's main README](https://github.com/GoogleCloudPlatform/google-cloud-ruby/blob/master/README.md)
45
60
  to see the full list of Cloud APIs that we cover.
46
61
 
47
- [Client Library Documentation]: https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud-dlp/latest/google/privacy/dlp/v2beta1
62
+ [Client Library Documentation]: https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud-dlp/latest/google/privacy/dlp/v2
48
63
  [Product Documentation]: https://cloud.google.com/dlp
@@ -1,4 +1,4 @@
1
- # Copyright 2017 Google LLC
1
+ # Copyright 2018 Google LLC
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -81,7 +81,7 @@ module Google
81
81
  # scheduling of data scans on Google Cloud Platform based data sets.
82
82
  #
83
83
  # @param version [Symbol, String]
84
- # The major version of the service to be used. By default :v2beta1
84
+ # The major version of the service to be used. By default :v2
85
85
  # is used.
86
86
  # @overload new(version:, credentials:, scopes:, client_config:, timeout:)
87
87
  # @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
@@ -108,7 +108,7 @@ module Google
108
108
  # or the specified config is missing data points.
109
109
  # @param timeout [Numeric]
110
110
  # The default timeout, in seconds, for calls made through this client.
111
- def self.new(*args, version: :v2beta1, **kwargs)
111
+ def self.new(*args, version: :v2, **kwargs)
112
112
  unless AVAILABLE_VERSIONS.include?(version.to_s.downcase)
113
113
  raise "The version: #{version} is not available. The available versions " \
114
114
  "are: [#{AVAILABLE_VERSIONS.join(", ")}]"
@@ -1,4 +1,4 @@
1
- # Copyright 2017 Google LLC
1
+ # Copyright 2018 Google LLC
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -0,0 +1,102 @@
1
+ # Copyright 2018 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
+ require "google/cloud/dlp/v2/dlp_service_client"
16
+
17
+ module Google
18
+ module Cloud
19
+ # rubocop:disable LineLength
20
+
21
+ ##
22
+ # # Ruby Client for DLP API ([Alpha](https://github.com/GoogleCloudPlatform/google-cloud-ruby#versioning))
23
+ #
24
+ # [DLP API][Product Documentation]:
25
+ #
26
+ # - [Product Documentation][]
27
+ #
28
+ # ## Quick Start
29
+ # In order to use this library, you first need to go through the following
30
+ # steps:
31
+ #
32
+ # 1. [Select or create a Cloud Platform project.](https://console.cloud.google.com/project)
33
+ # 2. [Enable billing for your project.](https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project)
34
+ # 3. [Enable the DLP API.](https://console.cloud.google.com/apis/api/dlp)
35
+ # 4. [Setup Authentication.](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud/master/guides/authentication)
36
+ #
37
+ # ### Next Steps
38
+ # - Read the [DLP API Product documentation][Product Documentation]
39
+ # to learn more about the product and see How-to Guides.
40
+ # - View this [repository's main README](https://github.com/GoogleCloudPlatform/google-cloud-ruby/blob/master/README.md)
41
+ # to see the full list of Cloud APIs that we cover.
42
+ #
43
+ # [Product Documentation]: https://cloud.google.com/dlp
44
+ #
45
+ #
46
+ module Dlp
47
+ module V2
48
+ # rubocop:enable LineLength
49
+
50
+ ##
51
+ # The DLP API is a service that allows clients
52
+ # to detect the presence of Personally Identifiable Information (PII) and other
53
+ # privacy-sensitive data in user-supplied, unstructured data streams, like text
54
+ # blocks or images.
55
+ # The service also includes methods for sensitive data redaction and
56
+ # scheduling of data scans on Google Cloud Platform based data sets.
57
+ #
58
+ # @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
59
+ # Provides the means for authenticating requests made by the client. This parameter can
60
+ # be many types.
61
+ # A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
62
+ # authenticating requests made by this client.
63
+ # A `String` will be treated as the path to the keyfile to be used for the construction of
64
+ # credentials for this client.
65
+ # A `Hash` will be treated as the contents of a keyfile to be used for the construction of
66
+ # credentials for this client.
67
+ # A `GRPC::Core::Channel` will be used to make calls through.
68
+ # A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
69
+ # should already be composed with a `GRPC::Core::CallCredentials` object.
70
+ # A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
71
+ # metadata for requests, generally, to give OAuth credentials.
72
+ # @param scopes [Array<String>]
73
+ # The OAuth scopes for this service. This parameter is ignored if
74
+ # an updater_proc is supplied.
75
+ # @param client_config [Hash]
76
+ # A Hash for call options for each method. See
77
+ # Google::Gax#construct_settings for the structure of
78
+ # this data. Falls back to the default config if not specified
79
+ # or the specified config is missing data points.
80
+ # @param timeout [Numeric]
81
+ # The default timeout, in seconds, for calls made through this client.
82
+ def self.new \
83
+ credentials: nil,
84
+ scopes: nil,
85
+ client_config: nil,
86
+ timeout: nil,
87
+ lib_name: nil,
88
+ lib_version: nil
89
+ kwargs = {
90
+ credentials: credentials,
91
+ scopes: scopes,
92
+ client_config: client_config,
93
+ timeout: timeout,
94
+ lib_name: lib_name,
95
+ lib_version: lib_version
96
+ }.select { |_, v| v != nil }
97
+ Google::Cloud::Dlp::V2::DlpServiceClient.new(**kwargs)
98
+ end
99
+ end
100
+ end
101
+ end
102
+ end
@@ -0,0 +1,1459 @@
1
+ # Copyright 2018 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
+ require "json"
23
+ require "pathname"
24
+
25
+ require "google/gax"
26
+
27
+ require "google/privacy/dlp/v2/dlp_pb"
28
+ require "google/cloud/dlp/credentials"
29
+
30
+ module Google
31
+ module Cloud
32
+ module Dlp
33
+ module V2
34
+ # The DLP API is a service that allows clients
35
+ # to detect the presence of Personally Identifiable Information (PII) and other
36
+ # privacy-sensitive data in user-supplied, unstructured data streams, like text
37
+ # blocks or images.
38
+ # The service also includes methods for sensitive data redaction and
39
+ # scheduling of data scans on Google Cloud Platform based data sets.
40
+ #
41
+ # @!attribute [r] dlp_service_stub
42
+ # @return [Google::Privacy::Dlp::V2::DlpService::Stub]
43
+ class DlpServiceClient
44
+ attr_reader :dlp_service_stub
45
+
46
+ # The default address of the service.
47
+ SERVICE_ADDRESS = "dlp.googleapis.com".freeze
48
+
49
+ # The default port of the service.
50
+ DEFAULT_SERVICE_PORT = 443
51
+
52
+ DEFAULT_TIMEOUT = 30
53
+
54
+ PAGE_DESCRIPTORS = {
55
+ "list_inspect_templates" => Google::Gax::PageDescriptor.new(
56
+ "page_token",
57
+ "next_page_token",
58
+ "inspect_templates"),
59
+ "list_deidentify_templates" => Google::Gax::PageDescriptor.new(
60
+ "page_token",
61
+ "next_page_token",
62
+ "deidentify_templates"),
63
+ "list_dlp_jobs" => Google::Gax::PageDescriptor.new(
64
+ "page_token",
65
+ "next_page_token",
66
+ "jobs"),
67
+ "list_job_triggers" => Google::Gax::PageDescriptor.new(
68
+ "page_token",
69
+ "next_page_token",
70
+ "job_triggers")
71
+ }.freeze
72
+
73
+ private_constant :PAGE_DESCRIPTORS
74
+
75
+ # The scopes needed to make gRPC calls to all of the methods defined in
76
+ # this service.
77
+ ALL_SCOPES = [
78
+ "https://www.googleapis.com/auth/cloud-platform"
79
+ ].freeze
80
+
81
+
82
+ ORGANIZATION_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
83
+ "organizations/{organization}"
84
+ )
85
+
86
+ private_constant :ORGANIZATION_PATH_TEMPLATE
87
+
88
+ ORGANIZATION_DEIDENTIFY_TEMPLATE_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
89
+ "organizations/{organization}/deidentifyTemplates/{deidentify_template}"
90
+ )
91
+
92
+ private_constant :ORGANIZATION_DEIDENTIFY_TEMPLATE_PATH_TEMPLATE
93
+
94
+ PROJECT_DEIDENTIFY_TEMPLATE_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
95
+ "projects/{project}/deidentifyTemplates/{deidentify_template}"
96
+ )
97
+
98
+ private_constant :PROJECT_DEIDENTIFY_TEMPLATE_PATH_TEMPLATE
99
+
100
+ ORGANIZATION_INSPECT_TEMPLATE_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
101
+ "organizations/{organization}/inspectTemplates/{inspect_template}"
102
+ )
103
+
104
+ private_constant :ORGANIZATION_INSPECT_TEMPLATE_PATH_TEMPLATE
105
+
106
+ PROJECT_INSPECT_TEMPLATE_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
107
+ "projects/{project}/inspectTemplates/{inspect_template}"
108
+ )
109
+
110
+ private_constant :PROJECT_INSPECT_TEMPLATE_PATH_TEMPLATE
111
+
112
+ PROJECT_JOB_TRIGGER_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
113
+ "projects/{project}/jobTriggers/{job_trigger}"
114
+ )
115
+
116
+ private_constant :PROJECT_JOB_TRIGGER_PATH_TEMPLATE
117
+
118
+ PROJECT_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
119
+ "projects/{project}"
120
+ )
121
+
122
+ private_constant :PROJECT_PATH_TEMPLATE
123
+
124
+ DLP_JOB_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
125
+ "projects/{project}/dlpJobs/{dlp_job}"
126
+ )
127
+
128
+ private_constant :DLP_JOB_PATH_TEMPLATE
129
+
130
+ # Returns a fully-qualified organization resource name string.
131
+ # @param organization [String]
132
+ # @return [String]
133
+ def self.organization_path organization
134
+ ORGANIZATION_PATH_TEMPLATE.render(
135
+ :"organization" => organization
136
+ )
137
+ end
138
+
139
+ # Returns a fully-qualified organization_deidentify_template resource name string.
140
+ # @param organization [String]
141
+ # @param deidentify_template [String]
142
+ # @return [String]
143
+ def self.organization_deidentify_template_path organization, deidentify_template
144
+ ORGANIZATION_DEIDENTIFY_TEMPLATE_PATH_TEMPLATE.render(
145
+ :"organization" => organization,
146
+ :"deidentify_template" => deidentify_template
147
+ )
148
+ end
149
+
150
+ # Returns a fully-qualified project_deidentify_template resource name string.
151
+ # @param project [String]
152
+ # @param deidentify_template [String]
153
+ # @return [String]
154
+ def self.project_deidentify_template_path project, deidentify_template
155
+ PROJECT_DEIDENTIFY_TEMPLATE_PATH_TEMPLATE.render(
156
+ :"project" => project,
157
+ :"deidentify_template" => deidentify_template
158
+ )
159
+ end
160
+
161
+ # Returns a fully-qualified organization_inspect_template resource name string.
162
+ # @param organization [String]
163
+ # @param inspect_template [String]
164
+ # @return [String]
165
+ def self.organization_inspect_template_path organization, inspect_template
166
+ ORGANIZATION_INSPECT_TEMPLATE_PATH_TEMPLATE.render(
167
+ :"organization" => organization,
168
+ :"inspect_template" => inspect_template
169
+ )
170
+ end
171
+
172
+ # Returns a fully-qualified project_inspect_template resource name string.
173
+ # @param project [String]
174
+ # @param inspect_template [String]
175
+ # @return [String]
176
+ def self.project_inspect_template_path project, inspect_template
177
+ PROJECT_INSPECT_TEMPLATE_PATH_TEMPLATE.render(
178
+ :"project" => project,
179
+ :"inspect_template" => inspect_template
180
+ )
181
+ end
182
+
183
+ # Returns a fully-qualified project_job_trigger resource name string.
184
+ # @param project [String]
185
+ # @param job_trigger [String]
186
+ # @return [String]
187
+ def self.project_job_trigger_path project, job_trigger
188
+ PROJECT_JOB_TRIGGER_PATH_TEMPLATE.render(
189
+ :"project" => project,
190
+ :"job_trigger" => job_trigger
191
+ )
192
+ end
193
+
194
+ # Returns a fully-qualified project resource name string.
195
+ # @param project [String]
196
+ # @return [String]
197
+ def self.project_path project
198
+ PROJECT_PATH_TEMPLATE.render(
199
+ :"project" => project
200
+ )
201
+ end
202
+
203
+ # Returns a fully-qualified dlp_job resource name string.
204
+ # @param project [String]
205
+ # @param dlp_job [String]
206
+ # @return [String]
207
+ def self.dlp_job_path project, dlp_job
208
+ DLP_JOB_PATH_TEMPLATE.render(
209
+ :"project" => project,
210
+ :"dlp_job" => dlp_job
211
+ )
212
+ end
213
+
214
+ # @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
215
+ # Provides the means for authenticating requests made by the client. This parameter can
216
+ # be many types.
217
+ # A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
218
+ # authenticating requests made by this client.
219
+ # A `String` will be treated as the path to the keyfile to be used for the construction of
220
+ # credentials for this client.
221
+ # A `Hash` will be treated as the contents of a keyfile to be used for the construction of
222
+ # credentials for this client.
223
+ # A `GRPC::Core::Channel` will be used to make calls through.
224
+ # A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
225
+ # should already be composed with a `GRPC::Core::CallCredentials` object.
226
+ # A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
227
+ # metadata for requests, generally, to give OAuth credentials.
228
+ # @param scopes [Array<String>]
229
+ # The OAuth scopes for this service. This parameter is ignored if
230
+ # an updater_proc is supplied.
231
+ # @param client_config [Hash]
232
+ # A Hash for call options for each method. See
233
+ # Google::Gax#construct_settings for the structure of
234
+ # this data. Falls back to the default config if not specified
235
+ # or the specified config is missing data points.
236
+ # @param timeout [Numeric]
237
+ # The default timeout, in seconds, for calls made through this client.
238
+ def initialize \
239
+ credentials: nil,
240
+ scopes: ALL_SCOPES,
241
+ client_config: {},
242
+ timeout: DEFAULT_TIMEOUT,
243
+ lib_name: nil,
244
+ lib_version: ""
245
+ # These require statements are intentionally placed here to initialize
246
+ # the gRPC module only when it's required.
247
+ # See https://github.com/googleapis/toolkit/issues/446
248
+ require "google/gax/grpc"
249
+ require "google/privacy/dlp/v2/dlp_services_pb"
250
+
251
+ credentials ||= Google::Cloud::Dlp::Credentials.default
252
+
253
+ if credentials.is_a?(String) || credentials.is_a?(Hash)
254
+ updater_proc = Google::Cloud::Dlp::Credentials.new(credentials).updater_proc
255
+ end
256
+ if credentials.is_a?(GRPC::Core::Channel)
257
+ channel = credentials
258
+ end
259
+ if credentials.is_a?(GRPC::Core::ChannelCredentials)
260
+ chan_creds = credentials
261
+ end
262
+ if credentials.is_a?(Proc)
263
+ updater_proc = credentials
264
+ end
265
+ if credentials.is_a?(Google::Auth::Credentials)
266
+ updater_proc = credentials.updater_proc
267
+ end
268
+
269
+ package_version = Gem.loaded_specs['google-cloud-dlp'].version.version
270
+
271
+ google_api_client = "gl-ruby/#{RUBY_VERSION}"
272
+ google_api_client << " #{lib_name}/#{lib_version}" if lib_name
273
+ google_api_client << " gapic/#{package_version} gax/#{Google::Gax::VERSION}"
274
+ google_api_client << " grpc/#{GRPC::VERSION}"
275
+ google_api_client.freeze
276
+
277
+ headers = { :"x-goog-api-client" => google_api_client }
278
+ client_config_file = Pathname.new(__dir__).join(
279
+ "dlp_service_client_config.json"
280
+ )
281
+ defaults = client_config_file.open do |f|
282
+ Google::Gax.construct_settings(
283
+ "google.privacy.dlp.v2.DlpService",
284
+ JSON.parse(f.read),
285
+ client_config,
286
+ Google::Gax::Grpc::STATUS_CODE_NAMES,
287
+ timeout,
288
+ page_descriptors: PAGE_DESCRIPTORS,
289
+ errors: Google::Gax::Grpc::API_ERRORS,
290
+ kwargs: headers
291
+ )
292
+ end
293
+
294
+ # Allow overriding the service path/port in subclasses.
295
+ service_path = self.class::SERVICE_ADDRESS
296
+ port = self.class::DEFAULT_SERVICE_PORT
297
+ @dlp_service_stub = Google::Gax::Grpc.create_stub(
298
+ service_path,
299
+ port,
300
+ chan_creds: chan_creds,
301
+ channel: channel,
302
+ updater_proc: updater_proc,
303
+ scopes: scopes,
304
+ &Google::Privacy::Dlp::V2::DlpService::Stub.method(:new)
305
+ )
306
+
307
+ @inspect_content = Google::Gax.create_api_call(
308
+ @dlp_service_stub.method(:inspect_content),
309
+ defaults["inspect_content"]
310
+ )
311
+ @redact_image = Google::Gax.create_api_call(
312
+ @dlp_service_stub.method(:redact_image),
313
+ defaults["redact_image"]
314
+ )
315
+ @deidentify_content = Google::Gax.create_api_call(
316
+ @dlp_service_stub.method(:deidentify_content),
317
+ defaults["deidentify_content"]
318
+ )
319
+ @reidentify_content = Google::Gax.create_api_call(
320
+ @dlp_service_stub.method(:reidentify_content),
321
+ defaults["reidentify_content"]
322
+ )
323
+ @list_info_types = Google::Gax.create_api_call(
324
+ @dlp_service_stub.method(:list_info_types),
325
+ defaults["list_info_types"]
326
+ )
327
+ @create_inspect_template = Google::Gax.create_api_call(
328
+ @dlp_service_stub.method(:create_inspect_template),
329
+ defaults["create_inspect_template"]
330
+ )
331
+ @update_inspect_template = Google::Gax.create_api_call(
332
+ @dlp_service_stub.method(:update_inspect_template),
333
+ defaults["update_inspect_template"]
334
+ )
335
+ @get_inspect_template = Google::Gax.create_api_call(
336
+ @dlp_service_stub.method(:get_inspect_template),
337
+ defaults["get_inspect_template"]
338
+ )
339
+ @list_inspect_templates = Google::Gax.create_api_call(
340
+ @dlp_service_stub.method(:list_inspect_templates),
341
+ defaults["list_inspect_templates"]
342
+ )
343
+ @delete_inspect_template = Google::Gax.create_api_call(
344
+ @dlp_service_stub.method(:delete_inspect_template),
345
+ defaults["delete_inspect_template"]
346
+ )
347
+ @create_deidentify_template = Google::Gax.create_api_call(
348
+ @dlp_service_stub.method(:create_deidentify_template),
349
+ defaults["create_deidentify_template"]
350
+ )
351
+ @update_deidentify_template = Google::Gax.create_api_call(
352
+ @dlp_service_stub.method(:update_deidentify_template),
353
+ defaults["update_deidentify_template"]
354
+ )
355
+ @get_deidentify_template = Google::Gax.create_api_call(
356
+ @dlp_service_stub.method(:get_deidentify_template),
357
+ defaults["get_deidentify_template"]
358
+ )
359
+ @list_deidentify_templates = Google::Gax.create_api_call(
360
+ @dlp_service_stub.method(:list_deidentify_templates),
361
+ defaults["list_deidentify_templates"]
362
+ )
363
+ @delete_deidentify_template = Google::Gax.create_api_call(
364
+ @dlp_service_stub.method(:delete_deidentify_template),
365
+ defaults["delete_deidentify_template"]
366
+ )
367
+ @create_dlp_job = Google::Gax.create_api_call(
368
+ @dlp_service_stub.method(:create_dlp_job),
369
+ defaults["create_dlp_job"]
370
+ )
371
+ @list_dlp_jobs = Google::Gax.create_api_call(
372
+ @dlp_service_stub.method(:list_dlp_jobs),
373
+ defaults["list_dlp_jobs"]
374
+ )
375
+ @get_dlp_job = Google::Gax.create_api_call(
376
+ @dlp_service_stub.method(:get_dlp_job),
377
+ defaults["get_dlp_job"]
378
+ )
379
+ @delete_dlp_job = Google::Gax.create_api_call(
380
+ @dlp_service_stub.method(:delete_dlp_job),
381
+ defaults["delete_dlp_job"]
382
+ )
383
+ @cancel_dlp_job = Google::Gax.create_api_call(
384
+ @dlp_service_stub.method(:cancel_dlp_job),
385
+ defaults["cancel_dlp_job"]
386
+ )
387
+ @list_job_triggers = Google::Gax.create_api_call(
388
+ @dlp_service_stub.method(:list_job_triggers),
389
+ defaults["list_job_triggers"]
390
+ )
391
+ @get_job_trigger = Google::Gax.create_api_call(
392
+ @dlp_service_stub.method(:get_job_trigger),
393
+ defaults["get_job_trigger"]
394
+ )
395
+ @delete_job_trigger = Google::Gax.create_api_call(
396
+ @dlp_service_stub.method(:delete_job_trigger),
397
+ defaults["delete_job_trigger"]
398
+ )
399
+ @update_job_trigger = Google::Gax.create_api_call(
400
+ @dlp_service_stub.method(:update_job_trigger),
401
+ defaults["update_job_trigger"]
402
+ )
403
+ @create_job_trigger = Google::Gax.create_api_call(
404
+ @dlp_service_stub.method(:create_job_trigger),
405
+ defaults["create_job_trigger"]
406
+ )
407
+ end
408
+
409
+ # Service calls
410
+
411
+ # Finds potentially sensitive info in content.
412
+ # This method has limits on input size, processing time, and output size.
413
+ # [How-to guide for text](https://cloud.google.com/dlp/docs/inspecting-text), [How-to guide for
414
+ # images](/dlp/docs/inspecting-images)
415
+ #
416
+ # @param parent [String]
417
+ # The parent resource name, for example projects/my-project-id.
418
+ # @param inspect_config [Google::Privacy::Dlp::V2::InspectConfig | Hash]
419
+ # Configuration for the inspector. What specified here will override
420
+ # the template referenced by the inspect_template_name argument.
421
+ # A hash of the same form as `Google::Privacy::Dlp::V2::InspectConfig`
422
+ # can also be provided.
423
+ # @param item [Google::Privacy::Dlp::V2::ContentItem | Hash]
424
+ # The item to inspect.
425
+ # A hash of the same form as `Google::Privacy::Dlp::V2::ContentItem`
426
+ # can also be provided.
427
+ # @param inspect_template_name [String]
428
+ # Optional template to use. Any configuration directly specified in
429
+ # inspect_config will override those set in the template. Singular fields
430
+ # that are set in this request will replace their corresponding fields in the
431
+ # template. Repeated fields are appended. Singular sub-messages and groups
432
+ # are recursively merged.
433
+ # @param options [Google::Gax::CallOptions]
434
+ # Overrides the default settings for this call, e.g, timeout,
435
+ # retries, etc.
436
+ # @return [Google::Privacy::Dlp::V2::InspectContentResponse]
437
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
438
+ # @example
439
+ # require "google/cloud/dlp/v2"
440
+ #
441
+ # dlp_service_client = Google::Cloud::Dlp::V2.new
442
+ # formatted_parent = Google::Cloud::Dlp::V2::DlpServiceClient.project_path("[PROJECT]")
443
+ # response = dlp_service_client.inspect_content(formatted_parent)
444
+
445
+ def inspect_content \
446
+ parent,
447
+ inspect_config: nil,
448
+ item: nil,
449
+ inspect_template_name: nil,
450
+ options: nil
451
+ req = {
452
+ parent: parent,
453
+ inspect_config: inspect_config,
454
+ item: item,
455
+ inspect_template_name: inspect_template_name
456
+ }.delete_if { |_, v| v.nil? }
457
+ req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::InspectContentRequest)
458
+ @inspect_content.call(req, options)
459
+ end
460
+
461
+ # Redacts potentially sensitive info from an image.
462
+ # This method has limits on input size, processing time, and output size.
463
+ # [How-to guide](https://cloud.google.com/dlp/docs/redacting-sensitive-data-images)
464
+ #
465
+ # @param parent [String]
466
+ # The parent resource name, for example projects/my-project-id.
467
+ # @param inspect_config [Google::Privacy::Dlp::V2::InspectConfig | Hash]
468
+ # Configuration for the inspector.
469
+ # A hash of the same form as `Google::Privacy::Dlp::V2::InspectConfig`
470
+ # can also be provided.
471
+ # @param image_redaction_configs [Array<Google::Privacy::Dlp::V2::RedactImageRequest::ImageRedactionConfig | Hash>]
472
+ # The configuration for specifying what content to redact from images.
473
+ # A hash of the same form as `Google::Privacy::Dlp::V2::RedactImageRequest::ImageRedactionConfig`
474
+ # can also be provided.
475
+ # @param byte_item [Google::Privacy::Dlp::V2::ByteContentItem | Hash]
476
+ # The content must be PNG, JPEG, SVG or BMP.
477
+ # A hash of the same form as `Google::Privacy::Dlp::V2::ByteContentItem`
478
+ # can also be provided.
479
+ # @param options [Google::Gax::CallOptions]
480
+ # Overrides the default settings for this call, e.g, timeout,
481
+ # retries, etc.
482
+ # @return [Google::Privacy::Dlp::V2::RedactImageResponse]
483
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
484
+ # @example
485
+ # require "google/cloud/dlp/v2"
486
+ #
487
+ # dlp_service_client = Google::Cloud::Dlp::V2.new
488
+ # formatted_parent = Google::Cloud::Dlp::V2::DlpServiceClient.project_path("[PROJECT]")
489
+ # response = dlp_service_client.redact_image(formatted_parent)
490
+
491
+ def redact_image \
492
+ parent,
493
+ inspect_config: nil,
494
+ image_redaction_configs: nil,
495
+ byte_item: nil,
496
+ options: nil
497
+ req = {
498
+ parent: parent,
499
+ inspect_config: inspect_config,
500
+ image_redaction_configs: image_redaction_configs,
501
+ byte_item: byte_item
502
+ }.delete_if { |_, v| v.nil? }
503
+ req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::RedactImageRequest)
504
+ @redact_image.call(req, options)
505
+ end
506
+
507
+ # De-identifies potentially sensitive info from a ContentItem.
508
+ # This method has limits on input size and output size.
509
+ # [How-to guide](https://cloud.google.com/dlp/docs/deidentify-sensitive-data)
510
+ #
511
+ # @param parent [String]
512
+ # The parent resource name, for example projects/my-project-id.
513
+ # @param deidentify_config [Google::Privacy::Dlp::V2::DeidentifyConfig | Hash]
514
+ # Configuration for the de-identification of the content item.
515
+ # Items specified here will override the template referenced by the
516
+ # deidentify_template_name argument.
517
+ # A hash of the same form as `Google::Privacy::Dlp::V2::DeidentifyConfig`
518
+ # can also be provided.
519
+ # @param inspect_config [Google::Privacy::Dlp::V2::InspectConfig | Hash]
520
+ # Configuration for the inspector.
521
+ # Items specified here will override the template referenced by the
522
+ # inspect_template_name argument.
523
+ # A hash of the same form as `Google::Privacy::Dlp::V2::InspectConfig`
524
+ # can also be provided.
525
+ # @param item [Google::Privacy::Dlp::V2::ContentItem | Hash]
526
+ # The item to de-identify. Will be treated as text.
527
+ # A hash of the same form as `Google::Privacy::Dlp::V2::ContentItem`
528
+ # can also be provided.
529
+ # @param inspect_template_name [String]
530
+ # Optional template to use. Any configuration directly specified in
531
+ # inspect_config will override those set in the template. Singular fields
532
+ # that are set in this request will replace their corresponding fields in the
533
+ # template. Repeated fields are appended. Singular sub-messages and groups
534
+ # are recursively merged.
535
+ # @param deidentify_template_name [String]
536
+ # Optional template to use. Any configuration directly specified in
537
+ # deidentify_config will override those set in the template. Singular fields
538
+ # that are set in this request will replace their corresponding fields in the
539
+ # template. Repeated fields are appended. Singular sub-messages and groups
540
+ # are recursively merged.
541
+ # @param options [Google::Gax::CallOptions]
542
+ # Overrides the default settings for this call, e.g, timeout,
543
+ # retries, etc.
544
+ # @return [Google::Privacy::Dlp::V2::DeidentifyContentResponse]
545
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
546
+ # @example
547
+ # require "google/cloud/dlp/v2"
548
+ #
549
+ # dlp_service_client = Google::Cloud::Dlp::V2.new
550
+ # formatted_parent = Google::Cloud::Dlp::V2::DlpServiceClient.project_path("[PROJECT]")
551
+ # response = dlp_service_client.deidentify_content(formatted_parent)
552
+
553
+ def deidentify_content \
554
+ parent,
555
+ deidentify_config: nil,
556
+ inspect_config: nil,
557
+ item: nil,
558
+ inspect_template_name: nil,
559
+ deidentify_template_name: nil,
560
+ options: nil
561
+ req = {
562
+ parent: parent,
563
+ deidentify_config: deidentify_config,
564
+ inspect_config: inspect_config,
565
+ item: item,
566
+ inspect_template_name: inspect_template_name,
567
+ deidentify_template_name: deidentify_template_name
568
+ }.delete_if { |_, v| v.nil? }
569
+ req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::DeidentifyContentRequest)
570
+ @deidentify_content.call(req, options)
571
+ end
572
+
573
+ # Re-identify content that has been de-identified.
574
+ #
575
+ # @param parent [String]
576
+ # The parent resource name.
577
+ # @param reidentify_config [Google::Privacy::Dlp::V2::DeidentifyConfig | Hash]
578
+ # Configuration for the re-identification of the content item.
579
+ # This field shares the same proto message type that is used for
580
+ # de-identification, however its usage here is for the reversal of the
581
+ # previous de-identification. Re-identification is performed by examining
582
+ # the transformations used to de-identify the items and executing the
583
+ # reverse. This requires that only reversible transformations
584
+ # be provided here. The reversible transformations are:
585
+ #
586
+ # * +CryptoReplaceFfxFpeConfig+
587
+ # A hash of the same form as `Google::Privacy::Dlp::V2::DeidentifyConfig`
588
+ # can also be provided.
589
+ # @param inspect_config [Google::Privacy::Dlp::V2::InspectConfig | Hash]
590
+ # Configuration for the inspector.
591
+ # A hash of the same form as `Google::Privacy::Dlp::V2::InspectConfig`
592
+ # can also be provided.
593
+ # @param item [Google::Privacy::Dlp::V2::ContentItem | Hash]
594
+ # The item to re-identify. Will be treated as text.
595
+ # A hash of the same form as `Google::Privacy::Dlp::V2::ContentItem`
596
+ # can also be provided.
597
+ # @param inspect_template_name [String]
598
+ # Optional template to use. Any configuration directly specified in
599
+ # +inspect_config+ will override those set in the template. Singular fields
600
+ # that are set in this request will replace their corresponding fields in the
601
+ # template. Repeated fields are appended. Singular sub-messages and groups
602
+ # are recursively merged.
603
+ # @param reidentify_template_name [String]
604
+ # Optional template to use. References an instance of +DeidentifyTemplate+.
605
+ # Any configuration directly specified in +reidentify_config+ or
606
+ # +inspect_config+ will override those set in the template. Singular fields
607
+ # that are set in this request will replace their corresponding fields in the
608
+ # template. Repeated fields are appended. Singular sub-messages and groups
609
+ # are recursively merged.
610
+ # @param options [Google::Gax::CallOptions]
611
+ # Overrides the default settings for this call, e.g, timeout,
612
+ # retries, etc.
613
+ # @return [Google::Privacy::Dlp::V2::ReidentifyContentResponse]
614
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
615
+ # @example
616
+ # require "google/cloud/dlp/v2"
617
+ #
618
+ # dlp_service_client = Google::Cloud::Dlp::V2.new
619
+ # formatted_parent = Google::Cloud::Dlp::V2::DlpServiceClient.project_path("[PROJECT]")
620
+ # response = dlp_service_client.reidentify_content(formatted_parent)
621
+
622
+ def reidentify_content \
623
+ parent,
624
+ reidentify_config: nil,
625
+ inspect_config: nil,
626
+ item: nil,
627
+ inspect_template_name: nil,
628
+ reidentify_template_name: nil,
629
+ options: nil
630
+ req = {
631
+ parent: parent,
632
+ reidentify_config: reidentify_config,
633
+ inspect_config: inspect_config,
634
+ item: item,
635
+ inspect_template_name: inspect_template_name,
636
+ reidentify_template_name: reidentify_template_name
637
+ }.delete_if { |_, v| v.nil? }
638
+ req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::ReidentifyContentRequest)
639
+ @reidentify_content.call(req, options)
640
+ end
641
+
642
+ # Returns sensitive information types DLP supports.
643
+ #
644
+ # @param language_code [String]
645
+ # Optional BCP-47 language code for localized infoType friendly
646
+ # names. If omitted, or if localized strings are not available,
647
+ # en-US strings will be returned.
648
+ # @param filter [String]
649
+ # Optional filter to only return infoTypes supported by certain parts of the
650
+ # API. Defaults to supported_by=INSPECT.
651
+ # @param options [Google::Gax::CallOptions]
652
+ # Overrides the default settings for this call, e.g, timeout,
653
+ # retries, etc.
654
+ # @return [Google::Privacy::Dlp::V2::ListInfoTypesResponse]
655
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
656
+ # @example
657
+ # require "google/cloud/dlp/v2"
658
+ #
659
+ # dlp_service_client = Google::Cloud::Dlp::V2.new
660
+ # response = dlp_service_client.list_info_types
661
+
662
+ def list_info_types \
663
+ language_code: nil,
664
+ filter: nil,
665
+ options: nil
666
+ req = {
667
+ language_code: language_code,
668
+ filter: filter
669
+ }.delete_if { |_, v| v.nil? }
670
+ req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::ListInfoTypesRequest)
671
+ @list_info_types.call(req, options)
672
+ end
673
+
674
+ # Creates an inspect template for re-using frequently used configuration
675
+ # for inspecting content, images, and storage.
676
+ #
677
+ # @param parent [String]
678
+ # The parent resource name, for example projects/my-project-id or
679
+ # organizations/my-org-id.
680
+ # @param inspect_template [Google::Privacy::Dlp::V2::InspectTemplate | Hash]
681
+ # The InspectTemplate to create.
682
+ # A hash of the same form as `Google::Privacy::Dlp::V2::InspectTemplate`
683
+ # can also be provided.
684
+ # @param template_id [String]
685
+ # The template id can contain uppercase and lowercase letters,
686
+ # numbers, and hyphens; that is, it must match the regular
687
+ # expression: +[a-zA-Z\\d-]++. The maximum length is 100
688
+ # characters. Can be empty to allow the system to generate one.
689
+ # @param options [Google::Gax::CallOptions]
690
+ # Overrides the default settings for this call, e.g, timeout,
691
+ # retries, etc.
692
+ # @return [Google::Privacy::Dlp::V2::InspectTemplate]
693
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
694
+ # @example
695
+ # require "google/cloud/dlp/v2"
696
+ #
697
+ # dlp_service_client = Google::Cloud::Dlp::V2.new
698
+ # formatted_parent = Google::Cloud::Dlp::V2::DlpServiceClient.organization_path("[ORGANIZATION]")
699
+ # response = dlp_service_client.create_inspect_template(formatted_parent)
700
+
701
+ def create_inspect_template \
702
+ parent,
703
+ inspect_template: nil,
704
+ template_id: nil,
705
+ options: nil
706
+ req = {
707
+ parent: parent,
708
+ inspect_template: inspect_template,
709
+ template_id: template_id
710
+ }.delete_if { |_, v| v.nil? }
711
+ req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::CreateInspectTemplateRequest)
712
+ @create_inspect_template.call(req, options)
713
+ end
714
+
715
+ # Updates the inspect template.
716
+ #
717
+ # @param name [String]
718
+ # Resource name of organization and inspectTemplate to be updated, for
719
+ # example +organizations/433245324/inspectTemplates/432452342+ or
720
+ # projects/project-id/inspectTemplates/432452342.
721
+ # @param inspect_template [Google::Privacy::Dlp::V2::InspectTemplate | Hash]
722
+ # New InspectTemplate value.
723
+ # A hash of the same form as `Google::Privacy::Dlp::V2::InspectTemplate`
724
+ # can also be provided.
725
+ # @param update_mask [Google::Protobuf::FieldMask | Hash]
726
+ # Mask to control which fields get updated.
727
+ # A hash of the same form as `Google::Protobuf::FieldMask`
728
+ # can also be provided.
729
+ # @param options [Google::Gax::CallOptions]
730
+ # Overrides the default settings for this call, e.g, timeout,
731
+ # retries, etc.
732
+ # @return [Google::Privacy::Dlp::V2::InspectTemplate]
733
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
734
+ # @example
735
+ # require "google/cloud/dlp/v2"
736
+ #
737
+ # dlp_service_client = Google::Cloud::Dlp::V2.new
738
+ # formatted_name = Google::Cloud::Dlp::V2::DlpServiceClient.organization_inspect_template_path("[ORGANIZATION]", "[INSPECT_TEMPLATE]")
739
+ # response = dlp_service_client.update_inspect_template(formatted_name)
740
+
741
+ def update_inspect_template \
742
+ name,
743
+ inspect_template: nil,
744
+ update_mask: nil,
745
+ options: nil
746
+ req = {
747
+ name: name,
748
+ inspect_template: inspect_template,
749
+ update_mask: update_mask
750
+ }.delete_if { |_, v| v.nil? }
751
+ req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::UpdateInspectTemplateRequest)
752
+ @update_inspect_template.call(req, options)
753
+ end
754
+
755
+ # Gets an inspect template.
756
+ #
757
+ # @param name [String]
758
+ # Resource name of the organization and inspectTemplate to be read, for
759
+ # example +organizations/433245324/inspectTemplates/432452342+ or
760
+ # projects/project-id/inspectTemplates/432452342.
761
+ # @param options [Google::Gax::CallOptions]
762
+ # Overrides the default settings for this call, e.g, timeout,
763
+ # retries, etc.
764
+ # @return [Google::Privacy::Dlp::V2::InspectTemplate]
765
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
766
+ # @example
767
+ # require "google/cloud/dlp/v2"
768
+ #
769
+ # dlp_service_client = Google::Cloud::Dlp::V2.new
770
+ # response = dlp_service_client.get_inspect_template
771
+
772
+ def get_inspect_template \
773
+ name: nil,
774
+ options: nil
775
+ req = {
776
+ name: name
777
+ }.delete_if { |_, v| v.nil? }
778
+ req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::GetInspectTemplateRequest)
779
+ @get_inspect_template.call(req, options)
780
+ end
781
+
782
+ # Lists inspect templates.
783
+ #
784
+ # @param parent [String]
785
+ # The parent resource name, for example projects/my-project-id or
786
+ # organizations/my-org-id.
787
+ # @param page_size [Integer]
788
+ # The maximum number of resources contained in the underlying API
789
+ # response. If page streaming is performed per-resource, this
790
+ # parameter does not affect the return value. If page streaming is
791
+ # performed per-page, this determines the maximum number of
792
+ # resources in a page.
793
+ # @param options [Google::Gax::CallOptions]
794
+ # Overrides the default settings for this call, e.g, timeout,
795
+ # retries, etc.
796
+ # @return [Google::Gax::PagedEnumerable<Google::Privacy::Dlp::V2::InspectTemplate>]
797
+ # An enumerable of Google::Privacy::Dlp::V2::InspectTemplate instances.
798
+ # See Google::Gax::PagedEnumerable documentation for other
799
+ # operations such as per-page iteration or access to the response
800
+ # object.
801
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
802
+ # @example
803
+ # require "google/cloud/dlp/v2"
804
+ #
805
+ # dlp_service_client = Google::Cloud::Dlp::V2.new
806
+ # formatted_parent = Google::Cloud::Dlp::V2::DlpServiceClient.organization_path("[ORGANIZATION]")
807
+ #
808
+ # # Iterate over all results.
809
+ # dlp_service_client.list_inspect_templates(formatted_parent).each do |element|
810
+ # # Process element.
811
+ # end
812
+ #
813
+ # # Or iterate over results one page at a time.
814
+ # dlp_service_client.list_inspect_templates(formatted_parent).each_page do |page|
815
+ # # Process each page at a time.
816
+ # page.each do |element|
817
+ # # Process element.
818
+ # end
819
+ # end
820
+
821
+ def list_inspect_templates \
822
+ parent,
823
+ page_size: nil,
824
+ options: nil
825
+ req = {
826
+ parent: parent,
827
+ page_size: page_size
828
+ }.delete_if { |_, v| v.nil? }
829
+ req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::ListInspectTemplatesRequest)
830
+ @list_inspect_templates.call(req, options)
831
+ end
832
+
833
+ # Deletes inspect templates.
834
+ #
835
+ # @param name [String]
836
+ # Resource name of the organization and inspectTemplate to be deleted, for
837
+ # example +organizations/433245324/inspectTemplates/432452342+ or
838
+ # projects/project-id/inspectTemplates/432452342.
839
+ # @param options [Google::Gax::CallOptions]
840
+ # Overrides the default settings for this call, e.g, timeout,
841
+ # retries, etc.
842
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
843
+ # @example
844
+ # require "google/cloud/dlp/v2"
845
+ #
846
+ # dlp_service_client = Google::Cloud::Dlp::V2.new
847
+ # formatted_name = Google::Cloud::Dlp::V2::DlpServiceClient.organization_inspect_template_path("[ORGANIZATION]", "[INSPECT_TEMPLATE]")
848
+ # dlp_service_client.delete_inspect_template(formatted_name)
849
+
850
+ def delete_inspect_template \
851
+ name,
852
+ options: nil
853
+ req = {
854
+ name: name
855
+ }.delete_if { |_, v| v.nil? }
856
+ req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::DeleteInspectTemplateRequest)
857
+ @delete_inspect_template.call(req, options)
858
+ nil
859
+ end
860
+
861
+ # Creates an Deidentify template for re-using frequently used configuration
862
+ # for Deidentifying content, images, and storage.
863
+ #
864
+ # @param parent [String]
865
+ # The parent resource name, for example projects/my-project-id or
866
+ # organizations/my-org-id.
867
+ # @param deidentify_template [Google::Privacy::Dlp::V2::DeidentifyTemplate | Hash]
868
+ # The DeidentifyTemplate to create.
869
+ # A hash of the same form as `Google::Privacy::Dlp::V2::DeidentifyTemplate`
870
+ # can also be provided.
871
+ # @param template_id [String]
872
+ # The template id can contain uppercase and lowercase letters,
873
+ # numbers, and hyphens; that is, it must match the regular
874
+ # expression: +[a-zA-Z\\d-]++. The maximum length is 100
875
+ # characters. Can be empty to allow the system to generate one.
876
+ # @param options [Google::Gax::CallOptions]
877
+ # Overrides the default settings for this call, e.g, timeout,
878
+ # retries, etc.
879
+ # @return [Google::Privacy::Dlp::V2::DeidentifyTemplate]
880
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
881
+ # @example
882
+ # require "google/cloud/dlp/v2"
883
+ #
884
+ # dlp_service_client = Google::Cloud::Dlp::V2.new
885
+ # formatted_parent = Google::Cloud::Dlp::V2::DlpServiceClient.organization_path("[ORGANIZATION]")
886
+ # response = dlp_service_client.create_deidentify_template(formatted_parent)
887
+
888
+ def create_deidentify_template \
889
+ parent,
890
+ deidentify_template: nil,
891
+ template_id: nil,
892
+ options: nil
893
+ req = {
894
+ parent: parent,
895
+ deidentify_template: deidentify_template,
896
+ template_id: template_id
897
+ }.delete_if { |_, v| v.nil? }
898
+ req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::CreateDeidentifyTemplateRequest)
899
+ @create_deidentify_template.call(req, options)
900
+ end
901
+
902
+ # Updates the inspect template.
903
+ #
904
+ # @param name [String]
905
+ # Resource name of organization and deidentify template to be updated, for
906
+ # example +organizations/433245324/deidentifyTemplates/432452342+ or
907
+ # projects/project-id/deidentifyTemplates/432452342.
908
+ # @param deidentify_template [Google::Privacy::Dlp::V2::DeidentifyTemplate | Hash]
909
+ # New DeidentifyTemplate value.
910
+ # A hash of the same form as `Google::Privacy::Dlp::V2::DeidentifyTemplate`
911
+ # can also be provided.
912
+ # @param update_mask [Google::Protobuf::FieldMask | Hash]
913
+ # Mask to control which fields get updated.
914
+ # A hash of the same form as `Google::Protobuf::FieldMask`
915
+ # can also be provided.
916
+ # @param options [Google::Gax::CallOptions]
917
+ # Overrides the default settings for this call, e.g, timeout,
918
+ # retries, etc.
919
+ # @return [Google::Privacy::Dlp::V2::DeidentifyTemplate]
920
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
921
+ # @example
922
+ # require "google/cloud/dlp/v2"
923
+ #
924
+ # dlp_service_client = Google::Cloud::Dlp::V2.new
925
+ # formatted_name = Google::Cloud::Dlp::V2::DlpServiceClient.organization_deidentify_template_path("[ORGANIZATION]", "[DEIDENTIFY_TEMPLATE]")
926
+ # response = dlp_service_client.update_deidentify_template(formatted_name)
927
+
928
+ def update_deidentify_template \
929
+ name,
930
+ deidentify_template: nil,
931
+ update_mask: nil,
932
+ options: nil
933
+ req = {
934
+ name: name,
935
+ deidentify_template: deidentify_template,
936
+ update_mask: update_mask
937
+ }.delete_if { |_, v| v.nil? }
938
+ req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::UpdateDeidentifyTemplateRequest)
939
+ @update_deidentify_template.call(req, options)
940
+ end
941
+
942
+ # Gets an inspect template.
943
+ #
944
+ # @param name [String]
945
+ # Resource name of the organization and deidentify template to be read, for
946
+ # example +organizations/433245324/deidentifyTemplates/432452342+ or
947
+ # projects/project-id/deidentifyTemplates/432452342.
948
+ # @param options [Google::Gax::CallOptions]
949
+ # Overrides the default settings for this call, e.g, timeout,
950
+ # retries, etc.
951
+ # @return [Google::Privacy::Dlp::V2::DeidentifyTemplate]
952
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
953
+ # @example
954
+ # require "google/cloud/dlp/v2"
955
+ #
956
+ # dlp_service_client = Google::Cloud::Dlp::V2.new
957
+ # formatted_name = Google::Cloud::Dlp::V2::DlpServiceClient.organization_deidentify_template_path("[ORGANIZATION]", "[DEIDENTIFY_TEMPLATE]")
958
+ # response = dlp_service_client.get_deidentify_template(formatted_name)
959
+
960
+ def get_deidentify_template \
961
+ name,
962
+ options: nil
963
+ req = {
964
+ name: name
965
+ }.delete_if { |_, v| v.nil? }
966
+ req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::GetDeidentifyTemplateRequest)
967
+ @get_deidentify_template.call(req, options)
968
+ end
969
+
970
+ # Lists inspect templates.
971
+ #
972
+ # @param parent [String]
973
+ # The parent resource name, for example projects/my-project-id or
974
+ # organizations/my-org-id.
975
+ # @param page_size [Integer]
976
+ # The maximum number of resources contained in the underlying API
977
+ # response. If page streaming is performed per-resource, this
978
+ # parameter does not affect the return value. If page streaming is
979
+ # performed per-page, this determines the maximum number of
980
+ # resources in a page.
981
+ # @param options [Google::Gax::CallOptions]
982
+ # Overrides the default settings for this call, e.g, timeout,
983
+ # retries, etc.
984
+ # @return [Google::Gax::PagedEnumerable<Google::Privacy::Dlp::V2::DeidentifyTemplate>]
985
+ # An enumerable of Google::Privacy::Dlp::V2::DeidentifyTemplate instances.
986
+ # See Google::Gax::PagedEnumerable documentation for other
987
+ # operations such as per-page iteration or access to the response
988
+ # object.
989
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
990
+ # @example
991
+ # require "google/cloud/dlp/v2"
992
+ #
993
+ # dlp_service_client = Google::Cloud::Dlp::V2.new
994
+ # formatted_parent = Google::Cloud::Dlp::V2::DlpServiceClient.organization_path("[ORGANIZATION]")
995
+ #
996
+ # # Iterate over all results.
997
+ # dlp_service_client.list_deidentify_templates(formatted_parent).each do |element|
998
+ # # Process element.
999
+ # end
1000
+ #
1001
+ # # Or iterate over results one page at a time.
1002
+ # dlp_service_client.list_deidentify_templates(formatted_parent).each_page do |page|
1003
+ # # Process each page at a time.
1004
+ # page.each do |element|
1005
+ # # Process element.
1006
+ # end
1007
+ # end
1008
+
1009
+ def list_deidentify_templates \
1010
+ parent,
1011
+ page_size: nil,
1012
+ options: nil
1013
+ req = {
1014
+ parent: parent,
1015
+ page_size: page_size
1016
+ }.delete_if { |_, v| v.nil? }
1017
+ req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::ListDeidentifyTemplatesRequest)
1018
+ @list_deidentify_templates.call(req, options)
1019
+ end
1020
+
1021
+ # Deletes inspect templates.
1022
+ #
1023
+ # @param name [String]
1024
+ # Resource name of the organization and deidentify template to be deleted,
1025
+ # for example +organizations/433245324/deidentifyTemplates/432452342+ or
1026
+ # projects/project-id/deidentifyTemplates/432452342.
1027
+ # @param options [Google::Gax::CallOptions]
1028
+ # Overrides the default settings for this call, e.g, timeout,
1029
+ # retries, etc.
1030
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
1031
+ # @example
1032
+ # require "google/cloud/dlp/v2"
1033
+ #
1034
+ # dlp_service_client = Google::Cloud::Dlp::V2.new
1035
+ # formatted_name = Google::Cloud::Dlp::V2::DlpServiceClient.organization_deidentify_template_path("[ORGANIZATION]", "[DEIDENTIFY_TEMPLATE]")
1036
+ # dlp_service_client.delete_deidentify_template(formatted_name)
1037
+
1038
+ def delete_deidentify_template \
1039
+ name,
1040
+ options: nil
1041
+ req = {
1042
+ name: name
1043
+ }.delete_if { |_, v| v.nil? }
1044
+ req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::DeleteDeidentifyTemplateRequest)
1045
+ @delete_deidentify_template.call(req, options)
1046
+ nil
1047
+ end
1048
+
1049
+ # Create a new job to inspect storage or calculate risk metrics [How-to
1050
+ # guide](/dlp/docs/compute-risk-analysis).
1051
+ #
1052
+ # @param parent [String]
1053
+ # The parent resource name, for example projects/my-project-id.
1054
+ # @param inspect_job [Google::Privacy::Dlp::V2::InspectJobConfig | Hash]
1055
+ # A hash of the same form as `Google::Privacy::Dlp::V2::InspectJobConfig`
1056
+ # can also be provided.
1057
+ # @param risk_job [Google::Privacy::Dlp::V2::RiskAnalysisJobConfig | Hash]
1058
+ # A hash of the same form as `Google::Privacy::Dlp::V2::RiskAnalysisJobConfig`
1059
+ # can also be provided.
1060
+ # @param job_id [String]
1061
+ # The job id can contain uppercase and lowercase letters,
1062
+ # numbers, and hyphens; that is, it must match the regular
1063
+ # expression: +[a-zA-Z\\d-]++. The maximum length is 100
1064
+ # characters. Can be empty to allow the system to generate one.
1065
+ # @param options [Google::Gax::CallOptions]
1066
+ # Overrides the default settings for this call, e.g, timeout,
1067
+ # retries, etc.
1068
+ # @return [Google::Privacy::Dlp::V2::DlpJob]
1069
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
1070
+ # @example
1071
+ # require "google/cloud/dlp/v2"
1072
+ #
1073
+ # dlp_service_client = Google::Cloud::Dlp::V2.new
1074
+ # formatted_parent = Google::Cloud::Dlp::V2::DlpServiceClient.project_path("[PROJECT]")
1075
+ # response = dlp_service_client.create_dlp_job(formatted_parent)
1076
+
1077
+ def create_dlp_job \
1078
+ parent,
1079
+ inspect_job: nil,
1080
+ risk_job: nil,
1081
+ job_id: nil,
1082
+ options: nil
1083
+ req = {
1084
+ parent: parent,
1085
+ inspect_job: inspect_job,
1086
+ risk_job: risk_job,
1087
+ job_id: job_id
1088
+ }.delete_if { |_, v| v.nil? }
1089
+ req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::CreateDlpJobRequest)
1090
+ @create_dlp_job.call(req, options)
1091
+ end
1092
+
1093
+ # Lists DlpJobs that match the specified filter in the request.
1094
+ #
1095
+ # @param parent [String]
1096
+ # The parent resource name, for example projects/my-project-id.
1097
+ # @param filter [String]
1098
+ # Optional. Allows filtering.
1099
+ #
1100
+ # Supported syntax:
1101
+ #
1102
+ # * Filter expressions are made up of one or more restrictions.
1103
+ # * Restrictions can be combined by +AND+ or +OR+ logical operators. A
1104
+ # sequence of restrictions implicitly uses +AND+.
1105
+ # * A restriction has the form of +<field> <operator> <value>+.
1106
+ # * Supported fields/values for inspect jobs:
1107
+ # * +state+ - PENDING|RUNNING|CANCELED|FINISHED|FAILED
1108
+ # * +inspected_storage+ - DATASTORE|CLOUD_STORAGE|BIGQUERY
1109
+ # * +trigger_name+ - The resource name of the trigger that created job.
1110
+ # * Supported fields for risk analysis jobs:
1111
+ # * +state+ - RUNNING|CANCELED|FINISHED|FAILED
1112
+ # * The operator must be +=+ or +!=+.
1113
+ #
1114
+ # Examples:
1115
+ #
1116
+ # * inspected_storage = cloud_storage AND state = done
1117
+ # * inspected_storage = cloud_storage OR inspected_storage = bigquery
1118
+ # * inspected_storage = cloud_storage AND (state = done OR state = canceled)
1119
+ #
1120
+ # The length of this field should be no more than 500 characters.
1121
+ # @param page_size [Integer]
1122
+ # The maximum number of resources contained in the underlying API
1123
+ # response. If page streaming is performed per-resource, this
1124
+ # parameter does not affect the return value. If page streaming is
1125
+ # performed per-page, this determines the maximum number of
1126
+ # resources in a page.
1127
+ # @param type [Google::Privacy::Dlp::V2::DlpJobType]
1128
+ # The type of job. Defaults to +DlpJobType.INSPECT+
1129
+ # @param options [Google::Gax::CallOptions]
1130
+ # Overrides the default settings for this call, e.g, timeout,
1131
+ # retries, etc.
1132
+ # @return [Google::Gax::PagedEnumerable<Google::Privacy::Dlp::V2::DlpJob>]
1133
+ # An enumerable of Google::Privacy::Dlp::V2::DlpJob instances.
1134
+ # See Google::Gax::PagedEnumerable documentation for other
1135
+ # operations such as per-page iteration or access to the response
1136
+ # object.
1137
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
1138
+ # @example
1139
+ # require "google/cloud/dlp/v2"
1140
+ #
1141
+ # dlp_service_client = Google::Cloud::Dlp::V2.new
1142
+ # formatted_parent = Google::Cloud::Dlp::V2::DlpServiceClient.project_path("[PROJECT]")
1143
+ #
1144
+ # # Iterate over all results.
1145
+ # dlp_service_client.list_dlp_jobs(formatted_parent).each do |element|
1146
+ # # Process element.
1147
+ # end
1148
+ #
1149
+ # # Or iterate over results one page at a time.
1150
+ # dlp_service_client.list_dlp_jobs(formatted_parent).each_page do |page|
1151
+ # # Process each page at a time.
1152
+ # page.each do |element|
1153
+ # # Process element.
1154
+ # end
1155
+ # end
1156
+
1157
+ def list_dlp_jobs \
1158
+ parent,
1159
+ filter: nil,
1160
+ page_size: nil,
1161
+ type: nil,
1162
+ options: nil
1163
+ req = {
1164
+ parent: parent,
1165
+ filter: filter,
1166
+ page_size: page_size,
1167
+ type: type
1168
+ }.delete_if { |_, v| v.nil? }
1169
+ req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::ListDlpJobsRequest)
1170
+ @list_dlp_jobs.call(req, options)
1171
+ end
1172
+
1173
+ # Gets the latest state of a long-running DlpJob.
1174
+ #
1175
+ # @param name [String]
1176
+ # The name of the DlpJob resource.
1177
+ # @param options [Google::Gax::CallOptions]
1178
+ # Overrides the default settings for this call, e.g, timeout,
1179
+ # retries, etc.
1180
+ # @return [Google::Privacy::Dlp::V2::DlpJob]
1181
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
1182
+ # @example
1183
+ # require "google/cloud/dlp/v2"
1184
+ #
1185
+ # dlp_service_client = Google::Cloud::Dlp::V2.new
1186
+ # formatted_name = Google::Cloud::Dlp::V2::DlpServiceClient.dlp_job_path("[PROJECT]", "[DLP_JOB]")
1187
+ # response = dlp_service_client.get_dlp_job(formatted_name)
1188
+
1189
+ def get_dlp_job \
1190
+ name,
1191
+ options: nil
1192
+ req = {
1193
+ name: name
1194
+ }.delete_if { |_, v| v.nil? }
1195
+ req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::GetDlpJobRequest)
1196
+ @get_dlp_job.call(req, options)
1197
+ end
1198
+
1199
+ # Deletes a long-running DlpJob. This method indicates that the client is
1200
+ # no longer interested in the DlpJob result. The job will be cancelled if
1201
+ # possible.
1202
+ #
1203
+ # @param name [String]
1204
+ # The name of the DlpJob resource to be deleted.
1205
+ # @param options [Google::Gax::CallOptions]
1206
+ # Overrides the default settings for this call, e.g, timeout,
1207
+ # retries, etc.
1208
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
1209
+ # @example
1210
+ # require "google/cloud/dlp/v2"
1211
+ #
1212
+ # dlp_service_client = Google::Cloud::Dlp::V2.new
1213
+ # formatted_name = Google::Cloud::Dlp::V2::DlpServiceClient.dlp_job_path("[PROJECT]", "[DLP_JOB]")
1214
+ # dlp_service_client.delete_dlp_job(formatted_name)
1215
+
1216
+ def delete_dlp_job \
1217
+ name,
1218
+ options: nil
1219
+ req = {
1220
+ name: name
1221
+ }.delete_if { |_, v| v.nil? }
1222
+ req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::DeleteDlpJobRequest)
1223
+ @delete_dlp_job.call(req, options)
1224
+ nil
1225
+ end
1226
+
1227
+ # Starts asynchronous cancellation on a long-running DlpJob. The server
1228
+ # makes a best effort to cancel the DlpJob, but success is not
1229
+ # guaranteed.
1230
+ #
1231
+ # @param name [String]
1232
+ # The name of the DlpJob resource to be cancelled.
1233
+ # @param options [Google::Gax::CallOptions]
1234
+ # Overrides the default settings for this call, e.g, timeout,
1235
+ # retries, etc.
1236
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
1237
+ # @example
1238
+ # require "google/cloud/dlp/v2"
1239
+ #
1240
+ # dlp_service_client = Google::Cloud::Dlp::V2.new
1241
+ # formatted_name = Google::Cloud::Dlp::V2::DlpServiceClient.dlp_job_path("[PROJECT]", "[DLP_JOB]")
1242
+ # dlp_service_client.cancel_dlp_job(formatted_name)
1243
+
1244
+ def cancel_dlp_job \
1245
+ name,
1246
+ options: nil
1247
+ req = {
1248
+ name: name
1249
+ }.delete_if { |_, v| v.nil? }
1250
+ req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::CancelDlpJobRequest)
1251
+ @cancel_dlp_job.call(req, options)
1252
+ nil
1253
+ end
1254
+
1255
+ # Lists job triggers.
1256
+ #
1257
+ # @param parent [String]
1258
+ # The parent resource name, for example projects/my-project-id.
1259
+ # @param page_size [Integer]
1260
+ # The maximum number of resources contained in the underlying API
1261
+ # response. If page streaming is performed per-resource, this
1262
+ # parameter does not affect the return value. If page streaming is
1263
+ # performed per-page, this determines the maximum number of
1264
+ # resources in a page.
1265
+ # @param order_by [String]
1266
+ # Optional comma separated list of triggeredJob fields to order by,
1267
+ # followed by 'asc/desc' postfix, i.e.
1268
+ # +"create_time asc,name desc,schedule_mode asc"+. This list is
1269
+ # case-insensitive.
1270
+ #
1271
+ # Example: +"name asc,schedule_mode desc, status desc"+
1272
+ #
1273
+ # Supported filters keys and values are:
1274
+ #
1275
+ # * +create_time+: corresponds to time the triggeredJob was created.
1276
+ # * +update_time+: corresponds to time the triggeredJob was last updated.
1277
+ # * +name+: corresponds to JobTrigger's display name.
1278
+ # * +status+: corresponds to the triggeredJob status.
1279
+ # @param options [Google::Gax::CallOptions]
1280
+ # Overrides the default settings for this call, e.g, timeout,
1281
+ # retries, etc.
1282
+ # @return [Google::Gax::PagedEnumerable<Google::Privacy::Dlp::V2::JobTrigger>]
1283
+ # An enumerable of Google::Privacy::Dlp::V2::JobTrigger instances.
1284
+ # See Google::Gax::PagedEnumerable documentation for other
1285
+ # operations such as per-page iteration or access to the response
1286
+ # object.
1287
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
1288
+ # @example
1289
+ # require "google/cloud/dlp/v2"
1290
+ #
1291
+ # dlp_service_client = Google::Cloud::Dlp::V2.new
1292
+ # formatted_parent = Google::Cloud::Dlp::V2::DlpServiceClient.project_path("[PROJECT]")
1293
+ #
1294
+ # # Iterate over all results.
1295
+ # dlp_service_client.list_job_triggers(formatted_parent).each do |element|
1296
+ # # Process element.
1297
+ # end
1298
+ #
1299
+ # # Or iterate over results one page at a time.
1300
+ # dlp_service_client.list_job_triggers(formatted_parent).each_page do |page|
1301
+ # # Process each page at a time.
1302
+ # page.each do |element|
1303
+ # # Process element.
1304
+ # end
1305
+ # end
1306
+
1307
+ def list_job_triggers \
1308
+ parent,
1309
+ page_size: nil,
1310
+ order_by: nil,
1311
+ options: nil
1312
+ req = {
1313
+ parent: parent,
1314
+ page_size: page_size,
1315
+ order_by: order_by
1316
+ }.delete_if { |_, v| v.nil? }
1317
+ req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::ListJobTriggersRequest)
1318
+ @list_job_triggers.call(req, options)
1319
+ end
1320
+
1321
+ # Gets a job trigger.
1322
+ #
1323
+ # @param name [String]
1324
+ # Resource name of the project and the triggeredJob, for example
1325
+ # +projects/dlp-test-project/jobTriggers/53234423+.
1326
+ # @param options [Google::Gax::CallOptions]
1327
+ # Overrides the default settings for this call, e.g, timeout,
1328
+ # retries, etc.
1329
+ # @return [Google::Privacy::Dlp::V2::JobTrigger]
1330
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
1331
+ # @example
1332
+ # require "google/cloud/dlp/v2"
1333
+ #
1334
+ # dlp_service_client = Google::Cloud::Dlp::V2.new
1335
+ # formatted_name = Google::Cloud::Dlp::V2::DlpServiceClient.project_job_trigger_path("[PROJECT]", "[JOB_TRIGGER]")
1336
+ # response = dlp_service_client.get_job_trigger(formatted_name)
1337
+
1338
+ def get_job_trigger \
1339
+ name,
1340
+ options: nil
1341
+ req = {
1342
+ name: name
1343
+ }.delete_if { |_, v| v.nil? }
1344
+ req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::GetJobTriggerRequest)
1345
+ @get_job_trigger.call(req, options)
1346
+ end
1347
+
1348
+ # Deletes a job trigger.
1349
+ #
1350
+ # @param name [String]
1351
+ # Resource name of the project and the triggeredJob, for example
1352
+ # +projects/dlp-test-project/jobTriggers/53234423+.
1353
+ # @param options [Google::Gax::CallOptions]
1354
+ # Overrides the default settings for this call, e.g, timeout,
1355
+ # retries, etc.
1356
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
1357
+ # @example
1358
+ # require "google/cloud/dlp/v2"
1359
+ #
1360
+ # dlp_service_client = Google::Cloud::Dlp::V2.new
1361
+ #
1362
+ # # TODO: Initialize +name+:
1363
+ # name = ''
1364
+ # dlp_service_client.delete_job_trigger(name)
1365
+
1366
+ def delete_job_trigger \
1367
+ name,
1368
+ options: nil
1369
+ req = {
1370
+ name: name
1371
+ }.delete_if { |_, v| v.nil? }
1372
+ req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::DeleteJobTriggerRequest)
1373
+ @delete_job_trigger.call(req, options)
1374
+ nil
1375
+ end
1376
+
1377
+ # Updates a job trigger.
1378
+ #
1379
+ # @param name [String]
1380
+ # Resource name of the project and the triggeredJob, for example
1381
+ # +projects/dlp-test-project/jobTriggers/53234423+.
1382
+ # @param job_trigger [Google::Privacy::Dlp::V2::JobTrigger | Hash]
1383
+ # New JobTrigger value.
1384
+ # A hash of the same form as `Google::Privacy::Dlp::V2::JobTrigger`
1385
+ # can also be provided.
1386
+ # @param update_mask [Google::Protobuf::FieldMask | Hash]
1387
+ # Mask to control which fields get updated.
1388
+ # A hash of the same form as `Google::Protobuf::FieldMask`
1389
+ # can also be provided.
1390
+ # @param options [Google::Gax::CallOptions]
1391
+ # Overrides the default settings for this call, e.g, timeout,
1392
+ # retries, etc.
1393
+ # @return [Google::Privacy::Dlp::V2::JobTrigger]
1394
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
1395
+ # @example
1396
+ # require "google/cloud/dlp/v2"
1397
+ #
1398
+ # dlp_service_client = Google::Cloud::Dlp::V2.new
1399
+ # formatted_name = Google::Cloud::Dlp::V2::DlpServiceClient.project_job_trigger_path("[PROJECT]", "[JOB_TRIGGER]")
1400
+ # response = dlp_service_client.update_job_trigger(formatted_name)
1401
+
1402
+ def update_job_trigger \
1403
+ name,
1404
+ job_trigger: nil,
1405
+ update_mask: nil,
1406
+ options: nil
1407
+ req = {
1408
+ name: name,
1409
+ job_trigger: job_trigger,
1410
+ update_mask: update_mask
1411
+ }.delete_if { |_, v| v.nil? }
1412
+ req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::UpdateJobTriggerRequest)
1413
+ @update_job_trigger.call(req, options)
1414
+ end
1415
+
1416
+ # Creates a job to run DLP actions such as scanning storage for sensitive
1417
+ # information on a set schedule.
1418
+ #
1419
+ # @param parent [String]
1420
+ # The parent resource name, for example projects/my-project-id.
1421
+ # @param job_trigger [Google::Privacy::Dlp::V2::JobTrigger | Hash]
1422
+ # The JobTrigger to create.
1423
+ # A hash of the same form as `Google::Privacy::Dlp::V2::JobTrigger`
1424
+ # can also be provided.
1425
+ # @param trigger_id [String]
1426
+ # The trigger id can contain uppercase and lowercase letters,
1427
+ # numbers, and hyphens; that is, it must match the regular
1428
+ # expression: +[a-zA-Z\\d-]++. The maximum length is 100
1429
+ # characters. Can be empty to allow the system to generate one.
1430
+ # @param options [Google::Gax::CallOptions]
1431
+ # Overrides the default settings for this call, e.g, timeout,
1432
+ # retries, etc.
1433
+ # @return [Google::Privacy::Dlp::V2::JobTrigger]
1434
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
1435
+ # @example
1436
+ # require "google/cloud/dlp/v2"
1437
+ #
1438
+ # dlp_service_client = Google::Cloud::Dlp::V2.new
1439
+ # formatted_parent = Google::Cloud::Dlp::V2::DlpServiceClient.project_path("[PROJECT]")
1440
+ # response = dlp_service_client.create_job_trigger(formatted_parent)
1441
+
1442
+ def create_job_trigger \
1443
+ parent,
1444
+ job_trigger: nil,
1445
+ trigger_id: nil,
1446
+ options: nil
1447
+ req = {
1448
+ parent: parent,
1449
+ job_trigger: job_trigger,
1450
+ trigger_id: trigger_id
1451
+ }.delete_if { |_, v| v.nil? }
1452
+ req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::CreateJobTriggerRequest)
1453
+ @create_job_trigger.call(req, options)
1454
+ end
1455
+ end
1456
+ end
1457
+ end
1458
+ end
1459
+ end