Skip to content

Commit 19c7fda

Browse files
feat: add support for hybrid jobs (via synth) (#10)
This PR was generated using Autosynth. 🌈 <details><summary>Log from Synthtool</summary> ``` 2020-03-17 05:17:27,891 synthtool > Executing /tmpfs/src/git/autosynth/working_repo/synth.py. 2020-03-17 05:17:27,946 synthtool > Ensuring dependencies. 2020-03-17 05:17:27,950 synthtool > Pulling artman image. latest: Pulling from googleapis/artman Digest: sha256:5ef340c8d9334719bc5c6981d95f4a5d2737b0a6a24f2b9a0d430e96fff85c5b Status: Image is up to date for googleapis/artman:latest 2020-03-17 05:17:29,021 synthtool > Cloning googleapis. 2020-03-17 05:17:29,677 synthtool > Running generator for google/privacy/dlp/artman_dlp_v2.yaml. 2020-03-17 05:17:51,539 synthtool > Generated code into /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/python/dlp-v2. 2020-03-17 05:17:51,540 synthtool > Copy: /home/kbuilder/.cache/synthtool/googleapis/google/privacy/dlp/v2/dlp.proto to /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/python/dlp-v2/google/cloud/dlp_v2/proto/dlp.proto 2020-03-17 05:17:51,541 synthtool > Copy: /home/kbuilder/.cache/synthtool/googleapis/google/privacy/dlp/v2/storage.proto to /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/python/dlp-v2/google/cloud/dlp_v2/proto/storage.proto 2020-03-17 05:17:51,541 synthtool > Placed proto files into /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/python/dlp-v2/google/cloud/dlp_v2/proto. 2020-03-17 05:17:51,562 synthtool > Replaced 'google\\.cloud\\.privacy\\.dlp_v2' in google/cloud/dlp_v2/proto/storage_pb2.py. 2020-03-17 05:17:51,567 synthtool > Replaced 'google\\.cloud\\.privacy\\.dlp_v2' in google/cloud/dlp_v2/proto/dlp_pb2.py. 2020-03-17 05:17:51,567 synthtool > Replaced 'google\\.cloud\\.privacy\\.dlp_v2' in google/cloud/dlp_v2/proto/dlp_pb2_grpc.py. 2020-03-17 05:17:51,571 synthtool > Replaced '# Generated by the protocol buffer compiler. DO NOT EDIT!' in google/cloud/dlp_v2/proto/dlp_pb2.py. 2020-03-17 05:17:51,572 synthtool > Replaced 'number regex.*\n(\\s+)latex:.*\n' in google/cloud/dlp_v2/proto/storage_pb2.py. 2020-03-17 05:17:51,573 synthtool > Replaced '(hotword_regex:)\n(\\s+Regular expression.*)\n' in google/cloud/dlp_v2/proto/storage_pb2.py. 2020-03-17 05:17:51,574 synthtool > Replaced '(likelihood_adjustment:)\n' in google/cloud/dlp_v2/proto/storage_pb2.py. 2020-03-17 05:17:51,576 synthtool > No replacements made in google/cloud/dlp_v2/proto/dlp_pb2.py for pattern (max_findings_per_item:) (\s+Max number.*) (\s+scanned. When.*) (\s+maximum returned is 1000.*) (\s+When set within.*) , maybe replacement is no longer needed? 2020-03-17 05:17:51,581 synthtool > Replaced '(max_findings_per_request:)\n(\\s+Max number of.*)\n(\\s+When set .*)\n' in google/cloud/dlp_v2/proto/dlp_pb2.py. 2020-03-17 05:17:51,584 synthtool > Replaced '(max_findings_per_info_type:)\n' in google/cloud/dlp_v2/proto/dlp_pb2.py. 2020-03-17 05:17:51,589 synthtool > Replaced '(snapshot_inspect_template:)\n(\\s+If run with an .*)\n' in google/cloud/dlp_v2/proto/dlp_pb2.py. 2020-03-17 05:17:51,593 synthtool > Replaced '(processed_bytes:)\n' in google/cloud/dlp_v2/proto/dlp_pb2.py. 2020-03-17 05:17:51,597 synthtool > Replaced '(total_estimated_bytes:)\n' in google/cloud/dlp_v2/proto/dlp_pb2.py. 2020-03-17 05:17:51,601 synthtool > Replaced '(info_type_stats:)\n' in google/cloud/dlp_v2/proto/dlp_pb2.py. 2020-03-17 05:17:51,605 synthtool > Replaced '(Statistics of how many instances of each info type were found)\n' in google/cloud/dlp_v2/proto/dlp_pb2.py. 2020-03-17 05:17:51,609 synthtool > Replaced '(requested_options:)\n' in google/cloud/dlp_v2/proto/dlp_pb2.py. 2020-03-17 05:17:51,613 synthtool > Replaced '(sensitive_value_frequency_lower_bound:)\n(\\s+Lower bound.*)\n' in google/cloud/dlp_v2/proto/dlp_pb2.py. 2020-03-17 05:17:51,617 synthtool > Replaced '(sensitive_value_frequency_upper_bound:)\n(\\s+Upper bound.*)\n' in google/cloud/dlp_v2/proto/dlp_pb2.py. 2020-03-17 05:17:51,622 synthtool > Replaced '(bucket_size:)\n(\\s+Total number of equivalence.*)\n' in google/cloud/dlp_v2/proto/dlp_pb2.py. 2020-03-17 05:17:51,626 synthtool > Replaced '(bucket_values:)\n(\\s+Sample of equivalence.*)\n' in google/cloud/dlp_v2/proto/dlp_pb2.py. 2020-03-17 05:17:51,630 synthtool > Replaced '(offset_minutes:)\n(\\s+Set only.*)\n' in google/cloud/dlp_v2/proto/dlp_pb2.py. 2020-03-17 05:17:51,634 synthtool > Replaced '(result:)\n(\\s+A summary of the outcome of this inspect job.)' in google/cloud/dlp_v2/proto/dlp_pb2.py. 2020-03-17 05:17:51,638 synthtool > Replaced '(storage_config:)\n(\\s+The data to scan.\n)' in google/cloud/dlp_v2/proto/dlp_pb2.py. 2020-03-17 05:17:51,642 synthtool > Replaced '(inspect_config:)\n(\\s+How and what to scan for.\n)' in google/cloud/dlp_v2/proto/dlp_pb2.py. 2020-03-17 05:17:51,647 synthtool > Replaced '(inspect_template_name:)\n(\\s+If provided, will be.*)\n(\\s+InspectConfig.*)\n(\\s+values persisted.*)\n(\\s+actions:)\n(\\s+Actions to.*)\n' in google/cloud/dlp_v2/proto/dlp_pb2.py. 2020-03-17 05:17:51,653 synthtool > Replaced ' (\\s+Set of values defining the equivalence class.*)\n (\\s+quasi-identifier.*)\n (\\s+message. The order.*)\n' in google/cloud/dlp_v2/proto/dlp_pb2.py. 2020-03-17 05:17:51,659 synthtool > Replaced ' (\\s+Size of the equivalence class, for example number of rows with)\n (\\s+the above set of values.)\n' in google/cloud/dlp_v2/proto/dlp_pb2.py. 2020-03-17 05:17:51,663 synthtool > Replaced '(equivalence_class_size_lower_bound:)\n(\\s+Lower bound.*)\n' in google/cloud/dlp_v2/proto/dlp_pb2.py. 2020-03-17 05:17:51,668 synthtool > Replaced '(equivalence_class_size_upper_bound:)\n(\\s+Upper bound.*)\n' in google/cloud/dlp_v2/proto/dlp_pb2.py. 2020-03-17 05:17:51,672 synthtool > Replaced '(bucket_value_count:)\n(\\s+Total number of distinct equivalence.*)\n' in google/cloud/dlp_v2/proto/dlp_pb2.py. 2020-03-17 05:17:51,677 synthtool > Replaced '(value_frequency_lower_bound:)\n\\s+(Lower bound.*)\n\\s+(bucket.\n)(\\s+value_frequency_upper.*)\n\\s+(Upper.*)\n\\s+(bucket.\n)(\\s+bucket_size:)\n\\s+(Total.*\n)(\\s+bucket_values:)\n\\s+(Sample of value.*)\n\\s+(of values.*\n)(\\s+bucket_value_count:)\n\\s+(Total number.*\n)' in google/cloud/dlp_v2/proto/dlp_pb2.py. 2020-03-17 05:17:51,684 synthtool > No replacements made in google/cloud/dlp_v2/proto/dlp_pb2.py for pattern (DESCRIPTOR .*_TAGGEDFIELD, \s+__module__.* \s+, \s+__doc__.* )(\s+field:) (\s+Identifies .*) (\s+tag:) (\s+Semantic.*) (\s+determine.*) (\s+reidentifiability.*) (\s+info_type:) (\s+A column.*) (\s+public dataset.*) (\s+available.*) (\s+ages.*) (\s+supported Info.*) (\s+supported.*) (\s+custom_tag:) (\s+A col.*) (\s+user must.*) (\s+statist.*) (\s+\(below.*) (\s+inferred:) (\s+If no semantic.*) , maybe replacement is no longer needed? 2020-03-17 05:17:51,706 synthtool > No replacements made in google/cloud/dlp_v2/proto/dlp_pb2.py for pattern (\s+)__doc__ = """Attributes:, maybe replacement is no longer needed? 2020-03-17 05:17:51,710 synthtool > Replaced '(////////.*)\n\\s+(///////////////\n)' in google/cloud/dlp_v2/proto/dlp_pb2.py. 2020-03-17 05:17:51,713 synthtool > Replaced '^\\s+resource was created.' in google/cloud/dlp_v2/gapic/dlp_service_client.py. 2020-03-17 05:17:51,714 synthtool > Replaced '(\\s+)WHITESPACE \\(int\\).*\n' in google/cloud/dlp_v2/gapic/enums.py. 2020-03-17 05:17:51,716 synthtool > No replacements made in google/cloud/dlp_v2/gapic/enums.py for pattern .*:raw-latex:.* , maybe replacement is no longer needed? .coveragerc .flake8 .github/CONTRIBUTING.md .github/ISSUE_TEMPLATE/bug_report.md .github/ISSUE_TEMPLATE/feature_request.md .github/ISSUE_TEMPLATE/support_request.md .github/PULL_REQUEST_TEMPLATE.md .github/release-please.yml .gitignore .kokoro/build.sh .kokoro/continuous/common.cfg .kokoro/continuous/continuous.cfg .kokoro/docs/common.cfg .kokoro/docs/docs.cfg .kokoro/presubmit/common.cfg .kokoro/presubmit/presubmit.cfg .kokoro/publish-docs.sh .kokoro/release.sh .kokoro/release/common.cfg .kokoro/release/release.cfg .kokoro/trampoline.sh CODE_OF_CONDUCT.md CONTRIBUTING.rst LICENSE MANIFEST.in docs/_static/custom.css docs/_templates/layout.html docs/conf.py.j2 noxfile.py.j2 renovate.json setup.cfg Running session blacken Creating virtual environment (virtualenv) using python3.6 in .nox/blacken pip install black==19.3b0 black docs google tests noxfile.py setup.py reformatted /tmpfs/src/git/autosynth/working_repo/google/cloud/__init__.py reformatted /tmpfs/src/git/autosynth/working_repo/google/__init__.py reformatted /tmpfs/src/git/autosynth/working_repo/google/cloud/dlp.py reformatted /tmpfs/src/git/autosynth/working_repo/google/cloud/dlp_v2/__init__.py reformatted /tmpfs/src/git/autosynth/working_repo/docs/conf.py reformatted /tmpfs/src/git/autosynth/working_repo/google/cloud/dlp_v2/gapic/enums.py reformatted /tmpfs/src/git/autosynth/working_repo/google/cloud/dlp_v2/gapic/dlp_service_client_config.py reformatted /tmpfs/src/git/autosynth/working_repo/google/cloud/dlp_v2/gapic/transports/dlp_service_grpc_transport.py reformatted /tmpfs/src/git/autosynth/working_repo/google/cloud/dlp_v2/proto/dlp_pb2_grpc.py reformatted /tmpfs/src/git/autosynth/working_repo/google/cloud/dlp_v2/proto/storage_pb2_grpc.py reformatted /tmpfs/src/git/autosynth/working_repo/google/cloud/dlp_v2/types.py reformatted /tmpfs/src/git/autosynth/working_repo/noxfile.py reformatted /tmpfs/src/git/autosynth/working_repo/google/cloud/dlp_v2/gapic/dlp_service_client.py reformatted /tmpfs/src/git/autosynth/working_repo/tests/unit/gapic/v2/test_dlp_service_client_v2.py reformatted /tmpfs/src/git/autosynth/working_repo/google/cloud/dlp_v2/proto/storage_pb2.py reformatted /tmpfs/src/git/autosynth/working_repo/google/cloud/dlp_v2/proto/dlp_pb2.py All done! ✨ 🍰 ✨ 16 files reformatted, 6 files left unchanged. Session blacken was successful. 2020-03-17 05:18:12,559 synthtool > Wrote metadata to synth.metadata. ``` </details>
1 parent 9735560 commit 19c7fda

File tree

12 files changed

+3414
-749
lines changed

12 files changed

+3414
-749
lines changed

packages/google-cloud-dlp/google/cloud/dlp_v2/gapic/dlp_service_client.py

+234
Original file line numberDiff line numberDiff line change
@@ -2175,6 +2175,157 @@ def cancel_dlp_job(
21752175
request, retry=retry, timeout=timeout, metadata=metadata
21762176
)
21772177

2178+
def finish_dlp_job(
2179+
self,
2180+
name,
2181+
retry=google.api_core.gapic_v1.method.DEFAULT,
2182+
timeout=google.api_core.gapic_v1.method.DEFAULT,
2183+
metadata=None,
2184+
):
2185+
"""
2186+
Finish a running hybrid DlpJob. Triggers the finalization steps and running
2187+
of any enabled actions that have not yet run.
2188+
Early access feature is in a pre-release state and might change or have
2189+
limited support. For more information, see
2190+
https://cloud.google.com/products#product-launch-stages.
2191+
2192+
Example:
2193+
>>> from google.cloud import dlp_v2
2194+
>>>
2195+
>>> client = dlp_v2.DlpServiceClient()
2196+
>>>
2197+
>>> name = client.dlp_job_path('[PROJECT]', '[DLP_JOB]')
2198+
>>>
2199+
>>> client.finish_dlp_job(name)
2200+
2201+
Args:
2202+
name (str): Required. The name of the DlpJob resource to be cancelled.
2203+
retry (Optional[google.api_core.retry.Retry]): A retry object used
2204+
to retry requests. If ``None`` is specified, requests will
2205+
be retried using a default configuration.
2206+
timeout (Optional[float]): The amount of time, in seconds, to wait
2207+
for the request to complete. Note that if ``retry`` is
2208+
specified, the timeout applies to each individual attempt.
2209+
metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata
2210+
that is provided to the method.
2211+
2212+
Raises:
2213+
google.api_core.exceptions.GoogleAPICallError: If the request
2214+
failed for any reason.
2215+
google.api_core.exceptions.RetryError: If the request failed due
2216+
to a retryable error and retry attempts failed.
2217+
ValueError: If the parameters are invalid.
2218+
"""
2219+
# Wrap the transport method to add retry and timeout logic.
2220+
if "finish_dlp_job" not in self._inner_api_calls:
2221+
self._inner_api_calls[
2222+
"finish_dlp_job"
2223+
] = google.api_core.gapic_v1.method.wrap_method(
2224+
self.transport.finish_dlp_job,
2225+
default_retry=self._method_configs["FinishDlpJob"].retry,
2226+
default_timeout=self._method_configs["FinishDlpJob"].timeout,
2227+
client_info=self._client_info,
2228+
)
2229+
2230+
request = dlp_pb2.FinishDlpJobRequest(name=name)
2231+
if metadata is None:
2232+
metadata = []
2233+
metadata = list(metadata)
2234+
try:
2235+
routing_header = [("name", name)]
2236+
except AttributeError:
2237+
pass
2238+
else:
2239+
routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata(
2240+
routing_header
2241+
)
2242+
metadata.append(routing_metadata)
2243+
2244+
self._inner_api_calls["finish_dlp_job"](
2245+
request, retry=retry, timeout=timeout, metadata=metadata
2246+
)
2247+
2248+
def hybrid_inspect_dlp_job(
2249+
self,
2250+
name,
2251+
hybrid_item=None,
2252+
retry=google.api_core.gapic_v1.method.DEFAULT,
2253+
timeout=google.api_core.gapic_v1.method.DEFAULT,
2254+
metadata=None,
2255+
):
2256+
"""
2257+
Inspect hybrid content and store findings to a job.
2258+
To review the findings inspect the job. Inspection will occur
2259+
asynchronously.
2260+
Early access feature is in a pre-release state and might change or have
2261+
limited support. For more information, see
2262+
https://cloud.google.com/products#product-launch-stages.
2263+
2264+
Example:
2265+
>>> from google.cloud import dlp_v2
2266+
>>>
2267+
>>> client = dlp_v2.DlpServiceClient()
2268+
>>>
2269+
>>> # TODO: Initialize `name`:
2270+
>>> name = ''
2271+
>>>
2272+
>>> response = client.hybrid_inspect_dlp_job(name)
2273+
2274+
Args:
2275+
name (str): Required. Resource name of the job to execute a hybrid inspect on, for
2276+
example ``projects/dlp-test-project/dlpJob/53234423``.
2277+
hybrid_item (Union[dict, ~google.cloud.dlp_v2.types.HybridContentItem]): The item to inspect.
2278+
2279+
If a dict is provided, it must be of the same form as the protobuf
2280+
message :class:`~google.cloud.dlp_v2.types.HybridContentItem`
2281+
retry (Optional[google.api_core.retry.Retry]): A retry object used
2282+
to retry requests. If ``None`` is specified, requests will
2283+
be retried using a default configuration.
2284+
timeout (Optional[float]): The amount of time, in seconds, to wait
2285+
for the request to complete. Note that if ``retry`` is
2286+
specified, the timeout applies to each individual attempt.
2287+
metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata
2288+
that is provided to the method.
2289+
2290+
Returns:
2291+
A :class:`~google.cloud.dlp_v2.types.HybridInspectResponse` instance.
2292+
2293+
Raises:
2294+
google.api_core.exceptions.GoogleAPICallError: If the request
2295+
failed for any reason.
2296+
google.api_core.exceptions.RetryError: If the request failed due
2297+
to a retryable error and retry attempts failed.
2298+
ValueError: If the parameters are invalid.
2299+
"""
2300+
# Wrap the transport method to add retry and timeout logic.
2301+
if "hybrid_inspect_dlp_job" not in self._inner_api_calls:
2302+
self._inner_api_calls[
2303+
"hybrid_inspect_dlp_job"
2304+
] = google.api_core.gapic_v1.method.wrap_method(
2305+
self.transport.hybrid_inspect_dlp_job,
2306+
default_retry=self._method_configs["HybridInspectDlpJob"].retry,
2307+
default_timeout=self._method_configs["HybridInspectDlpJob"].timeout,
2308+
client_info=self._client_info,
2309+
)
2310+
2311+
request = dlp_pb2.HybridInspectDlpJobRequest(name=name, hybrid_item=hybrid_item)
2312+
if metadata is None:
2313+
metadata = []
2314+
metadata = list(metadata)
2315+
try:
2316+
routing_header = [("name", name)]
2317+
except AttributeError:
2318+
pass
2319+
else:
2320+
routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata(
2321+
routing_header
2322+
)
2323+
metadata.append(routing_metadata)
2324+
2325+
return self._inner_api_calls["hybrid_inspect_dlp_job"](
2326+
request, retry=retry, timeout=timeout, metadata=metadata
2327+
)
2328+
21782329
def list_job_triggers(
21792330
self,
21802331
parent,
@@ -2473,6 +2624,89 @@ def delete_job_trigger(
24732624
request, retry=retry, timeout=timeout, metadata=metadata
24742625
)
24752626

2627+
def hybrid_inspect_job_trigger(
2628+
self,
2629+
name,
2630+
hybrid_item=None,
2631+
retry=google.api_core.gapic_v1.method.DEFAULT,
2632+
timeout=google.api_core.gapic_v1.method.DEFAULT,
2633+
metadata=None,
2634+
):
2635+
"""
2636+
Inspect hybrid content and store findings to a trigger. The inspection
2637+
will be processed asynchronously. To review the findings monitor the
2638+
jobs within the trigger.
2639+
Early access feature is in a pre-release state and might change or have
2640+
limited support. For more information, see
2641+
https://cloud.google.com/products#product-launch-stages.
2642+
2643+
Example:
2644+
>>> from google.cloud import dlp_v2
2645+
>>>
2646+
>>> client = dlp_v2.DlpServiceClient()
2647+
>>>
2648+
>>> # TODO: Initialize `name`:
2649+
>>> name = ''
2650+
>>>
2651+
>>> response = client.hybrid_inspect_job_trigger(name)
2652+
2653+
Args:
2654+
name (str): Required. Resource name of the trigger to execute a hybrid inspect on,
2655+
for example ``projects/dlp-test-project/jobTriggers/53234423``.
2656+
hybrid_item (Union[dict, ~google.cloud.dlp_v2.types.HybridContentItem]): The item to inspect.
2657+
2658+
If a dict is provided, it must be of the same form as the protobuf
2659+
message :class:`~google.cloud.dlp_v2.types.HybridContentItem`
2660+
retry (Optional[google.api_core.retry.Retry]): A retry object used
2661+
to retry requests. If ``None`` is specified, requests will
2662+
be retried using a default configuration.
2663+
timeout (Optional[float]): The amount of time, in seconds, to wait
2664+
for the request to complete. Note that if ``retry`` is
2665+
specified, the timeout applies to each individual attempt.
2666+
metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata
2667+
that is provided to the method.
2668+
2669+
Returns:
2670+
A :class:`~google.cloud.dlp_v2.types.HybridInspectResponse` instance.
2671+
2672+
Raises:
2673+
google.api_core.exceptions.GoogleAPICallError: If the request
2674+
failed for any reason.
2675+
google.api_core.exceptions.RetryError: If the request failed due
2676+
to a retryable error and retry attempts failed.
2677+
ValueError: If the parameters are invalid.
2678+
"""
2679+
# Wrap the transport method to add retry and timeout logic.
2680+
if "hybrid_inspect_job_trigger" not in self._inner_api_calls:
2681+
self._inner_api_calls[
2682+
"hybrid_inspect_job_trigger"
2683+
] = google.api_core.gapic_v1.method.wrap_method(
2684+
self.transport.hybrid_inspect_job_trigger,
2685+
default_retry=self._method_configs["HybridInspectJobTrigger"].retry,
2686+
default_timeout=self._method_configs["HybridInspectJobTrigger"].timeout,
2687+
client_info=self._client_info,
2688+
)
2689+
2690+
request = dlp_pb2.HybridInspectJobTriggerRequest(
2691+
name=name, hybrid_item=hybrid_item
2692+
)
2693+
if metadata is None:
2694+
metadata = []
2695+
metadata = list(metadata)
2696+
try:
2697+
routing_header = [("name", name)]
2698+
except AttributeError:
2699+
pass
2700+
else:
2701+
routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata(
2702+
routing_header
2703+
)
2704+
metadata.append(routing_metadata)
2705+
2706+
return self._inner_api_calls["hybrid_inspect_job_trigger"](
2707+
request, retry=retry, timeout=timeout, metadata=metadata
2708+
)
2709+
24762710
def update_job_trigger(
24772711
self,
24782712
name,

packages/google-cloud-dlp/google/cloud/dlp_v2/gapic/dlp_service_client_config.py

+15
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,16 @@
117117
"retry_codes_name": "non_idempotent",
118118
"retry_params_name": "default",
119119
},
120+
"FinishDlpJob": {
121+
"timeout_millis": 300000,
122+
"retry_codes_name": "non_idempotent",
123+
"retry_params_name": "default",
124+
},
125+
"HybridInspectDlpJob": {
126+
"timeout_millis": 300000,
127+
"retry_codes_name": "non_idempotent",
128+
"retry_params_name": "default",
129+
},
120130
"ListJobTriggers": {
121131
"timeout_millis": 300000,
122132
"retry_codes_name": "idempotent",
@@ -132,6 +142,11 @@
132142
"retry_codes_name": "idempotent",
133143
"retry_params_name": "default",
134144
},
145+
"HybridInspectJobTrigger": {
146+
"timeout_millis": 300000,
147+
"retry_codes_name": "non_idempotent",
148+
"retry_params_name": "default",
149+
},
135150
"UpdateJobTrigger": {
136151
"timeout_millis": 300000,
137152
"retry_codes_name": "non_idempotent",

packages/google-cloud-dlp/google/cloud/dlp_v2/gapic/enums.py

+9-2
Original file line numberDiff line numberDiff line change
@@ -338,15 +338,20 @@ class ExclusionType(enum.IntEnum):
338338
class DlpJob(object):
339339
class JobState(enum.IntEnum):
340340
"""
341-
Possible states of a job.
341+
Possible states of a job. New items may be added.
342342
343343
Attributes:
344344
JOB_STATE_UNSPECIFIED (int): Unused.
345345
PENDING (int): The job has not yet started.
346-
RUNNING (int): The job is currently running.
346+
RUNNING (int): The job is currently running. Once a job has finished it will transition
347+
to FAILED or DONE.
347348
DONE (int): The job is no longer running.
348349
CANCELED (int): The job was canceled before it could complete.
349350
FAILED (int): The job had an error and did not complete.
351+
ACTIVE (int): The job is currently accepting findings via hybridInspect.
352+
A hybrid job in ACTIVE state may continue to have findings added to it
353+
through calling of hybridInspect. After the job has finished no more
354+
calls to hybridInspect may be made. ACTIVE jobs can transition to DONE.
350355
"""
351356

352357
JOB_STATE_UNSPECIFIED = 0
@@ -355,6 +360,7 @@ class JobState(enum.IntEnum):
355360
DONE = 3
356361
CANCELED = 4
357362
FAILED = 5
363+
ACTIVE = 6
358364

359365

360366
class JobTrigger(object):
@@ -382,6 +388,7 @@ class OutputStorageConfig(object):
382388
class OutputSchema(enum.IntEnum):
383389
"""
384390
Predefined schemas for storing findings.
391+
Only for use with external storage.
385392
386393
Attributes:
387394
OUTPUT_SCHEMA_UNSPECIFIED (int): Unused.

packages/google-cloud-dlp/google/cloud/dlp_v2/gapic/transports/dlp_service_grpc_transport.py

+53
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,41 @@ def cancel_dlp_job(self):
426426
"""
427427
return self._stubs["dlp_service_stub"].CancelDlpJob
428428

429+
@property
430+
def finish_dlp_job(self):
431+
"""Return the gRPC stub for :meth:`DlpServiceClient.finish_dlp_job`.
432+
433+
Finish a running hybrid DlpJob. Triggers the finalization steps and running
434+
of any enabled actions that have not yet run.
435+
Early access feature is in a pre-release state and might change or have
436+
limited support. For more information, see
437+
https://cloud.google.com/products#product-launch-stages.
438+
439+
Returns:
440+
Callable: A callable which accepts the appropriate
441+
deserialized request object and returns a
442+
deserialized response object.
443+
"""
444+
return self._stubs["dlp_service_stub"].FinishDlpJob
445+
446+
@property
447+
def hybrid_inspect_dlp_job(self):
448+
"""Return the gRPC stub for :meth:`DlpServiceClient.hybrid_inspect_dlp_job`.
449+
450+
Inspect hybrid content and store findings to a job.
451+
To review the findings inspect the job. Inspection will occur
452+
asynchronously.
453+
Early access feature is in a pre-release state and might change or have
454+
limited support. For more information, see
455+
https://cloud.google.com/products#product-launch-stages.
456+
457+
Returns:
458+
Callable: A callable which accepts the appropriate
459+
deserialized request object and returns a
460+
deserialized response object.
461+
"""
462+
return self._stubs["dlp_service_stub"].HybridInspectDlpJob
463+
429464
@property
430465
def list_job_triggers(self):
431466
"""Return the gRPC stub for :meth:`DlpServiceClient.list_job_triggers`.
@@ -468,6 +503,24 @@ def delete_job_trigger(self):
468503
"""
469504
return self._stubs["dlp_service_stub"].DeleteJobTrigger
470505

506+
@property
507+
def hybrid_inspect_job_trigger(self):
508+
"""Return the gRPC stub for :meth:`DlpServiceClient.hybrid_inspect_job_trigger`.
509+
510+
Inspect hybrid content and store findings to a trigger. The inspection
511+
will be processed asynchronously. To review the findings monitor the
512+
jobs within the trigger.
513+
Early access feature is in a pre-release state and might change or have
514+
limited support. For more information, see
515+
https://cloud.google.com/products#product-launch-stages.
516+
517+
Returns:
518+
Callable: A callable which accepts the appropriate
519+
deserialized request object and returns a
520+
deserialized response object.
521+
"""
522+
return self._stubs["dlp_service_stub"].HybridInspectJobTrigger
523+
471524
@property
472525
def update_job_trigger(self):
473526
"""Return the gRPC stub for :meth:`DlpServiceClient.update_job_trigger`.

0 commit comments

Comments
 (0)