google-cloud-dlp 0.13.2 → 1.1.1

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 ([Alpha](https://github.com/googleapis/google-cloud-ruby#versioning))
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,2217 +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
- headers.merge!(metadata) unless metadata.nil?
339
- client_config_file = Pathname.new(__dir__).join(
340
- "dlp_service_client_config.json"
341
- )
342
- defaults = client_config_file.open do |f|
343
- Google::Gax.construct_settings(
344
- "google.privacy.dlp.v2.DlpService",
345
- JSON.parse(f.read),
346
- client_config,
347
- Google::Gax::Grpc::STATUS_CODE_NAMES,
348
- timeout,
349
- page_descriptors: PAGE_DESCRIPTORS,
350
- errors: Google::Gax::Grpc::API_ERRORS,
351
- metadata: headers
352
- )
353
- end
354
-
355
- # Allow overriding the service path/port in subclasses.
356
- service_path = service_address || self.class::SERVICE_ADDRESS
357
- port = service_port || self.class::DEFAULT_SERVICE_PORT
358
- interceptors = self.class::GRPC_INTERCEPTORS
359
- @dlp_service_stub = Google::Gax::Grpc.create_stub(
360
- service_path,
361
- port,
362
- chan_creds: chan_creds,
363
- channel: channel,
364
- updater_proc: updater_proc,
365
- scopes: scopes,
366
- interceptors: interceptors,
367
- &Google::Privacy::Dlp::V2::DlpService::Stub.method(:new)
368
- )
369
-
370
- @inspect_content = Google::Gax.create_api_call(
371
- @dlp_service_stub.method(:inspect_content),
372
- defaults["inspect_content"],
373
- exception_transformer: exception_transformer,
374
- params_extractor: proc do |request|
375
- {'parent' => request.parent}
376
- end
377
- )
378
- @redact_image = Google::Gax.create_api_call(
379
- @dlp_service_stub.method(:redact_image),
380
- defaults["redact_image"],
381
- exception_transformer: exception_transformer,
382
- params_extractor: proc do |request|
383
- {'parent' => request.parent}
384
- end
385
- )
386
- @deidentify_content = Google::Gax.create_api_call(
387
- @dlp_service_stub.method(:deidentify_content),
388
- defaults["deidentify_content"],
389
- exception_transformer: exception_transformer,
390
- params_extractor: proc do |request|
391
- {'parent' => request.parent}
392
- end
393
- )
394
- @reidentify_content = Google::Gax.create_api_call(
395
- @dlp_service_stub.method(:reidentify_content),
396
- defaults["reidentify_content"],
397
- exception_transformer: exception_transformer,
398
- params_extractor: proc do |request|
399
- {'parent' => request.parent}
400
- end
401
- )
402
- @list_info_types = Google::Gax.create_api_call(
403
- @dlp_service_stub.method(:list_info_types),
404
- defaults["list_info_types"],
405
- exception_transformer: exception_transformer,
406
- params_extractor: proc do |request|
407
- {'location_id' => request.location_id}
408
- end
409
- )
410
- @create_inspect_template = Google::Gax.create_api_call(
411
- @dlp_service_stub.method(:create_inspect_template),
412
- defaults["create_inspect_template"],
413
- exception_transformer: exception_transformer,
414
- params_extractor: proc do |request|
415
- {'parent' => request.parent}
416
- end
417
- )
418
- @update_inspect_template = Google::Gax.create_api_call(
419
- @dlp_service_stub.method(:update_inspect_template),
420
- defaults["update_inspect_template"],
421
- exception_transformer: exception_transformer,
422
- params_extractor: proc do |request|
423
- {'name' => request.name}
424
- end
425
- )
426
- @get_inspect_template = Google::Gax.create_api_call(
427
- @dlp_service_stub.method(:get_inspect_template),
428
- defaults["get_inspect_template"],
429
- exception_transformer: exception_transformer,
430
- params_extractor: proc do |request|
431
- {'name' => request.name}
432
- end
433
- )
434
- @list_inspect_templates = Google::Gax.create_api_call(
435
- @dlp_service_stub.method(:list_inspect_templates),
436
- defaults["list_inspect_templates"],
437
- exception_transformer: exception_transformer,
438
- params_extractor: proc do |request|
439
- {'parent' => request.parent}
440
- end
441
- )
442
- @delete_inspect_template = Google::Gax.create_api_call(
443
- @dlp_service_stub.method(:delete_inspect_template),
444
- defaults["delete_inspect_template"],
445
- exception_transformer: exception_transformer,
446
- params_extractor: proc do |request|
447
- {'name' => request.name}
448
- end
449
- )
450
- @create_deidentify_template = Google::Gax.create_api_call(
451
- @dlp_service_stub.method(:create_deidentify_template),
452
- defaults["create_deidentify_template"],
453
- exception_transformer: exception_transformer,
454
- params_extractor: proc do |request|
455
- {'parent' => request.parent}
456
- end
457
- )
458
- @update_deidentify_template = Google::Gax.create_api_call(
459
- @dlp_service_stub.method(:update_deidentify_template),
460
- defaults["update_deidentify_template"],
461
- exception_transformer: exception_transformer,
462
- params_extractor: proc do |request|
463
- {'name' => request.name}
464
- end
465
- )
466
- @get_deidentify_template = Google::Gax.create_api_call(
467
- @dlp_service_stub.method(:get_deidentify_template),
468
- defaults["get_deidentify_template"],
469
- exception_transformer: exception_transformer,
470
- params_extractor: proc do |request|
471
- {'name' => request.name}
472
- end
473
- )
474
- @list_deidentify_templates = Google::Gax.create_api_call(
475
- @dlp_service_stub.method(:list_deidentify_templates),
476
- defaults["list_deidentify_templates"],
477
- exception_transformer: exception_transformer,
478
- params_extractor: proc do |request|
479
- {'parent' => request.parent}
480
- end
481
- )
482
- @delete_deidentify_template = Google::Gax.create_api_call(
483
- @dlp_service_stub.method(:delete_deidentify_template),
484
- defaults["delete_deidentify_template"],
485
- exception_transformer: exception_transformer,
486
- params_extractor: proc do |request|
487
- {'name' => request.name}
488
- end
489
- )
490
- @create_dlp_job = Google::Gax.create_api_call(
491
- @dlp_service_stub.method(:create_dlp_job),
492
- defaults["create_dlp_job"],
493
- exception_transformer: exception_transformer,
494
- params_extractor: proc do |request|
495
- {'parent' => request.parent}
496
- end
497
- )
498
- @list_dlp_jobs = Google::Gax.create_api_call(
499
- @dlp_service_stub.method(:list_dlp_jobs),
500
- defaults["list_dlp_jobs"],
501
- exception_transformer: exception_transformer,
502
- params_extractor: proc do |request|
503
- {'parent' => request.parent}
504
- end
505
- )
506
- @get_dlp_job = Google::Gax.create_api_call(
507
- @dlp_service_stub.method(:get_dlp_job),
508
- defaults["get_dlp_job"],
509
- exception_transformer: exception_transformer,
510
- params_extractor: proc do |request|
511
- {'name' => request.name}
512
- end
513
- )
514
- @delete_dlp_job = Google::Gax.create_api_call(
515
- @dlp_service_stub.method(:delete_dlp_job),
516
- defaults["delete_dlp_job"],
517
- exception_transformer: exception_transformer,
518
- params_extractor: proc do |request|
519
- {'name' => request.name}
520
- end
521
- )
522
- @cancel_dlp_job = Google::Gax.create_api_call(
523
- @dlp_service_stub.method(:cancel_dlp_job),
524
- defaults["cancel_dlp_job"],
525
- exception_transformer: exception_transformer,
526
- params_extractor: proc do |request|
527
- {'name' => request.name}
528
- end
529
- )
530
- @list_job_triggers = Google::Gax.create_api_call(
531
- @dlp_service_stub.method(:list_job_triggers),
532
- defaults["list_job_triggers"],
533
- exception_transformer: exception_transformer,
534
- params_extractor: proc do |request|
535
- {'parent' => request.parent}
536
- end
537
- )
538
- @get_job_trigger = Google::Gax.create_api_call(
539
- @dlp_service_stub.method(:get_job_trigger),
540
- defaults["get_job_trigger"],
541
- exception_transformer: exception_transformer,
542
- params_extractor: proc do |request|
543
- {'name' => request.name}
544
- end
545
- )
546
- @delete_job_trigger = Google::Gax.create_api_call(
547
- @dlp_service_stub.method(:delete_job_trigger),
548
- defaults["delete_job_trigger"],
549
- exception_transformer: exception_transformer,
550
- params_extractor: proc do |request|
551
- {'name' => request.name}
552
- end
553
- )
554
- @update_job_trigger = Google::Gax.create_api_call(
555
- @dlp_service_stub.method(:update_job_trigger),
556
- defaults["update_job_trigger"],
557
- exception_transformer: exception_transformer,
558
- params_extractor: proc do |request|
559
- {'name' => request.name}
560
- end
561
- )
562
- @create_job_trigger = Google::Gax.create_api_call(
563
- @dlp_service_stub.method(:create_job_trigger),
564
- defaults["create_job_trigger"],
565
- exception_transformer: exception_transformer,
566
- params_extractor: proc do |request|
567
- {'parent' => request.parent}
568
- end
569
- )
570
- @create_stored_info_type = Google::Gax.create_api_call(
571
- @dlp_service_stub.method(:create_stored_info_type),
572
- defaults["create_stored_info_type"],
573
- exception_transformer: exception_transformer,
574
- params_extractor: proc do |request|
575
- {'parent' => request.parent}
576
- end
577
- )
578
- @update_stored_info_type = Google::Gax.create_api_call(
579
- @dlp_service_stub.method(:update_stored_info_type),
580
- defaults["update_stored_info_type"],
581
- exception_transformer: exception_transformer,
582
- params_extractor: proc do |request|
583
- {'name' => request.name}
584
- end
585
- )
586
- @get_stored_info_type = Google::Gax.create_api_call(
587
- @dlp_service_stub.method(:get_stored_info_type),
588
- defaults["get_stored_info_type"],
589
- exception_transformer: exception_transformer,
590
- params_extractor: proc do |request|
591
- {'name' => request.name}
592
- end
593
- )
594
- @list_stored_info_types = Google::Gax.create_api_call(
595
- @dlp_service_stub.method(:list_stored_info_types),
596
- defaults["list_stored_info_types"],
597
- exception_transformer: exception_transformer,
598
- params_extractor: proc do |request|
599
- {'parent' => request.parent}
600
- end
601
- )
602
- @delete_stored_info_type = Google::Gax.create_api_call(
603
- @dlp_service_stub.method(:delete_stored_info_type),
604
- defaults["delete_stored_info_type"],
605
- exception_transformer: exception_transformer,
606
- params_extractor: proc do |request|
607
- {'name' => request.name}
608
- end
609
- )
610
- end
611
-
612
- # Service calls
613
-
614
- # Finds potentially sensitive info in content.
615
- # This method has limits on input size, processing time, and output size.
616
- #
617
- # When no InfoTypes or CustomInfoTypes are specified in this request, the
618
- # system will automatically choose what detectors to run. By default this may
619
- # be all types, but may change over time as detectors are updated.
620
- #
621
- # For how to guides, see https://cloud.google.com/dlp/docs/inspecting-images
622
- # and https://cloud.google.com/dlp/docs/inspecting-text,
623
- #
624
- # @param parent [String]
625
- # The parent resource name, for example projects/my-project-id.
626
- # @param inspect_config [Google::Privacy::Dlp::V2::InspectConfig | Hash]
627
- # Configuration for the inspector. What specified here will override
628
- # the template referenced by the inspect_template_name argument.
629
- # A hash of the same form as `Google::Privacy::Dlp::V2::InspectConfig`
630
- # can also be provided.
631
- # @param item [Google::Privacy::Dlp::V2::ContentItem | Hash]
632
- # The item to inspect.
633
- # A hash of the same form as `Google::Privacy::Dlp::V2::ContentItem`
634
- # can also be provided.
635
- # @param inspect_template_name [String]
636
- # Template to use. Any configuration directly specified in
637
- # inspect_config will override those set in the template. Singular fields
638
- # that are set in this request will replace their corresponding fields in the
639
- # template. Repeated fields are appended. Singular sub-messages and groups
640
- # are recursively merged.
641
- # @param location_id [String]
642
- # The geographic location to process content inspection. Reserved for future
643
- # extensions.
644
- # @param options [Google::Gax::CallOptions]
645
- # Overrides the default settings for this call, e.g, timeout,
646
- # retries, etc.
647
- # @yield [result, operation] Access the result along with the RPC operation
648
- # @yieldparam result [Google::Privacy::Dlp::V2::InspectContentResponse]
649
- # @yieldparam operation [GRPC::ActiveCall::Operation]
650
- # @return [Google::Privacy::Dlp::V2::InspectContentResponse]
651
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
652
- # @example
653
- # require "google/cloud/dlp"
654
- #
655
- # dlp_client = Google::Cloud::Dlp.new(version: :v2)
656
- # formatted_parent = Google::Cloud::Dlp::V2::DlpServiceClient.project_path("[PROJECT]")
657
- # response = dlp_client.inspect_content(formatted_parent)
658
-
659
- def inspect_content \
660
- parent,
661
- inspect_config: nil,
662
- item: nil,
663
- inspect_template_name: nil,
664
- location_id: nil,
665
- options: nil,
666
- &block
667
- req = {
668
- parent: parent,
669
- inspect_config: inspect_config,
670
- item: item,
671
- inspect_template_name: inspect_template_name,
672
- location_id: location_id
673
- }.delete_if { |_, v| v.nil? }
674
- req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::InspectContentRequest)
675
- @inspect_content.call(req, options, &block)
676
- end
677
-
678
- # Redacts potentially sensitive info from an image.
679
- # This method has limits on input size, processing time, and output size.
680
- # See https://cloud.google.com/dlp/docs/redacting-sensitive-data-images to
681
- # learn more.
682
- #
683
- # When no InfoTypes or CustomInfoTypes are specified in this request, the
684
- # system will automatically choose what detectors to run. By default this may
685
- # be all types, but may change over time as detectors are updated.
686
- #
687
- # @param parent [String]
688
- # The parent resource name, for example projects/my-project-id.
689
- # @param location_id [String]
690
- # The geographic location to process the request. Reserved for future
691
- # extensions.
692
- # @param inspect_config [Google::Privacy::Dlp::V2::InspectConfig | Hash]
693
- # Configuration for the inspector.
694
- # A hash of the same form as `Google::Privacy::Dlp::V2::InspectConfig`
695
- # can also be provided.
696
- # @param image_redaction_configs [Array<Google::Privacy::Dlp::V2::RedactImageRequest::ImageRedactionConfig | Hash>]
697
- # The configuration for specifying what content to redact from images.
698
- # A hash of the same form as `Google::Privacy::Dlp::V2::RedactImageRequest::ImageRedactionConfig`
699
- # can also be provided.
700
- # @param include_findings [true, false]
701
- # Whether the response should include findings along with the redacted
702
- # image.
703
- # @param byte_item [Google::Privacy::Dlp::V2::ByteContentItem | Hash]
704
- # The content must be PNG, JPEG, SVG or BMP.
705
- # A hash of the same form as `Google::Privacy::Dlp::V2::ByteContentItem`
706
- # can also be provided.
707
- # @param options [Google::Gax::CallOptions]
708
- # Overrides the default settings for this call, e.g, timeout,
709
- # retries, etc.
710
- # @yield [result, operation] Access the result along with the RPC operation
711
- # @yieldparam result [Google::Privacy::Dlp::V2::RedactImageResponse]
712
- # @yieldparam operation [GRPC::ActiveCall::Operation]
713
- # @return [Google::Privacy::Dlp::V2::RedactImageResponse]
714
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
715
- # @example
716
- # require "google/cloud/dlp"
717
- #
718
- # dlp_client = Google::Cloud::Dlp.new(version: :v2)
719
- # formatted_parent = Google::Cloud::Dlp::V2::DlpServiceClient.project_path("[PROJECT]")
720
- # response = dlp_client.redact_image(formatted_parent)
721
-
722
- def redact_image \
723
- parent,
724
- location_id: nil,
725
- inspect_config: nil,
726
- image_redaction_configs: nil,
727
- include_findings: nil,
728
- byte_item: nil,
729
- options: nil,
730
- &block
731
- req = {
732
- parent: parent,
733
- location_id: location_id,
734
- inspect_config: inspect_config,
735
- image_redaction_configs: image_redaction_configs,
736
- include_findings: include_findings,
737
- byte_item: byte_item
738
- }.delete_if { |_, v| v.nil? }
739
- req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::RedactImageRequest)
740
- @redact_image.call(req, options, &block)
741
- end
742
-
743
- # De-identifies potentially sensitive info from a ContentItem.
744
- # This method has limits on input size and output size.
745
- # See https://cloud.google.com/dlp/docs/deidentify-sensitive-data to
746
- # learn more.
747
- #
748
- # When no InfoTypes or CustomInfoTypes are specified in this request, the
749
- # system will automatically choose what detectors to run. By default this may
750
- # be all types, but may change over time as detectors are updated.
751
- #
752
- # @param parent [String]
753
- # The parent resource name, for example projects/my-project-id.
754
- # @param deidentify_config [Google::Privacy::Dlp::V2::DeidentifyConfig | Hash]
755
- # Configuration for the de-identification of the content item.
756
- # Items specified here will override the template referenced by the
757
- # deidentify_template_name argument.
758
- # A hash of the same form as `Google::Privacy::Dlp::V2::DeidentifyConfig`
759
- # can also be provided.
760
- # @param inspect_config [Google::Privacy::Dlp::V2::InspectConfig | Hash]
761
- # Configuration for the inspector.
762
- # Items specified here will override the template referenced by the
763
- # inspect_template_name argument.
764
- # A hash of the same form as `Google::Privacy::Dlp::V2::InspectConfig`
765
- # can also be provided.
766
- # @param item [Google::Privacy::Dlp::V2::ContentItem | Hash]
767
- # The item to de-identify. Will be treated as text.
768
- # A hash of the same form as `Google::Privacy::Dlp::V2::ContentItem`
769
- # can also be provided.
770
- # @param inspect_template_name [String]
771
- # Template to use. Any configuration directly specified in
772
- # inspect_config will override those set in the template. Singular fields
773
- # that are set in this request will replace their corresponding fields in the
774
- # template. Repeated fields are appended. Singular sub-messages and groups
775
- # are recursively merged.
776
- # @param deidentify_template_name [String]
777
- # Template to use. Any configuration directly specified in
778
- # deidentify_config will override those set in the template. Singular fields
779
- # that are set in this request will replace their corresponding fields in the
780
- # template. Repeated fields are appended. Singular sub-messages and groups
781
- # are recursively merged.
782
- # @param location_id [String]
783
- # The geographic location to process de-identification. Reserved for future
784
- # extensions.
785
- # @param options [Google::Gax::CallOptions]
786
- # Overrides the default settings for this call, e.g, timeout,
787
- # retries, etc.
788
- # @yield [result, operation] Access the result along with the RPC operation
789
- # @yieldparam result [Google::Privacy::Dlp::V2::DeidentifyContentResponse]
790
- # @yieldparam operation [GRPC::ActiveCall::Operation]
791
- # @return [Google::Privacy::Dlp::V2::DeidentifyContentResponse]
792
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
793
- # @example
794
- # require "google/cloud/dlp"
795
- #
796
- # dlp_client = Google::Cloud::Dlp.new(version: :v2)
797
- # formatted_parent = Google::Cloud::Dlp::V2::DlpServiceClient.project_path("[PROJECT]")
798
- # response = dlp_client.deidentify_content(formatted_parent)
799
-
800
- def deidentify_content \
801
- parent,
802
- deidentify_config: nil,
803
- inspect_config: nil,
804
- item: nil,
805
- inspect_template_name: nil,
806
- deidentify_template_name: nil,
807
- location_id: nil,
808
- options: nil,
809
- &block
810
- req = {
811
- parent: parent,
812
- deidentify_config: deidentify_config,
813
- inspect_config: inspect_config,
814
- item: item,
815
- inspect_template_name: inspect_template_name,
816
- deidentify_template_name: deidentify_template_name,
817
- location_id: location_id
818
- }.delete_if { |_, v| v.nil? }
819
- req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::DeidentifyContentRequest)
820
- @deidentify_content.call(req, options, &block)
821
- end
822
-
823
- # Re-identifies content that has been de-identified.
824
- # See
825
- # https://cloud.google.com/dlp/docs/pseudonymization#re-identification_in_free_text_code_example
826
- # to learn more.
827
- #
828
- # @param parent [String]
829
- # Required. The parent resource name.
830
- # @param reidentify_config [Google::Privacy::Dlp::V2::DeidentifyConfig | Hash]
831
- # Configuration for the re-identification of the content item.
832
- # This field shares the same proto message type that is used for
833
- # de-identification, however its usage here is for the reversal of the
834
- # previous de-identification. Re-identification is performed by examining
835
- # the transformations used to de-identify the items and executing the
836
- # reverse. This requires that only reversible transformations
837
- # be provided here. The reversible transformations are:
838
- #
839
- # * `CryptoDeterministicConfig`
840
- # * `CryptoReplaceFfxFpeConfig`
841
- # A hash of the same form as `Google::Privacy::Dlp::V2::DeidentifyConfig`
842
- # can also be provided.
843
- # @param inspect_config [Google::Privacy::Dlp::V2::InspectConfig | Hash]
844
- # Configuration for the inspector.
845
- # A hash of the same form as `Google::Privacy::Dlp::V2::InspectConfig`
846
- # can also be provided.
847
- # @param item [Google::Privacy::Dlp::V2::ContentItem | Hash]
848
- # The item to re-identify. Will be treated as text.
849
- # A hash of the same form as `Google::Privacy::Dlp::V2::ContentItem`
850
- # can also be provided.
851
- # @param inspect_template_name [String]
852
- # Template to use. Any configuration directly specified in
853
- # `inspect_config` will override those set in the template. Singular fields
854
- # that are set in this request will replace their corresponding fields in the
855
- # template. Repeated fields are appended. Singular sub-messages and groups
856
- # are recursively merged.
857
- # @param reidentify_template_name [String]
858
- # Template to use. References an instance of `DeidentifyTemplate`.
859
- # Any configuration directly specified in `reidentify_config` or
860
- # `inspect_config` will override those set in the template. Singular fields
861
- # that are set in this request will replace their corresponding fields in the
862
- # template. Repeated fields are appended. Singular sub-messages and groups
863
- # are recursively merged.
864
- # @param location_id [String]
865
- # The geographic location to process content reidentification. Reserved for
866
- # future extensions.
867
- # @param options [Google::Gax::CallOptions]
868
- # Overrides the default settings for this call, e.g, timeout,
869
- # retries, etc.
870
- # @yield [result, operation] Access the result along with the RPC operation
871
- # @yieldparam result [Google::Privacy::Dlp::V2::ReidentifyContentResponse]
872
- # @yieldparam operation [GRPC::ActiveCall::Operation]
873
- # @return [Google::Privacy::Dlp::V2::ReidentifyContentResponse]
874
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
875
- # @example
876
- # require "google/cloud/dlp"
877
- #
878
- # dlp_client = Google::Cloud::Dlp.new(version: :v2)
879
- # formatted_parent = Google::Cloud::Dlp::V2::DlpServiceClient.project_path("[PROJECT]")
880
- # response = dlp_client.reidentify_content(formatted_parent)
881
-
882
- def reidentify_content \
883
- parent,
884
- reidentify_config: nil,
885
- inspect_config: nil,
886
- item: nil,
887
- inspect_template_name: nil,
888
- reidentify_template_name: nil,
889
- location_id: nil,
890
- options: nil,
891
- &block
892
- req = {
893
- parent: parent,
894
- reidentify_config: reidentify_config,
895
- inspect_config: inspect_config,
896
- item: item,
897
- inspect_template_name: inspect_template_name,
898
- reidentify_template_name: reidentify_template_name,
899
- location_id: location_id
900
- }.delete_if { |_, v| v.nil? }
901
- req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::ReidentifyContentRequest)
902
- @reidentify_content.call(req, options, &block)
903
- end
904
-
905
- # Returns a list of the sensitive information types that the DLP API
906
- # supports. See https://cloud.google.com/dlp/docs/infotypes-reference to
907
- # learn more.
908
- #
909
- # @param language_code [String]
910
- # BCP-47 language code for localized infoType friendly
911
- # names. If omitted, or if localized strings are not available,
912
- # en-US strings will be returned.
913
- # @param filter [String]
914
- # filter to only return infoTypes supported by certain parts of the
915
- # API. Defaults to supported_by=INSPECT.
916
- # @param location_id [String]
917
- # The geographic location to list info types. Reserved for future
918
- # extensions.
919
- # @param options [Google::Gax::CallOptions]
920
- # Overrides the default settings for this call, e.g, timeout,
921
- # retries, etc.
922
- # @yield [result, operation] Access the result along with the RPC operation
923
- # @yieldparam result [Google::Privacy::Dlp::V2::ListInfoTypesResponse]
924
- # @yieldparam operation [GRPC::ActiveCall::Operation]
925
- # @return [Google::Privacy::Dlp::V2::ListInfoTypesResponse]
926
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
927
- # @example
928
- # require "google/cloud/dlp"
929
- #
930
- # dlp_client = Google::Cloud::Dlp.new(version: :v2)
931
- # response = dlp_client.list_info_types
932
-
933
- def list_info_types \
934
- language_code: nil,
935
- filter: nil,
936
- location_id: nil,
937
- options: nil,
938
- &block
939
- req = {
940
- language_code: language_code,
941
- filter: filter,
942
- location_id: location_id
943
- }.delete_if { |_, v| v.nil? }
944
- req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::ListInfoTypesRequest)
945
- @list_info_types.call(req, options, &block)
946
- end
947
-
948
- # Creates an InspectTemplate for re-using frequently used configuration
949
- # for inspecting content, images, and storage.
950
- # See https://cloud.google.com/dlp/docs/creating-templates to learn more.
951
- #
952
- # @param parent [String]
953
- # Required. The parent resource name, for example projects/my-project-id or
954
- # organizations/my-org-id.
955
- # @param inspect_template [Google::Privacy::Dlp::V2::InspectTemplate | Hash]
956
- # Required. The InspectTemplate to create.
957
- # A hash of the same form as `Google::Privacy::Dlp::V2::InspectTemplate`
958
- # can also be provided.
959
- # @param template_id [String]
960
- # The template id can contain uppercase and lowercase letters,
961
- # numbers, and hyphens; that is, it must match the regular
962
- # expression: `[a-zA-Z\\d-_]+`. The maximum length is 100
963
- # characters. Can be empty to allow the system to generate one.
964
- # @param location_id [String]
965
- # The geographic location to store the inspection template. Reserved for
966
- # future extensions.
967
- # @param options [Google::Gax::CallOptions]
968
- # Overrides the default settings for this call, e.g, timeout,
969
- # retries, etc.
970
- # @yield [result, operation] Access the result along with the RPC operation
971
- # @yieldparam result [Google::Privacy::Dlp::V2::InspectTemplate]
972
- # @yieldparam operation [GRPC::ActiveCall::Operation]
973
- # @return [Google::Privacy::Dlp::V2::InspectTemplate]
974
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
975
- # @example
976
- # require "google/cloud/dlp"
977
- #
978
- # dlp_client = Google::Cloud::Dlp.new(version: :v2)
979
- # formatted_parent = Google::Cloud::Dlp::V2::DlpServiceClient.organization_path("[ORGANIZATION]")
980
- # response = dlp_client.create_inspect_template(formatted_parent)
981
-
982
- def create_inspect_template \
983
- parent,
984
- inspect_template: nil,
985
- template_id: nil,
986
- location_id: nil,
987
- options: nil,
988
- &block
989
- req = {
990
- parent: parent,
991
- inspect_template: inspect_template,
992
- template_id: template_id,
993
- location_id: location_id
994
- }.delete_if { |_, v| v.nil? }
995
- req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::CreateInspectTemplateRequest)
996
- @create_inspect_template.call(req, options, &block)
997
- end
998
-
999
- # Updates the InspectTemplate.
1000
- # See https://cloud.google.com/dlp/docs/creating-templates to learn more.
1001
- #
1002
- # @param name [String]
1003
- # Required. Resource name of organization and inspectTemplate to be updated, for
1004
- # example `organizations/433245324/inspectTemplates/432452342` or
1005
- # projects/project-id/inspectTemplates/432452342.
1006
- # @param inspect_template [Google::Privacy::Dlp::V2::InspectTemplate | Hash]
1007
- # New InspectTemplate value.
1008
- # A hash of the same form as `Google::Privacy::Dlp::V2::InspectTemplate`
1009
- # can also be provided.
1010
- # @param update_mask [Google::Protobuf::FieldMask | Hash]
1011
- # Mask to control which fields get updated.
1012
- # A hash of the same form as `Google::Protobuf::FieldMask`
1013
- # can also be provided.
1014
- # @param options [Google::Gax::CallOptions]
1015
- # Overrides the default settings for this call, e.g, timeout,
1016
- # retries, etc.
1017
- # @yield [result, operation] Access the result along with the RPC operation
1018
- # @yieldparam result [Google::Privacy::Dlp::V2::InspectTemplate]
1019
- # @yieldparam operation [GRPC::ActiveCall::Operation]
1020
- # @return [Google::Privacy::Dlp::V2::InspectTemplate]
1021
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1022
- # @example
1023
- # require "google/cloud/dlp"
1024
- #
1025
- # dlp_client = Google::Cloud::Dlp.new(version: :v2)
1026
- # formatted_name = Google::Cloud::Dlp::V2::DlpServiceClient.organization_inspect_template_path("[ORGANIZATION]", "[INSPECT_TEMPLATE]")
1027
- # response = dlp_client.update_inspect_template(formatted_name)
1028
-
1029
- def update_inspect_template \
1030
- name,
1031
- inspect_template: nil,
1032
- update_mask: nil,
1033
- options: nil,
1034
- &block
1035
- req = {
1036
- name: name,
1037
- inspect_template: inspect_template,
1038
- update_mask: update_mask
1039
- }.delete_if { |_, v| v.nil? }
1040
- req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::UpdateInspectTemplateRequest)
1041
- @update_inspect_template.call(req, options, &block)
1042
- end
1043
-
1044
- # Gets an InspectTemplate.
1045
- # See https://cloud.google.com/dlp/docs/creating-templates to learn more.
1046
- #
1047
- # @param name [String]
1048
- # Required. Resource name of the organization and inspectTemplate to be read, for
1049
- # example `organizations/433245324/inspectTemplates/432452342` or
1050
- # projects/project-id/inspectTemplates/432452342.
1051
- # @param options [Google::Gax::CallOptions]
1052
- # Overrides the default settings for this call, e.g, timeout,
1053
- # retries, etc.
1054
- # @yield [result, operation] Access the result along with the RPC operation
1055
- # @yieldparam result [Google::Privacy::Dlp::V2::InspectTemplate]
1056
- # @yieldparam operation [GRPC::ActiveCall::Operation]
1057
- # @return [Google::Privacy::Dlp::V2::InspectTemplate]
1058
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1059
- # @example
1060
- # require "google/cloud/dlp"
1061
- #
1062
- # dlp_client = Google::Cloud::Dlp.new(version: :v2)
1063
- # response = dlp_client.get_inspect_template
1064
-
1065
- def get_inspect_template \
1066
- name: nil,
1067
- options: nil,
1068
- &block
1069
- req = {
1070
- name: name
1071
- }.delete_if { |_, v| v.nil? }
1072
- req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::GetInspectTemplateRequest)
1073
- @get_inspect_template.call(req, options, &block)
1074
- end
1075
-
1076
- # Lists InspectTemplates.
1077
- # See https://cloud.google.com/dlp/docs/creating-templates to learn more.
1078
- #
1079
- # @param parent [String]
1080
- # Required. The parent resource name, for example projects/my-project-id or
1081
- # organizations/my-org-id.
1082
- # @param page_size [Integer]
1083
- # The maximum number of resources contained in the underlying API
1084
- # response. If page streaming is performed per-resource, this
1085
- # parameter does not affect the return value. If page streaming is
1086
- # performed per-page, this determines the maximum number of
1087
- # resources in a page.
1088
- # @param order_by [String]
1089
- # Comma separated list of fields to order by,
1090
- # followed by `asc` or `desc` postfix. This list is case-insensitive,
1091
- # default sorting order is ascending, redundant space characters are
1092
- # insignificant.
1093
- #
1094
- # Example: `name asc,update_time, create_time desc`
1095
- #
1096
- # Supported fields are:
1097
- #
1098
- # * `create_time`: corresponds to time the template was created.
1099
- # * `update_time`: corresponds to time the template was last updated.
1100
- # * `name`: corresponds to template's name.
1101
- # * `display_name`: corresponds to template's display name.
1102
- # @param location_id [String]
1103
- # The geographic location where inspection templates will be retrieved from.
1104
- # Use `-` for all locations. Reserved for future extensions.
1105
- # @param options [Google::Gax::CallOptions]
1106
- # Overrides the default settings for this call, e.g, timeout,
1107
- # retries, etc.
1108
- # @yield [result, operation] Access the result along with the RPC operation
1109
- # @yieldparam result [Google::Gax::PagedEnumerable<Google::Privacy::Dlp::V2::InspectTemplate>]
1110
- # @yieldparam operation [GRPC::ActiveCall::Operation]
1111
- # @return [Google::Gax::PagedEnumerable<Google::Privacy::Dlp::V2::InspectTemplate>]
1112
- # An enumerable of Google::Privacy::Dlp::V2::InspectTemplate instances.
1113
- # See Google::Gax::PagedEnumerable documentation for other
1114
- # operations such as per-page iteration or access to the response
1115
- # object.
1116
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1117
- # @example
1118
- # require "google/cloud/dlp"
1119
- #
1120
- # dlp_client = Google::Cloud::Dlp.new(version: :v2)
1121
- # formatted_parent = Google::Cloud::Dlp::V2::DlpServiceClient.organization_path("[ORGANIZATION]")
1122
- #
1123
- # # Iterate over all results.
1124
- # dlp_client.list_inspect_templates(formatted_parent).each do |element|
1125
- # # Process element.
1126
- # end
1127
- #
1128
- # # Or iterate over results one page at a time.
1129
- # dlp_client.list_inspect_templates(formatted_parent).each_page do |page|
1130
- # # Process each page at a time.
1131
- # page.each do |element|
1132
- # # Process element.
1133
- # end
1134
- # end
1135
-
1136
- def list_inspect_templates \
1137
- parent,
1138
- page_size: nil,
1139
- order_by: nil,
1140
- location_id: nil,
1141
- options: nil,
1142
- &block
1143
- req = {
1144
- parent: parent,
1145
- page_size: page_size,
1146
- order_by: order_by,
1147
- location_id: location_id
1148
- }.delete_if { |_, v| v.nil? }
1149
- req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::ListInspectTemplatesRequest)
1150
- @list_inspect_templates.call(req, options, &block)
1151
- end
1152
-
1153
- # Deletes an InspectTemplate.
1154
- # See https://cloud.google.com/dlp/docs/creating-templates to learn more.
1155
- #
1156
- # @param name [String]
1157
- # Required. Resource name of the organization and inspectTemplate to be deleted, for
1158
- # example `organizations/433245324/inspectTemplates/432452342` or
1159
- # projects/project-id/inspectTemplates/432452342.
1160
- # @param options [Google::Gax::CallOptions]
1161
- # Overrides the default settings for this call, e.g, timeout,
1162
- # retries, etc.
1163
- # @yield [result, operation] Access the result along with the RPC operation
1164
- # @yieldparam result []
1165
- # @yieldparam operation [GRPC::ActiveCall::Operation]
1166
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1167
- # @example
1168
- # require "google/cloud/dlp"
1169
- #
1170
- # dlp_client = Google::Cloud::Dlp.new(version: :v2)
1171
- # formatted_name = Google::Cloud::Dlp::V2::DlpServiceClient.organization_inspect_template_path("[ORGANIZATION]", "[INSPECT_TEMPLATE]")
1172
- # dlp_client.delete_inspect_template(formatted_name)
1173
-
1174
- def delete_inspect_template \
1175
- name,
1176
- options: nil,
1177
- &block
1178
- req = {
1179
- name: name
1180
- }.delete_if { |_, v| v.nil? }
1181
- req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::DeleteInspectTemplateRequest)
1182
- @delete_inspect_template.call(req, options, &block)
1183
- nil
1184
- end
1185
-
1186
- # Creates a DeidentifyTemplate for re-using frequently used configuration
1187
- # for de-identifying content, images, and storage.
1188
- # See https://cloud.google.com/dlp/docs/creating-templates-deid to learn
1189
- # more.
1190
- #
1191
- # @param parent [String]
1192
- # Required. The parent resource name, for example projects/my-project-id or
1193
- # organizations/my-org-id.
1194
- # @param deidentify_template [Google::Privacy::Dlp::V2::DeidentifyTemplate | Hash]
1195
- # Required. The DeidentifyTemplate to create.
1196
- # A hash of the same form as `Google::Privacy::Dlp::V2::DeidentifyTemplate`
1197
- # can also be provided.
1198
- # @param template_id [String]
1199
- # The template id can contain uppercase and lowercase letters,
1200
- # numbers, and hyphens; that is, it must match the regular
1201
- # expression: `[a-zA-Z\\d-_]+`. The maximum length is 100
1202
- # characters. Can be empty to allow the system to generate one.
1203
- # @param location_id [String]
1204
- # The geographic location to store the deidentification template. Reserved
1205
- # for future extensions.
1206
- # @param options [Google::Gax::CallOptions]
1207
- # Overrides the default settings for this call, e.g, timeout,
1208
- # retries, etc.
1209
- # @yield [result, operation] Access the result along with the RPC operation
1210
- # @yieldparam result [Google::Privacy::Dlp::V2::DeidentifyTemplate]
1211
- # @yieldparam operation [GRPC::ActiveCall::Operation]
1212
- # @return [Google::Privacy::Dlp::V2::DeidentifyTemplate]
1213
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1214
- # @example
1215
- # require "google/cloud/dlp"
1216
- #
1217
- # dlp_client = Google::Cloud::Dlp.new(version: :v2)
1218
- # formatted_parent = Google::Cloud::Dlp::V2::DlpServiceClient.organization_path("[ORGANIZATION]")
1219
- # response = dlp_client.create_deidentify_template(formatted_parent)
1220
-
1221
- def create_deidentify_template \
1222
- parent,
1223
- deidentify_template: nil,
1224
- template_id: nil,
1225
- location_id: nil,
1226
- options: nil,
1227
- &block
1228
- req = {
1229
- parent: parent,
1230
- deidentify_template: deidentify_template,
1231
- template_id: template_id,
1232
- location_id: location_id
1233
- }.delete_if { |_, v| v.nil? }
1234
- req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::CreateDeidentifyTemplateRequest)
1235
- @create_deidentify_template.call(req, options, &block)
1236
- end
1237
-
1238
- # Updates the DeidentifyTemplate.
1239
- # See https://cloud.google.com/dlp/docs/creating-templates-deid to learn
1240
- # more.
1241
- #
1242
- # @param name [String]
1243
- # Required. Resource name of organization and deidentify template to be updated, for
1244
- # example `organizations/433245324/deidentifyTemplates/432452342` or
1245
- # projects/project-id/deidentifyTemplates/432452342.
1246
- # @param deidentify_template [Google::Privacy::Dlp::V2::DeidentifyTemplate | Hash]
1247
- # New DeidentifyTemplate value.
1248
- # A hash of the same form as `Google::Privacy::Dlp::V2::DeidentifyTemplate`
1249
- # can also be provided.
1250
- # @param update_mask [Google::Protobuf::FieldMask | Hash]
1251
- # Mask to control which fields get updated.
1252
- # A hash of the same form as `Google::Protobuf::FieldMask`
1253
- # can also be provided.
1254
- # @param options [Google::Gax::CallOptions]
1255
- # Overrides the default settings for this call, e.g, timeout,
1256
- # retries, etc.
1257
- # @yield [result, operation] Access the result along with the RPC operation
1258
- # @yieldparam result [Google::Privacy::Dlp::V2::DeidentifyTemplate]
1259
- # @yieldparam operation [GRPC::ActiveCall::Operation]
1260
- # @return [Google::Privacy::Dlp::V2::DeidentifyTemplate]
1261
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1262
- # @example
1263
- # require "google/cloud/dlp"
1264
- #
1265
- # dlp_client = Google::Cloud::Dlp.new(version: :v2)
1266
- # formatted_name = Google::Cloud::Dlp::V2::DlpServiceClient.organization_deidentify_template_path("[ORGANIZATION]", "[DEIDENTIFY_TEMPLATE]")
1267
- # response = dlp_client.update_deidentify_template(formatted_name)
1268
-
1269
- def update_deidentify_template \
1270
- name,
1271
- deidentify_template: nil,
1272
- update_mask: nil,
1273
- options: nil,
1274
- &block
1275
- req = {
1276
- name: name,
1277
- deidentify_template: deidentify_template,
1278
- update_mask: update_mask
1279
- }.delete_if { |_, v| v.nil? }
1280
- req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::UpdateDeidentifyTemplateRequest)
1281
- @update_deidentify_template.call(req, options, &block)
1282
- end
1283
-
1284
- # Gets a DeidentifyTemplate.
1285
- # See https://cloud.google.com/dlp/docs/creating-templates-deid to learn
1286
- # more.
1287
- #
1288
- # @param name [String]
1289
- # Required. Resource name of the organization and deidentify template to be read, for
1290
- # example `organizations/433245324/deidentifyTemplates/432452342` or
1291
- # projects/project-id/deidentifyTemplates/432452342.
1292
- # @param options [Google::Gax::CallOptions]
1293
- # Overrides the default settings for this call, e.g, timeout,
1294
- # retries, etc.
1295
- # @yield [result, operation] Access the result along with the RPC operation
1296
- # @yieldparam result [Google::Privacy::Dlp::V2::DeidentifyTemplate]
1297
- # @yieldparam operation [GRPC::ActiveCall::Operation]
1298
- # @return [Google::Privacy::Dlp::V2::DeidentifyTemplate]
1299
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1300
- # @example
1301
- # require "google/cloud/dlp"
1302
- #
1303
- # dlp_client = Google::Cloud::Dlp.new(version: :v2)
1304
- # formatted_name = Google::Cloud::Dlp::V2::DlpServiceClient.organization_deidentify_template_path("[ORGANIZATION]", "[DEIDENTIFY_TEMPLATE]")
1305
- # response = dlp_client.get_deidentify_template(formatted_name)
1306
-
1307
- def get_deidentify_template \
1308
- name,
1309
- options: nil,
1310
- &block
1311
- req = {
1312
- name: name
1313
- }.delete_if { |_, v| v.nil? }
1314
- req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::GetDeidentifyTemplateRequest)
1315
- @get_deidentify_template.call(req, options, &block)
1316
- end
1317
-
1318
- # Lists DeidentifyTemplates.
1319
- # See https://cloud.google.com/dlp/docs/creating-templates-deid to learn
1320
- # more.
1321
- #
1322
- # @param parent [String]
1323
- # Required. The parent resource name, for example projects/my-project-id or
1324
- # organizations/my-org-id.
1325
- # @param page_size [Integer]
1326
- # The maximum number of resources contained in the underlying API
1327
- # response. If page streaming is performed per-resource, this
1328
- # parameter does not affect the return value. If page streaming is
1329
- # performed per-page, this determines the maximum number of
1330
- # resources in a page.
1331
- # @param order_by [String]
1332
- # Comma separated list of fields to order by,
1333
- # followed by `asc` or `desc` postfix. This list is case-insensitive,
1334
- # default sorting order is ascending, redundant space characters are
1335
- # insignificant.
1336
- #
1337
- # Example: `name asc,update_time, create_time desc`
1338
- #
1339
- # Supported fields are:
1340
- #
1341
- # * `create_time`: corresponds to time the template was created.
1342
- # * `update_time`: corresponds to time the template was last updated.
1343
- # * `name`: corresponds to template's name.
1344
- # * `display_name`: corresponds to template's display name.
1345
- # @param location_id [String]
1346
- # The geographic location where deidentifications templates will be retrieved
1347
- # from. Use `-` for all locations. Reserved for future extensions.
1348
- # @param options [Google::Gax::CallOptions]
1349
- # Overrides the default settings for this call, e.g, timeout,
1350
- # retries, etc.
1351
- # @yield [result, operation] Access the result along with the RPC operation
1352
- # @yieldparam result [Google::Gax::PagedEnumerable<Google::Privacy::Dlp::V2::DeidentifyTemplate>]
1353
- # @yieldparam operation [GRPC::ActiveCall::Operation]
1354
- # @return [Google::Gax::PagedEnumerable<Google::Privacy::Dlp::V2::DeidentifyTemplate>]
1355
- # An enumerable of Google::Privacy::Dlp::V2::DeidentifyTemplate instances.
1356
- # See Google::Gax::PagedEnumerable documentation for other
1357
- # operations such as per-page iteration or access to the response
1358
- # object.
1359
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1360
- # @example
1361
- # require "google/cloud/dlp"
1362
- #
1363
- # dlp_client = Google::Cloud::Dlp.new(version: :v2)
1364
- # formatted_parent = Google::Cloud::Dlp::V2::DlpServiceClient.organization_path("[ORGANIZATION]")
1365
- #
1366
- # # Iterate over all results.
1367
- # dlp_client.list_deidentify_templates(formatted_parent).each do |element|
1368
- # # Process element.
1369
- # end
1370
- #
1371
- # # Or iterate over results one page at a time.
1372
- # dlp_client.list_deidentify_templates(formatted_parent).each_page do |page|
1373
- # # Process each page at a time.
1374
- # page.each do |element|
1375
- # # Process element.
1376
- # end
1377
- # end
1378
-
1379
- def list_deidentify_templates \
1380
- parent,
1381
- page_size: nil,
1382
- order_by: nil,
1383
- location_id: nil,
1384
- options: nil,
1385
- &block
1386
- req = {
1387
- parent: parent,
1388
- page_size: page_size,
1389
- order_by: order_by,
1390
- location_id: location_id
1391
- }.delete_if { |_, v| v.nil? }
1392
- req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::ListDeidentifyTemplatesRequest)
1393
- @list_deidentify_templates.call(req, options, &block)
1394
- end
1395
-
1396
- # Deletes a DeidentifyTemplate.
1397
- # See https://cloud.google.com/dlp/docs/creating-templates-deid to learn
1398
- # more.
1399
- #
1400
- # @param name [String]
1401
- # Required. Resource name of the organization and deidentify template to be deleted,
1402
- # for example `organizations/433245324/deidentifyTemplates/432452342` or
1403
- # projects/project-id/deidentifyTemplates/432452342.
1404
- # @param options [Google::Gax::CallOptions]
1405
- # Overrides the default settings for this call, e.g, timeout,
1406
- # retries, etc.
1407
- # @yield [result, operation] Access the result along with the RPC operation
1408
- # @yieldparam result []
1409
- # @yieldparam operation [GRPC::ActiveCall::Operation]
1410
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1411
- # @example
1412
- # require "google/cloud/dlp"
1413
- #
1414
- # dlp_client = Google::Cloud::Dlp.new(version: :v2)
1415
- # formatted_name = Google::Cloud::Dlp::V2::DlpServiceClient.organization_deidentify_template_path("[ORGANIZATION]", "[DEIDENTIFY_TEMPLATE]")
1416
- # dlp_client.delete_deidentify_template(formatted_name)
1417
-
1418
- def delete_deidentify_template \
1419
- name,
1420
- options: nil,
1421
- &block
1422
- req = {
1423
- name: name
1424
- }.delete_if { |_, v| v.nil? }
1425
- req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::DeleteDeidentifyTemplateRequest)
1426
- @delete_deidentify_template.call(req, options, &block)
1427
- nil
1428
- end
1429
-
1430
- # Creates a new job to inspect storage or calculate risk metrics.
1431
- # See https://cloud.google.com/dlp/docs/inspecting-storage and
1432
- # https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more.
1433
- #
1434
- # When no InfoTypes or CustomInfoTypes are specified in inspect jobs, the
1435
- # system will automatically choose what detectors to run. By default this may
1436
- # be all types, but may change over time as detectors are updated.
1437
- #
1438
- # @param parent [String]
1439
- # Required. The parent resource name, for example projects/my-project-id.
1440
- # @param inspect_job [Google::Privacy::Dlp::V2::InspectJobConfig | Hash]
1441
- # Set to control what and how to inspect.
1442
- # A hash of the same form as `Google::Privacy::Dlp::V2::InspectJobConfig`
1443
- # can also be provided.
1444
- # @param risk_job [Google::Privacy::Dlp::V2::RiskAnalysisJobConfig | Hash]
1445
- # Set to choose what metric to calculate.
1446
- # A hash of the same form as `Google::Privacy::Dlp::V2::RiskAnalysisJobConfig`
1447
- # can also be provided.
1448
- # @param job_id [String]
1449
- # The job id can contain uppercase and lowercase letters,
1450
- # numbers, and hyphens; that is, it must match the regular
1451
- # expression: `[a-zA-Z\\d-_]+`. The maximum length is 100
1452
- # characters. Can be empty to allow the system to generate one.
1453
- # @param location_id [String]
1454
- # The geographic location to store and process the job. Reserved for
1455
- # future extensions.
1456
- # @param options [Google::Gax::CallOptions]
1457
- # Overrides the default settings for this call, e.g, timeout,
1458
- # retries, etc.
1459
- # @yield [result, operation] Access the result along with the RPC operation
1460
- # @yieldparam result [Google::Privacy::Dlp::V2::DlpJob]
1461
- # @yieldparam operation [GRPC::ActiveCall::Operation]
1462
- # @return [Google::Privacy::Dlp::V2::DlpJob]
1463
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1464
- # @example
1465
- # require "google/cloud/dlp"
1466
- #
1467
- # dlp_client = Google::Cloud::Dlp.new(version: :v2)
1468
- # formatted_parent = Google::Cloud::Dlp::V2::DlpServiceClient.project_path("[PROJECT]")
1469
- # response = dlp_client.create_dlp_job(formatted_parent)
1470
-
1471
- def create_dlp_job \
1472
- parent,
1473
- inspect_job: nil,
1474
- risk_job: nil,
1475
- job_id: nil,
1476
- location_id: nil,
1477
- options: nil,
1478
- &block
1479
- req = {
1480
- parent: parent,
1481
- inspect_job: inspect_job,
1482
- risk_job: risk_job,
1483
- job_id: job_id,
1484
- location_id: location_id
1485
- }.delete_if { |_, v| v.nil? }
1486
- req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::CreateDlpJobRequest)
1487
- @create_dlp_job.call(req, options, &block)
1488
- end
1489
-
1490
- # Lists DlpJobs that match the specified filter in the request.
1491
- # See https://cloud.google.com/dlp/docs/inspecting-storage and
1492
- # https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more.
1493
- #
1494
- # @param parent [String]
1495
- # Required. The parent resource name, for example projects/my-project-id.
1496
- # @param filter [String]
1497
- # Allows filtering.
1498
- #
1499
- # Supported syntax:
1500
- #
1501
- # * Filter expressions are made up of one or more restrictions.
1502
- # * Restrictions can be combined by `AND` or `OR` logical operators. A
1503
- # sequence of restrictions implicitly uses `AND`.
1504
- # * A restriction has the form of `{field} {operator} {value}`.
1505
- # * Supported fields/values for inspect jobs:
1506
- # * `state` - PENDING|RUNNING|CANCELED|FINISHED|FAILED
1507
- # * `inspected_storage` - DATASTORE|CLOUD_STORAGE|BIGQUERY
1508
- # * `trigger_name` - The resource name of the trigger that created job.
1509
- # * 'end_time` - Corresponds to time the job finished.
1510
- # * 'start_time` - Corresponds to time the job finished.
1511
- # * Supported fields for risk analysis jobs:
1512
- # * `state` - RUNNING|CANCELED|FINISHED|FAILED
1513
- # * 'end_time` - Corresponds to time the job finished.
1514
- # * 'start_time` - Corresponds to time the job finished.
1515
- # * The operator must be `=` or `!=`.
1516
- #
1517
- # Examples:
1518
- #
1519
- # * inspected_storage = cloud_storage AND state = done
1520
- # * inspected_storage = cloud_storage OR inspected_storage = bigquery
1521
- # * inspected_storage = cloud_storage AND (state = done OR state = canceled)
1522
- # * end_time > \"2017-12-12T00:00:00+00:00\"
1523
- #
1524
- # The length of this field should be no more than 500 characters.
1525
- # @param page_size [Integer]
1526
- # The maximum number of resources contained in the underlying API
1527
- # response. If page streaming is performed per-resource, this
1528
- # parameter does not affect the return value. If page streaming is
1529
- # performed per-page, this determines the maximum number of
1530
- # resources in a page.
1531
- # @param type [Google::Privacy::Dlp::V2::DlpJobType]
1532
- # The type of job. Defaults to `DlpJobType.INSPECT`
1533
- # @param order_by [String]
1534
- # Comma separated list of fields to order by,
1535
- # followed by `asc` or `desc` postfix. This list is case-insensitive,
1536
- # default sorting order is ascending, redundant space characters are
1537
- # insignificant.
1538
- #
1539
- # Example: `name asc, end_time asc, create_time desc`
1540
- #
1541
- # Supported fields are:
1542
- #
1543
- # * `create_time`: corresponds to time the job was created.
1544
- # * `end_time`: corresponds to time the job ended.
1545
- # * `name`: corresponds to job's name.
1546
- # * `state`: corresponds to `state`
1547
- # @param location_id [String]
1548
- # The geographic location where jobs will be retrieved from.
1549
- # Use `-` for all locations. Reserved for future extensions.
1550
- # @param options [Google::Gax::CallOptions]
1551
- # Overrides the default settings for this call, e.g, timeout,
1552
- # retries, etc.
1553
- # @yield [result, operation] Access the result along with the RPC operation
1554
- # @yieldparam result [Google::Gax::PagedEnumerable<Google::Privacy::Dlp::V2::DlpJob>]
1555
- # @yieldparam operation [GRPC::ActiveCall::Operation]
1556
- # @return [Google::Gax::PagedEnumerable<Google::Privacy::Dlp::V2::DlpJob>]
1557
- # An enumerable of Google::Privacy::Dlp::V2::DlpJob instances.
1558
- # See Google::Gax::PagedEnumerable documentation for other
1559
- # operations such as per-page iteration or access to the response
1560
- # object.
1561
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1562
- # @example
1563
- # require "google/cloud/dlp"
1564
- #
1565
- # dlp_client = Google::Cloud::Dlp.new(version: :v2)
1566
- # formatted_parent = Google::Cloud::Dlp::V2::DlpServiceClient.project_path("[PROJECT]")
1567
- #
1568
- # # Iterate over all results.
1569
- # dlp_client.list_dlp_jobs(formatted_parent).each do |element|
1570
- # # Process element.
1571
- # end
1572
- #
1573
- # # Or iterate over results one page at a time.
1574
- # dlp_client.list_dlp_jobs(formatted_parent).each_page do |page|
1575
- # # Process each page at a time.
1576
- # page.each do |element|
1577
- # # Process element.
1578
- # end
1579
- # end
1580
-
1581
- def list_dlp_jobs \
1582
- parent,
1583
- filter: nil,
1584
- page_size: nil,
1585
- type: nil,
1586
- order_by: nil,
1587
- location_id: nil,
1588
- options: nil,
1589
- &block
1590
- req = {
1591
- parent: parent,
1592
- filter: filter,
1593
- page_size: page_size,
1594
- type: type,
1595
- order_by: order_by,
1596
- location_id: location_id
1597
- }.delete_if { |_, v| v.nil? }
1598
- req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::ListDlpJobsRequest)
1599
- @list_dlp_jobs.call(req, options, &block)
1600
- end
1601
-
1602
- # Gets the latest state of a long-running DlpJob.
1603
- # See https://cloud.google.com/dlp/docs/inspecting-storage and
1604
- # https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more.
1605
- #
1606
- # @param name [String]
1607
- # Required. The name of the DlpJob resource.
1608
- # @param options [Google::Gax::CallOptions]
1609
- # Overrides the default settings for this call, e.g, timeout,
1610
- # retries, etc.
1611
- # @yield [result, operation] Access the result along with the RPC operation
1612
- # @yieldparam result [Google::Privacy::Dlp::V2::DlpJob]
1613
- # @yieldparam operation [GRPC::ActiveCall::Operation]
1614
- # @return [Google::Privacy::Dlp::V2::DlpJob]
1615
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1616
- # @example
1617
- # require "google/cloud/dlp"
1618
- #
1619
- # dlp_client = Google::Cloud::Dlp.new(version: :v2)
1620
- # formatted_name = Google::Cloud::Dlp::V2::DlpServiceClient.dlp_job_path("[PROJECT]", "[DLP_JOB]")
1621
- # response = dlp_client.get_dlp_job(formatted_name)
1622
-
1623
- def get_dlp_job \
1624
- name,
1625
- options: nil,
1626
- &block
1627
- req = {
1628
- name: name
1629
- }.delete_if { |_, v| v.nil? }
1630
- req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::GetDlpJobRequest)
1631
- @get_dlp_job.call(req, options, &block)
1632
- end
1633
-
1634
- # Deletes a long-running DlpJob. This method indicates that the client is
1635
- # no longer interested in the DlpJob result. The job will be cancelled if
1636
- # possible.
1637
- # See https://cloud.google.com/dlp/docs/inspecting-storage and
1638
- # https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more.
1639
- #
1640
- # @param name [String]
1641
- # Required. The name of the DlpJob resource to be deleted.
1642
- # @param options [Google::Gax::CallOptions]
1643
- # Overrides the default settings for this call, e.g, timeout,
1644
- # retries, etc.
1645
- # @yield [result, operation] Access the result along with the RPC operation
1646
- # @yieldparam result []
1647
- # @yieldparam operation [GRPC::ActiveCall::Operation]
1648
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1649
- # @example
1650
- # require "google/cloud/dlp"
1651
- #
1652
- # dlp_client = Google::Cloud::Dlp.new(version: :v2)
1653
- # formatted_name = Google::Cloud::Dlp::V2::DlpServiceClient.dlp_job_path("[PROJECT]", "[DLP_JOB]")
1654
- # dlp_client.delete_dlp_job(formatted_name)
1655
-
1656
- def delete_dlp_job \
1657
- name,
1658
- options: nil,
1659
- &block
1660
- req = {
1661
- name: name
1662
- }.delete_if { |_, v| v.nil? }
1663
- req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::DeleteDlpJobRequest)
1664
- @delete_dlp_job.call(req, options, &block)
1665
- nil
1666
- end
1667
-
1668
- # Starts asynchronous cancellation on a long-running DlpJob. The server
1669
- # makes a best effort to cancel the DlpJob, but success is not
1670
- # guaranteed.
1671
- # See https://cloud.google.com/dlp/docs/inspecting-storage and
1672
- # https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more.
1673
- #
1674
- # @param name [String]
1675
- # Required. The name of the DlpJob resource to be cancelled.
1676
- # @param options [Google::Gax::CallOptions]
1677
- # Overrides the default settings for this call, e.g, timeout,
1678
- # retries, etc.
1679
- # @yield [result, operation] Access the result along with the RPC operation
1680
- # @yieldparam result []
1681
- # @yieldparam operation [GRPC::ActiveCall::Operation]
1682
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1683
- # @example
1684
- # require "google/cloud/dlp"
1685
- #
1686
- # dlp_client = Google::Cloud::Dlp.new(version: :v2)
1687
- # formatted_name = Google::Cloud::Dlp::V2::DlpServiceClient.dlp_job_path("[PROJECT]", "[DLP_JOB]")
1688
- # dlp_client.cancel_dlp_job(formatted_name)
1689
-
1690
- def cancel_dlp_job \
1691
- name,
1692
- options: nil,
1693
- &block
1694
- req = {
1695
- name: name
1696
- }.delete_if { |_, v| v.nil? }
1697
- req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::CancelDlpJobRequest)
1698
- @cancel_dlp_job.call(req, options, &block)
1699
- nil
1700
- end
1701
-
1702
- # Lists job triggers.
1703
- # See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more.
1704
- #
1705
- # @param parent [String]
1706
- # Required. The parent resource name, for example `projects/my-project-id`.
1707
- # @param page_size [Integer]
1708
- # The maximum number of resources contained in the underlying API
1709
- # response. If page streaming is performed per-resource, this
1710
- # parameter does not affect the return value. If page streaming is
1711
- # performed per-page, this determines the maximum number of
1712
- # resources in a page.
1713
- # @param order_by [String]
1714
- # Comma separated list of triggeredJob fields to order by,
1715
- # followed by `asc` or `desc` postfix. This list is case-insensitive,
1716
- # default sorting order is ascending, redundant space characters are
1717
- # insignificant.
1718
- #
1719
- # Example: `name asc,update_time, create_time desc`
1720
- #
1721
- # Supported fields are:
1722
- #
1723
- # * `create_time`: corresponds to time the JobTrigger was created.
1724
- # * `update_time`: corresponds to time the JobTrigger was last updated.
1725
- # * `last_run_time`: corresponds to the last time the JobTrigger ran.
1726
- # * `name`: corresponds to JobTrigger's name.
1727
- # * `display_name`: corresponds to JobTrigger's display name.
1728
- # * `status`: corresponds to JobTrigger's status.
1729
- # @param filter [String]
1730
- # Allows filtering.
1731
- #
1732
- # Supported syntax:
1733
- #
1734
- # * Filter expressions are made up of one or more restrictions.
1735
- # * Restrictions can be combined by `AND` or `OR` logical operators. A
1736
- # sequence of restrictions implicitly uses `AND`.
1737
- # * A restriction has the form of `{field} {operator} {value}`.
1738
- # * Supported fields/values for inspect jobs:
1739
- # * `status` - HEALTHY|PAUSED|CANCELLED
1740
- # * `inspected_storage` - DATASTORE|CLOUD_STORAGE|BIGQUERY
1741
- # * 'last_run_time` - RFC 3339 formatted timestamp, surrounded by
1742
- # quotation marks. Nanoseconds are ignored.
1743
- # * 'error_count' - Number of errors that have occurred while running.
1744
- # * The operator must be `=` or `!=` for status and inspected_storage.
1745
- #
1746
- # Examples:
1747
- #
1748
- # * inspected_storage = cloud_storage AND status = HEALTHY
1749
- # * inspected_storage = cloud_storage OR inspected_storage = bigquery
1750
- # * inspected_storage = cloud_storage AND (state = PAUSED OR state = HEALTHY)
1751
- # * last_run_time > \"2017-12-12T00:00:00+00:00\"
1752
- #
1753
- # The length of this field should be no more than 500 characters.
1754
- # @param location_id [String]
1755
- # The geographic location where job triggers will be retrieved from.
1756
- # Use `-` for all locations. Reserved for future extensions.
1757
- # @param options [Google::Gax::CallOptions]
1758
- # Overrides the default settings for this call, e.g, timeout,
1759
- # retries, etc.
1760
- # @yield [result, operation] Access the result along with the RPC operation
1761
- # @yieldparam result [Google::Gax::PagedEnumerable<Google::Privacy::Dlp::V2::JobTrigger>]
1762
- # @yieldparam operation [GRPC::ActiveCall::Operation]
1763
- # @return [Google::Gax::PagedEnumerable<Google::Privacy::Dlp::V2::JobTrigger>]
1764
- # An enumerable of Google::Privacy::Dlp::V2::JobTrigger instances.
1765
- # See Google::Gax::PagedEnumerable documentation for other
1766
- # operations such as per-page iteration or access to the response
1767
- # object.
1768
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1769
- # @example
1770
- # require "google/cloud/dlp"
1771
- #
1772
- # dlp_client = Google::Cloud::Dlp.new(version: :v2)
1773
- # formatted_parent = Google::Cloud::Dlp::V2::DlpServiceClient.project_path("[PROJECT]")
1774
- #
1775
- # # Iterate over all results.
1776
- # dlp_client.list_job_triggers(formatted_parent).each do |element|
1777
- # # Process element.
1778
- # end
1779
- #
1780
- # # Or iterate over results one page at a time.
1781
- # dlp_client.list_job_triggers(formatted_parent).each_page do |page|
1782
- # # Process each page at a time.
1783
- # page.each do |element|
1784
- # # Process element.
1785
- # end
1786
- # end
1787
-
1788
- def list_job_triggers \
1789
- parent,
1790
- page_size: nil,
1791
- order_by: nil,
1792
- filter: nil,
1793
- location_id: nil,
1794
- options: nil,
1795
- &block
1796
- req = {
1797
- parent: parent,
1798
- page_size: page_size,
1799
- order_by: order_by,
1800
- filter: filter,
1801
- location_id: location_id
1802
- }.delete_if { |_, v| v.nil? }
1803
- req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::ListJobTriggersRequest)
1804
- @list_job_triggers.call(req, options, &block)
1805
- end
1806
-
1807
- # Gets a job trigger.
1808
- # See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more.
1809
- #
1810
- # @param name [String]
1811
- # Required. Resource name of the project and the triggeredJob, for example
1812
- # `projects/dlp-test-project/jobTriggers/53234423`.
1813
- # @param options [Google::Gax::CallOptions]
1814
- # Overrides the default settings for this call, e.g, timeout,
1815
- # retries, etc.
1816
- # @yield [result, operation] Access the result along with the RPC operation
1817
- # @yieldparam result [Google::Privacy::Dlp::V2::JobTrigger]
1818
- # @yieldparam operation [GRPC::ActiveCall::Operation]
1819
- # @return [Google::Privacy::Dlp::V2::JobTrigger]
1820
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1821
- # @example
1822
- # require "google/cloud/dlp"
1823
- #
1824
- # dlp_client = Google::Cloud::Dlp.new(version: :v2)
1825
- # formatted_name = Google::Cloud::Dlp::V2::DlpServiceClient.project_job_trigger_path("[PROJECT]", "[JOB_TRIGGER]")
1826
- # response = dlp_client.get_job_trigger(formatted_name)
1827
-
1828
- def get_job_trigger \
1829
- name,
1830
- options: nil,
1831
- &block
1832
- req = {
1833
- name: name
1834
- }.delete_if { |_, v| v.nil? }
1835
- req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::GetJobTriggerRequest)
1836
- @get_job_trigger.call(req, options, &block)
1837
- end
1838
-
1839
- # Deletes a job trigger.
1840
- # See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more.
1841
- #
1842
- # @param name [String]
1843
- # Required. Resource name of the project and the triggeredJob, for example
1844
- # `projects/dlp-test-project/jobTriggers/53234423`.
1845
- # @param options [Google::Gax::CallOptions]
1846
- # Overrides the default settings for this call, e.g, timeout,
1847
- # retries, etc.
1848
- # @yield [result, operation] Access the result along with the RPC operation
1849
- # @yieldparam result []
1850
- # @yieldparam operation [GRPC::ActiveCall::Operation]
1851
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1852
- # @example
1853
- # require "google/cloud/dlp"
1854
- #
1855
- # dlp_client = Google::Cloud::Dlp.new(version: :v2)
1856
- #
1857
- # # TODO: Initialize `name`:
1858
- # name = ''
1859
- # dlp_client.delete_job_trigger(name)
1860
-
1861
- def delete_job_trigger \
1862
- name,
1863
- options: nil,
1864
- &block
1865
- req = {
1866
- name: name
1867
- }.delete_if { |_, v| v.nil? }
1868
- req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::DeleteJobTriggerRequest)
1869
- @delete_job_trigger.call(req, options, &block)
1870
- nil
1871
- end
1872
-
1873
- # Updates a job trigger.
1874
- # See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more.
1875
- #
1876
- # @param name [String]
1877
- # Required. Resource name of the project and the triggeredJob, for example
1878
- # `projects/dlp-test-project/jobTriggers/53234423`.
1879
- # @param job_trigger [Google::Privacy::Dlp::V2::JobTrigger | Hash]
1880
- # New JobTrigger value.
1881
- # A hash of the same form as `Google::Privacy::Dlp::V2::JobTrigger`
1882
- # can also be provided.
1883
- # @param update_mask [Google::Protobuf::FieldMask | Hash]
1884
- # Mask to control which fields get updated.
1885
- # A hash of the same form as `Google::Protobuf::FieldMask`
1886
- # can also be provided.
1887
- # @param options [Google::Gax::CallOptions]
1888
- # Overrides the default settings for this call, e.g, timeout,
1889
- # retries, etc.
1890
- # @yield [result, operation] Access the result along with the RPC operation
1891
- # @yieldparam result [Google::Privacy::Dlp::V2::JobTrigger]
1892
- # @yieldparam operation [GRPC::ActiveCall::Operation]
1893
- # @return [Google::Privacy::Dlp::V2::JobTrigger]
1894
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1895
- # @example
1896
- # require "google/cloud/dlp"
1897
- #
1898
- # dlp_client = Google::Cloud::Dlp.new(version: :v2)
1899
- # formatted_name = Google::Cloud::Dlp::V2::DlpServiceClient.project_job_trigger_path("[PROJECT]", "[JOB_TRIGGER]")
1900
- # response = dlp_client.update_job_trigger(formatted_name)
1901
-
1902
- def update_job_trigger \
1903
- name,
1904
- job_trigger: nil,
1905
- update_mask: nil,
1906
- options: nil,
1907
- &block
1908
- req = {
1909
- name: name,
1910
- job_trigger: job_trigger,
1911
- update_mask: update_mask
1912
- }.delete_if { |_, v| v.nil? }
1913
- req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::UpdateJobTriggerRequest)
1914
- @update_job_trigger.call(req, options, &block)
1915
- end
1916
-
1917
- # Creates a job trigger to run DLP actions such as scanning storage for
1918
- # sensitive information on a set schedule.
1919
- # See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more.
1920
- #
1921
- # @param parent [String]
1922
- # Required. The parent resource name, for example projects/my-project-id.
1923
- # @param job_trigger [Google::Privacy::Dlp::V2::JobTrigger | Hash]
1924
- # Required. The JobTrigger to create.
1925
- # A hash of the same form as `Google::Privacy::Dlp::V2::JobTrigger`
1926
- # can also be provided.
1927
- # @param trigger_id [String]
1928
- # The trigger id can contain uppercase and lowercase letters,
1929
- # numbers, and hyphens; that is, it must match the regular
1930
- # expression: `[a-zA-Z\\d-_]+`. The maximum length is 100
1931
- # characters. Can be empty to allow the system to generate one.
1932
- # @param location_id [String]
1933
- # The geographic location to store the job trigger. Reserved for
1934
- # future extensions.
1935
- # @param options [Google::Gax::CallOptions]
1936
- # Overrides the default settings for this call, e.g, timeout,
1937
- # retries, etc.
1938
- # @yield [result, operation] Access the result along with the RPC operation
1939
- # @yieldparam result [Google::Privacy::Dlp::V2::JobTrigger]
1940
- # @yieldparam operation [GRPC::ActiveCall::Operation]
1941
- # @return [Google::Privacy::Dlp::V2::JobTrigger]
1942
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1943
- # @example
1944
- # require "google/cloud/dlp"
1945
- #
1946
- # dlp_client = Google::Cloud::Dlp.new(version: :v2)
1947
- # formatted_parent = Google::Cloud::Dlp::V2::DlpServiceClient.project_path("[PROJECT]")
1948
- # response = dlp_client.create_job_trigger(formatted_parent)
1949
-
1950
- def create_job_trigger \
1951
- parent,
1952
- job_trigger: nil,
1953
- trigger_id: nil,
1954
- location_id: nil,
1955
- options: nil,
1956
- &block
1957
- req = {
1958
- parent: parent,
1959
- job_trigger: job_trigger,
1960
- trigger_id: trigger_id,
1961
- location_id: location_id
1962
- }.delete_if { |_, v| v.nil? }
1963
- req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::CreateJobTriggerRequest)
1964
- @create_job_trigger.call(req, options, &block)
1965
- end
1966
-
1967
- # Creates a pre-built stored infoType to be used for inspection.
1968
- # See https://cloud.google.com/dlp/docs/creating-stored-infotypes to
1969
- # learn more.
1970
- #
1971
- # @param parent [String]
1972
- # Required. The parent resource name, for example projects/my-project-id or
1973
- # organizations/my-org-id.
1974
- # @param config [Google::Privacy::Dlp::V2::StoredInfoTypeConfig | Hash]
1975
- # Required. Configuration of the storedInfoType to create.
1976
- # A hash of the same form as `Google::Privacy::Dlp::V2::StoredInfoTypeConfig`
1977
- # can also be provided.
1978
- # @param stored_info_type_id [String]
1979
- # The storedInfoType ID can contain uppercase and lowercase letters,
1980
- # numbers, and hyphens; that is, it must match the regular
1981
- # expression: `[a-zA-Z\\d-_]+`. The maximum length is 100
1982
- # characters. Can be empty to allow the system to generate one.
1983
- # @param location_id [String]
1984
- # The geographic location to store the stored infoType. Reserved for
1985
- # future extensions.
1986
- # @param options [Google::Gax::CallOptions]
1987
- # Overrides the default settings for this call, e.g, timeout,
1988
- # retries, etc.
1989
- # @yield [result, operation] Access the result along with the RPC operation
1990
- # @yieldparam result [Google::Privacy::Dlp::V2::StoredInfoType]
1991
- # @yieldparam operation [GRPC::ActiveCall::Operation]
1992
- # @return [Google::Privacy::Dlp::V2::StoredInfoType]
1993
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1994
- # @example
1995
- # require "google/cloud/dlp"
1996
- #
1997
- # dlp_client = Google::Cloud::Dlp.new(version: :v2)
1998
- # formatted_parent = Google::Cloud::Dlp::V2::DlpServiceClient.organization_path("[ORGANIZATION]")
1999
- # response = dlp_client.create_stored_info_type(formatted_parent)
2000
-
2001
- def create_stored_info_type \
2002
- parent,
2003
- config: nil,
2004
- stored_info_type_id: nil,
2005
- location_id: nil,
2006
- options: nil,
2007
- &block
2008
- req = {
2009
- parent: parent,
2010
- config: config,
2011
- stored_info_type_id: stored_info_type_id,
2012
- location_id: location_id
2013
- }.delete_if { |_, v| v.nil? }
2014
- req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::CreateStoredInfoTypeRequest)
2015
- @create_stored_info_type.call(req, options, &block)
2016
- end
2017
-
2018
- # Updates the stored infoType by creating a new version. The existing version
2019
- # will continue to be used until the new version is ready.
2020
- # See https://cloud.google.com/dlp/docs/creating-stored-infotypes to
2021
- # learn more.
2022
- #
2023
- # @param name [String]
2024
- # Required. Resource name of organization and storedInfoType to be updated, for
2025
- # example `organizations/433245324/storedInfoTypes/432452342` or
2026
- # projects/project-id/storedInfoTypes/432452342.
2027
- # @param config [Google::Privacy::Dlp::V2::StoredInfoTypeConfig | Hash]
2028
- # Updated configuration for the storedInfoType. If not provided, a new
2029
- # version of the storedInfoType will be created with the existing
2030
- # configuration.
2031
- # A hash of the same form as `Google::Privacy::Dlp::V2::StoredInfoTypeConfig`
2032
- # can also be provided.
2033
- # @param update_mask [Google::Protobuf::FieldMask | Hash]
2034
- # Mask to control which fields get updated.
2035
- # A hash of the same form as `Google::Protobuf::FieldMask`
2036
- # can also be provided.
2037
- # @param options [Google::Gax::CallOptions]
2038
- # Overrides the default settings for this call, e.g, timeout,
2039
- # retries, etc.
2040
- # @yield [result, operation] Access the result along with the RPC operation
2041
- # @yieldparam result [Google::Privacy::Dlp::V2::StoredInfoType]
2042
- # @yieldparam operation [GRPC::ActiveCall::Operation]
2043
- # @return [Google::Privacy::Dlp::V2::StoredInfoType]
2044
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
2045
- # @example
2046
- # require "google/cloud/dlp"
2047
- #
2048
- # dlp_client = Google::Cloud::Dlp.new(version: :v2)
2049
- # formatted_name = Google::Cloud::Dlp::V2::DlpServiceClient.organization_stored_info_type_path("[ORGANIZATION]", "[STORED_INFO_TYPE]")
2050
- # response = dlp_client.update_stored_info_type(formatted_name)
2051
-
2052
- def update_stored_info_type \
2053
- name,
2054
- config: nil,
2055
- update_mask: nil,
2056
- options: nil,
2057
- &block
2058
- req = {
2059
- name: name,
2060
- config: config,
2061
- update_mask: update_mask
2062
- }.delete_if { |_, v| v.nil? }
2063
- req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::UpdateStoredInfoTypeRequest)
2064
- @update_stored_info_type.call(req, options, &block)
2065
- end
2066
-
2067
- # Gets a stored infoType.
2068
- # See https://cloud.google.com/dlp/docs/creating-stored-infotypes to
2069
- # learn more.
2070
- #
2071
- # @param name [String]
2072
- # Required. Resource name of the organization and storedInfoType to be read, for
2073
- # example `organizations/433245324/storedInfoTypes/432452342` or
2074
- # projects/project-id/storedInfoTypes/432452342.
2075
- # @param options [Google::Gax::CallOptions]
2076
- # Overrides the default settings for this call, e.g, timeout,
2077
- # retries, etc.
2078
- # @yield [result, operation] Access the result along with the RPC operation
2079
- # @yieldparam result [Google::Privacy::Dlp::V2::StoredInfoType]
2080
- # @yieldparam operation [GRPC::ActiveCall::Operation]
2081
- # @return [Google::Privacy::Dlp::V2::StoredInfoType]
2082
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
2083
- # @example
2084
- # require "google/cloud/dlp"
2085
- #
2086
- # dlp_client = Google::Cloud::Dlp.new(version: :v2)
2087
- # formatted_name = Google::Cloud::Dlp::V2::DlpServiceClient.organization_stored_info_type_path("[ORGANIZATION]", "[STORED_INFO_TYPE]")
2088
- # response = dlp_client.get_stored_info_type(formatted_name)
2089
-
2090
- def get_stored_info_type \
2091
- name,
2092
- options: nil,
2093
- &block
2094
- req = {
2095
- name: name
2096
- }.delete_if { |_, v| v.nil? }
2097
- req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::GetStoredInfoTypeRequest)
2098
- @get_stored_info_type.call(req, options, &block)
2099
- end
2100
-
2101
- # Lists stored infoTypes.
2102
- # See https://cloud.google.com/dlp/docs/creating-stored-infotypes to
2103
- # learn more.
2104
- #
2105
- # @param parent [String]
2106
- # Required. The parent resource name, for example projects/my-project-id or
2107
- # organizations/my-org-id.
2108
- # @param page_size [Integer]
2109
- # The maximum number of resources contained in the underlying API
2110
- # response. If page streaming is performed per-resource, this
2111
- # parameter does not affect the return value. If page streaming is
2112
- # performed per-page, this determines the maximum number of
2113
- # resources in a page.
2114
- # @param order_by [String]
2115
- # Comma separated list of fields to order by,
2116
- # followed by `asc` or `desc` postfix. This list is case-insensitive,
2117
- # default sorting order is ascending, redundant space characters are
2118
- # insignificant.
2119
- #
2120
- # Example: `name asc, display_name, create_time desc`
2121
- #
2122
- # Supported fields are:
2123
- #
2124
- # * `create_time`: corresponds to time the most recent version of the
2125
- # resource was created.
2126
- # * `state`: corresponds to the state of the resource.
2127
- # * `name`: corresponds to resource name.
2128
- # * `display_name`: corresponds to info type's display name.
2129
- # @param location_id [String]
2130
- # The geographic location where stored infoTypes will be retrieved from.
2131
- # Use `-` for all locations. Reserved for future extensions.
2132
- # @param options [Google::Gax::CallOptions]
2133
- # Overrides the default settings for this call, e.g, timeout,
2134
- # retries, etc.
2135
- # @yield [result, operation] Access the result along with the RPC operation
2136
- # @yieldparam result [Google::Gax::PagedEnumerable<Google::Privacy::Dlp::V2::StoredInfoType>]
2137
- # @yieldparam operation [GRPC::ActiveCall::Operation]
2138
- # @return [Google::Gax::PagedEnumerable<Google::Privacy::Dlp::V2::StoredInfoType>]
2139
- # An enumerable of Google::Privacy::Dlp::V2::StoredInfoType instances.
2140
- # See Google::Gax::PagedEnumerable documentation for other
2141
- # operations such as per-page iteration or access to the response
2142
- # object.
2143
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
2144
- # @example
2145
- # require "google/cloud/dlp"
2146
- #
2147
- # dlp_client = Google::Cloud::Dlp.new(version: :v2)
2148
- # formatted_parent = Google::Cloud::Dlp::V2::DlpServiceClient.organization_path("[ORGANIZATION]")
2149
- #
2150
- # # Iterate over all results.
2151
- # dlp_client.list_stored_info_types(formatted_parent).each do |element|
2152
- # # Process element.
2153
- # end
2154
- #
2155
- # # Or iterate over results one page at a time.
2156
- # dlp_client.list_stored_info_types(formatted_parent).each_page do |page|
2157
- # # Process each page at a time.
2158
- # page.each do |element|
2159
- # # Process element.
2160
- # end
2161
- # end
2162
-
2163
- def list_stored_info_types \
2164
- parent,
2165
- page_size: nil,
2166
- order_by: nil,
2167
- location_id: nil,
2168
- options: nil,
2169
- &block
2170
- req = {
2171
- parent: parent,
2172
- page_size: page_size,
2173
- order_by: order_by,
2174
- location_id: location_id
2175
- }.delete_if { |_, v| v.nil? }
2176
- req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::ListStoredInfoTypesRequest)
2177
- @list_stored_info_types.call(req, options, &block)
2178
- end
2179
-
2180
- # Deletes a stored infoType.
2181
- # See https://cloud.google.com/dlp/docs/creating-stored-infotypes to
2182
- # learn more.
2183
- #
2184
- # @param name [String]
2185
- # Required. Resource name of the organization and storedInfoType to be deleted, for
2186
- # example `organizations/433245324/storedInfoTypes/432452342` or
2187
- # projects/project-id/storedInfoTypes/432452342.
2188
- # @param options [Google::Gax::CallOptions]
2189
- # Overrides the default settings for this call, e.g, timeout,
2190
- # retries, etc.
2191
- # @yield [result, operation] Access the result along with the RPC operation
2192
- # @yieldparam result []
2193
- # @yieldparam operation [GRPC::ActiveCall::Operation]
2194
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
2195
- # @example
2196
- # require "google/cloud/dlp"
2197
- #
2198
- # dlp_client = Google::Cloud::Dlp.new(version: :v2)
2199
- # formatted_name = Google::Cloud::Dlp::V2::DlpServiceClient.organization_stored_info_type_path("[ORGANIZATION]", "[STORED_INFO_TYPE]")
2200
- # dlp_client.delete_stored_info_type(formatted_name)
2201
-
2202
- def delete_stored_info_type \
2203
- name,
2204
- options: nil,
2205
- &block
2206
- req = {
2207
- name: name
2208
- }.delete_if { |_, v| v.nil? }
2209
- req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::DeleteStoredInfoTypeRequest)
2210
- @delete_stored_info_type.call(req, options, &block)
2211
- nil
2212
- end
2213
- end
2214
- end
2215
- end
2216
- end
2217
- end