1# -*- coding: utf-8 -*- 2# Copyright 2020 Google LLC 3# 4# Licensed under the Apache License, Version 2.0 (the "License"); 5# you may not use this file except in compliance with the License. 6# You may obtain a copy of the License at 7# 8# http://www.apache.org/licenses/LICENSE-2.0 9# 10# Unless required by applicable law or agreed to in writing, software 11# distributed under the License is distributed on an "AS IS" BASIS, 12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13# See the License for the specific language governing permissions and 14# limitations under the License. 15# 16import warnings 17from typing import Callable, Dict, Optional, Sequence, Tuple, Union 18 19from google.api_core import grpc_helpers # type: ignore 20from google.api_core import gapic_v1 # type: ignore 21import google.auth # type: ignore 22from google.auth import credentials as ga_credentials # type: ignore 23from google.auth.transport.grpc import SslCredentials # type: ignore 24 25import grpc # type: ignore 26 27from google.cloud.dlp_v2.types import dlp 28from google.protobuf import empty_pb2 # type: ignore 29from .base import DlpServiceTransport, DEFAULT_CLIENT_INFO 30 31 32class DlpServiceGrpcTransport(DlpServiceTransport): 33 """gRPC backend transport for DlpService. 34 35 The Cloud Data Loss Prevention (DLP) API is a service that 36 allows clients to detect the presence of Personally Identifiable 37 Information (PII) and other privacy-sensitive data in user- 38 supplied, unstructured data streams, like text blocks or images. 39 The service also includes methods for sensitive data redaction 40 and scheduling of data scans on Google Cloud Platform based data 41 sets. 42 To learn more about concepts and find how-to guides see 43 https://cloud.google.com/dlp/docs/. 44 45 This class defines the same methods as the primary client, so the 46 primary client can load the underlying transport implementation 47 and call it. 48 49 It sends protocol buffers over the wire using gRPC (which is built on 50 top of HTTP/2); the ``grpcio`` package must be installed. 51 """ 52 53 _stubs: Dict[str, Callable] 54 55 def __init__( 56 self, 57 *, 58 host: str = "dlp.googleapis.com", 59 credentials: ga_credentials.Credentials = None, 60 credentials_file: str = None, 61 scopes: Sequence[str] = None, 62 channel: grpc.Channel = None, 63 api_mtls_endpoint: str = None, 64 client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, 65 ssl_channel_credentials: grpc.ChannelCredentials = None, 66 client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, 67 quota_project_id: Optional[str] = None, 68 client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, 69 always_use_jwt_access: Optional[bool] = False, 70 ) -> None: 71 """Instantiate the transport. 72 73 Args: 74 host (Optional[str]): 75 The hostname to connect to. 76 credentials (Optional[google.auth.credentials.Credentials]): The 77 authorization credentials to attach to requests. These 78 credentials identify the application to the service; if none 79 are specified, the client will attempt to ascertain the 80 credentials from the environment. 81 This argument is ignored if ``channel`` is provided. 82 credentials_file (Optional[str]): A file with credentials that can 83 be loaded with :func:`google.auth.load_credentials_from_file`. 84 This argument is ignored if ``channel`` is provided. 85 scopes (Optional(Sequence[str])): A list of scopes. This argument is 86 ignored if ``channel`` is provided. 87 channel (Optional[grpc.Channel]): A ``Channel`` instance through 88 which to make calls. 89 api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. 90 If provided, it overrides the ``host`` argument and tries to create 91 a mutual TLS channel with client SSL credentials from 92 ``client_cert_source`` or application default SSL credentials. 93 client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): 94 Deprecated. A callback to provide client SSL certificate bytes and 95 private key bytes, both in PEM format. It is ignored if 96 ``api_mtls_endpoint`` is None. 97 ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials 98 for the grpc channel. It is ignored if ``channel`` is provided. 99 client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]): 100 A callback to provide client certificate bytes and private key bytes, 101 both in PEM format. It is used to configure a mutual TLS channel. It is 102 ignored if ``channel`` or ``ssl_channel_credentials`` is provided. 103 quota_project_id (Optional[str]): An optional project to use for billing 104 and quota. 105 client_info (google.api_core.gapic_v1.client_info.ClientInfo): 106 The client info used to send a user-agent string along with 107 API requests. If ``None``, then default info will be used. 108 Generally, you only need to set this if you're developing 109 your own client library. 110 always_use_jwt_access (Optional[bool]): Whether self signed JWT should 111 be used for service account credentials. 112 113 Raises: 114 google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport 115 creation failed for any reason. 116 google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` 117 and ``credentials_file`` are passed. 118 """ 119 self._grpc_channel = None 120 self._ssl_channel_credentials = ssl_channel_credentials 121 self._stubs: Dict[str, Callable] = {} 122 123 if api_mtls_endpoint: 124 warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) 125 if client_cert_source: 126 warnings.warn("client_cert_source is deprecated", DeprecationWarning) 127 128 if channel: 129 # Ignore credentials if a channel was passed. 130 credentials = False 131 # If a channel was explicitly provided, set it. 132 self._grpc_channel = channel 133 self._ssl_channel_credentials = None 134 135 else: 136 if api_mtls_endpoint: 137 host = api_mtls_endpoint 138 139 # Create SSL credentials with client_cert_source or application 140 # default SSL credentials. 141 if client_cert_source: 142 cert, key = client_cert_source() 143 self._ssl_channel_credentials = grpc.ssl_channel_credentials( 144 certificate_chain=cert, private_key=key 145 ) 146 else: 147 self._ssl_channel_credentials = SslCredentials().ssl_credentials 148 149 else: 150 if client_cert_source_for_mtls and not ssl_channel_credentials: 151 cert, key = client_cert_source_for_mtls() 152 self._ssl_channel_credentials = grpc.ssl_channel_credentials( 153 certificate_chain=cert, private_key=key 154 ) 155 156 # The base transport sets the host, credentials and scopes 157 super().__init__( 158 host=host, 159 credentials=credentials, 160 credentials_file=credentials_file, 161 scopes=scopes, 162 quota_project_id=quota_project_id, 163 client_info=client_info, 164 always_use_jwt_access=always_use_jwt_access, 165 ) 166 167 if not self._grpc_channel: 168 self._grpc_channel = type(self).create_channel( 169 self._host, 170 credentials=self._credentials, 171 credentials_file=credentials_file, 172 scopes=self._scopes, 173 ssl_credentials=self._ssl_channel_credentials, 174 quota_project_id=quota_project_id, 175 options=[ 176 ("grpc.max_send_message_length", -1), 177 ("grpc.max_receive_message_length", -1), 178 ], 179 ) 180 181 # Wrap messages. This must be done after self._grpc_channel exists 182 self._prep_wrapped_messages(client_info) 183 184 @classmethod 185 def create_channel( 186 cls, 187 host: str = "dlp.googleapis.com", 188 credentials: ga_credentials.Credentials = None, 189 credentials_file: str = None, 190 scopes: Optional[Sequence[str]] = None, 191 quota_project_id: Optional[str] = None, 192 **kwargs, 193 ) -> grpc.Channel: 194 """Create and return a gRPC channel object. 195 Args: 196 host (Optional[str]): The host for the channel to use. 197 credentials (Optional[~.Credentials]): The 198 authorization credentials to attach to requests. These 199 credentials identify this application to the service. If 200 none are specified, the client will attempt to ascertain 201 the credentials from the environment. 202 credentials_file (Optional[str]): A file with credentials that can 203 be loaded with :func:`google.auth.load_credentials_from_file`. 204 This argument is mutually exclusive with credentials. 205 scopes (Optional[Sequence[str]]): A optional list of scopes needed for this 206 service. These are only used when credentials are not specified and 207 are passed to :func:`google.auth.default`. 208 quota_project_id (Optional[str]): An optional project to use for billing 209 and quota. 210 kwargs (Optional[dict]): Keyword arguments, which are passed to the 211 channel creation. 212 Returns: 213 grpc.Channel: A gRPC channel object. 214 215 Raises: 216 google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` 217 and ``credentials_file`` are passed. 218 """ 219 220 return grpc_helpers.create_channel( 221 host, 222 credentials=credentials, 223 credentials_file=credentials_file, 224 quota_project_id=quota_project_id, 225 default_scopes=cls.AUTH_SCOPES, 226 scopes=scopes, 227 default_host=cls.DEFAULT_HOST, 228 **kwargs, 229 ) 230 231 @property 232 def grpc_channel(self) -> grpc.Channel: 233 """Return the channel designed to connect to this service. 234 """ 235 return self._grpc_channel 236 237 @property 238 def inspect_content( 239 self, 240 ) -> Callable[[dlp.InspectContentRequest], dlp.InspectContentResponse]: 241 r"""Return a callable for the inspect content method over gRPC. 242 243 Finds potentially sensitive info in content. 244 This method has limits on input size, processing time, 245 and output size. 246 When no InfoTypes or CustomInfoTypes are specified in 247 this request, the system will automatically choose what 248 detectors to run. By default this may be all types, but 249 may change over time as detectors are updated. 250 For how to guides, see 251 https://cloud.google.com/dlp/docs/inspecting-images and 252 https://cloud.google.com/dlp/docs/inspecting-text, 253 254 Returns: 255 Callable[[~.InspectContentRequest], 256 ~.InspectContentResponse]: 257 A function that, when called, will call the underlying RPC 258 on the server. 259 """ 260 # Generate a "stub function" on-the-fly which will actually make 261 # the request. 262 # gRPC handles serialization and deserialization, so we just need 263 # to pass in the functions for each. 264 if "inspect_content" not in self._stubs: 265 self._stubs["inspect_content"] = self.grpc_channel.unary_unary( 266 "/google.privacy.dlp.v2.DlpService/InspectContent", 267 request_serializer=dlp.InspectContentRequest.serialize, 268 response_deserializer=dlp.InspectContentResponse.deserialize, 269 ) 270 return self._stubs["inspect_content"] 271 272 @property 273 def redact_image( 274 self, 275 ) -> Callable[[dlp.RedactImageRequest], dlp.RedactImageResponse]: 276 r"""Return a callable for the redact image method over gRPC. 277 278 Redacts potentially sensitive info from an image. 279 This method has limits on input size, processing time, 280 and output size. See 281 https://cloud.google.com/dlp/docs/redacting-sensitive- 282 data-images to learn more. 283 284 When no InfoTypes or CustomInfoTypes are specified in 285 this request, the system will automatically choose what 286 detectors to run. By default this may be all types, but 287 may change over time as detectors are updated. 288 289 Returns: 290 Callable[[~.RedactImageRequest], 291 ~.RedactImageResponse]: 292 A function that, when called, will call the underlying RPC 293 on the server. 294 """ 295 # Generate a "stub function" on-the-fly which will actually make 296 # the request. 297 # gRPC handles serialization and deserialization, so we just need 298 # to pass in the functions for each. 299 if "redact_image" not in self._stubs: 300 self._stubs["redact_image"] = self.grpc_channel.unary_unary( 301 "/google.privacy.dlp.v2.DlpService/RedactImage", 302 request_serializer=dlp.RedactImageRequest.serialize, 303 response_deserializer=dlp.RedactImageResponse.deserialize, 304 ) 305 return self._stubs["redact_image"] 306 307 @property 308 def deidentify_content( 309 self, 310 ) -> Callable[[dlp.DeidentifyContentRequest], dlp.DeidentifyContentResponse]: 311 r"""Return a callable for the deidentify content method over gRPC. 312 313 De-identifies potentially sensitive info from a 314 ContentItem. This method has limits on input size and 315 output size. See 316 https://cloud.google.com/dlp/docs/deidentify-sensitive- 317 data to learn more. 318 319 When no InfoTypes or CustomInfoTypes are specified in 320 this request, the system will automatically choose what 321 detectors to run. By default this may be all types, but 322 may change over time as detectors are updated. 323 324 Returns: 325 Callable[[~.DeidentifyContentRequest], 326 ~.DeidentifyContentResponse]: 327 A function that, when called, will call the underlying RPC 328 on the server. 329 """ 330 # Generate a "stub function" on-the-fly which will actually make 331 # the request. 332 # gRPC handles serialization and deserialization, so we just need 333 # to pass in the functions for each. 334 if "deidentify_content" not in self._stubs: 335 self._stubs["deidentify_content"] = self.grpc_channel.unary_unary( 336 "/google.privacy.dlp.v2.DlpService/DeidentifyContent", 337 request_serializer=dlp.DeidentifyContentRequest.serialize, 338 response_deserializer=dlp.DeidentifyContentResponse.deserialize, 339 ) 340 return self._stubs["deidentify_content"] 341 342 @property 343 def reidentify_content( 344 self, 345 ) -> Callable[[dlp.ReidentifyContentRequest], dlp.ReidentifyContentResponse]: 346 r"""Return a callable for the reidentify content method over gRPC. 347 348 Re-identifies content that has been de-identified. See 349 https://cloud.google.com/dlp/docs/pseudonymization#re-identification_in_free_text_code_example 350 to learn more. 351 352 Returns: 353 Callable[[~.ReidentifyContentRequest], 354 ~.ReidentifyContentResponse]: 355 A function that, when called, will call the underlying RPC 356 on the server. 357 """ 358 # Generate a "stub function" on-the-fly which will actually make 359 # the request. 360 # gRPC handles serialization and deserialization, so we just need 361 # to pass in the functions for each. 362 if "reidentify_content" not in self._stubs: 363 self._stubs["reidentify_content"] = self.grpc_channel.unary_unary( 364 "/google.privacy.dlp.v2.DlpService/ReidentifyContent", 365 request_serializer=dlp.ReidentifyContentRequest.serialize, 366 response_deserializer=dlp.ReidentifyContentResponse.deserialize, 367 ) 368 return self._stubs["reidentify_content"] 369 370 @property 371 def list_info_types( 372 self, 373 ) -> Callable[[dlp.ListInfoTypesRequest], dlp.ListInfoTypesResponse]: 374 r"""Return a callable for the list info types method over gRPC. 375 376 Returns a list of the sensitive information types 377 that the DLP API supports. See 378 https://cloud.google.com/dlp/docs/infotypes-reference to 379 learn more. 380 381 Returns: 382 Callable[[~.ListInfoTypesRequest], 383 ~.ListInfoTypesResponse]: 384 A function that, when called, will call the underlying RPC 385 on the server. 386 """ 387 # Generate a "stub function" on-the-fly which will actually make 388 # the request. 389 # gRPC handles serialization and deserialization, so we just need 390 # to pass in the functions for each. 391 if "list_info_types" not in self._stubs: 392 self._stubs["list_info_types"] = self.grpc_channel.unary_unary( 393 "/google.privacy.dlp.v2.DlpService/ListInfoTypes", 394 request_serializer=dlp.ListInfoTypesRequest.serialize, 395 response_deserializer=dlp.ListInfoTypesResponse.deserialize, 396 ) 397 return self._stubs["list_info_types"] 398 399 @property 400 def create_inspect_template( 401 self, 402 ) -> Callable[[dlp.CreateInspectTemplateRequest], dlp.InspectTemplate]: 403 r"""Return a callable for the create inspect template method over gRPC. 404 405 Creates an InspectTemplate for re-using frequently 406 used configuration for inspecting content, images, and 407 storage. See https://cloud.google.com/dlp/docs/creating- 408 templates to learn more. 409 410 Returns: 411 Callable[[~.CreateInspectTemplateRequest], 412 ~.InspectTemplate]: 413 A function that, when called, will call the underlying RPC 414 on the server. 415 """ 416 # Generate a "stub function" on-the-fly which will actually make 417 # the request. 418 # gRPC handles serialization and deserialization, so we just need 419 # to pass in the functions for each. 420 if "create_inspect_template" not in self._stubs: 421 self._stubs["create_inspect_template"] = self.grpc_channel.unary_unary( 422 "/google.privacy.dlp.v2.DlpService/CreateInspectTemplate", 423 request_serializer=dlp.CreateInspectTemplateRequest.serialize, 424 response_deserializer=dlp.InspectTemplate.deserialize, 425 ) 426 return self._stubs["create_inspect_template"] 427 428 @property 429 def update_inspect_template( 430 self, 431 ) -> Callable[[dlp.UpdateInspectTemplateRequest], dlp.InspectTemplate]: 432 r"""Return a callable for the update inspect template method over gRPC. 433 434 Updates the InspectTemplate. 435 See https://cloud.google.com/dlp/docs/creating-templates 436 to learn more. 437 438 Returns: 439 Callable[[~.UpdateInspectTemplateRequest], 440 ~.InspectTemplate]: 441 A function that, when called, will call the underlying RPC 442 on the server. 443 """ 444 # Generate a "stub function" on-the-fly which will actually make 445 # the request. 446 # gRPC handles serialization and deserialization, so we just need 447 # to pass in the functions for each. 448 if "update_inspect_template" not in self._stubs: 449 self._stubs["update_inspect_template"] = self.grpc_channel.unary_unary( 450 "/google.privacy.dlp.v2.DlpService/UpdateInspectTemplate", 451 request_serializer=dlp.UpdateInspectTemplateRequest.serialize, 452 response_deserializer=dlp.InspectTemplate.deserialize, 453 ) 454 return self._stubs["update_inspect_template"] 455 456 @property 457 def get_inspect_template( 458 self, 459 ) -> Callable[[dlp.GetInspectTemplateRequest], dlp.InspectTemplate]: 460 r"""Return a callable for the get inspect template method over gRPC. 461 462 Gets an InspectTemplate. 463 See https://cloud.google.com/dlp/docs/creating-templates 464 to learn more. 465 466 Returns: 467 Callable[[~.GetInspectTemplateRequest], 468 ~.InspectTemplate]: 469 A function that, when called, will call the underlying RPC 470 on the server. 471 """ 472 # Generate a "stub function" on-the-fly which will actually make 473 # the request. 474 # gRPC handles serialization and deserialization, so we just need 475 # to pass in the functions for each. 476 if "get_inspect_template" not in self._stubs: 477 self._stubs["get_inspect_template"] = self.grpc_channel.unary_unary( 478 "/google.privacy.dlp.v2.DlpService/GetInspectTemplate", 479 request_serializer=dlp.GetInspectTemplateRequest.serialize, 480 response_deserializer=dlp.InspectTemplate.deserialize, 481 ) 482 return self._stubs["get_inspect_template"] 483 484 @property 485 def list_inspect_templates( 486 self, 487 ) -> Callable[[dlp.ListInspectTemplatesRequest], dlp.ListInspectTemplatesResponse]: 488 r"""Return a callable for the list inspect templates method over gRPC. 489 490 Lists InspectTemplates. 491 See https://cloud.google.com/dlp/docs/creating-templates 492 to learn more. 493 494 Returns: 495 Callable[[~.ListInspectTemplatesRequest], 496 ~.ListInspectTemplatesResponse]: 497 A function that, when called, will call the underlying RPC 498 on the server. 499 """ 500 # Generate a "stub function" on-the-fly which will actually make 501 # the request. 502 # gRPC handles serialization and deserialization, so we just need 503 # to pass in the functions for each. 504 if "list_inspect_templates" not in self._stubs: 505 self._stubs["list_inspect_templates"] = self.grpc_channel.unary_unary( 506 "/google.privacy.dlp.v2.DlpService/ListInspectTemplates", 507 request_serializer=dlp.ListInspectTemplatesRequest.serialize, 508 response_deserializer=dlp.ListInspectTemplatesResponse.deserialize, 509 ) 510 return self._stubs["list_inspect_templates"] 511 512 @property 513 def delete_inspect_template( 514 self, 515 ) -> Callable[[dlp.DeleteInspectTemplateRequest], empty_pb2.Empty]: 516 r"""Return a callable for the delete inspect template method over gRPC. 517 518 Deletes an InspectTemplate. 519 See https://cloud.google.com/dlp/docs/creating-templates 520 to learn more. 521 522 Returns: 523 Callable[[~.DeleteInspectTemplateRequest], 524 ~.Empty]: 525 A function that, when called, will call the underlying RPC 526 on the server. 527 """ 528 # Generate a "stub function" on-the-fly which will actually make 529 # the request. 530 # gRPC handles serialization and deserialization, so we just need 531 # to pass in the functions for each. 532 if "delete_inspect_template" not in self._stubs: 533 self._stubs["delete_inspect_template"] = self.grpc_channel.unary_unary( 534 "/google.privacy.dlp.v2.DlpService/DeleteInspectTemplate", 535 request_serializer=dlp.DeleteInspectTemplateRequest.serialize, 536 response_deserializer=empty_pb2.Empty.FromString, 537 ) 538 return self._stubs["delete_inspect_template"] 539 540 @property 541 def create_deidentify_template( 542 self, 543 ) -> Callable[[dlp.CreateDeidentifyTemplateRequest], dlp.DeidentifyTemplate]: 544 r"""Return a callable for the create deidentify template method over gRPC. 545 546 Creates a DeidentifyTemplate for re-using frequently 547 used configuration for de-identifying content, images, 548 and storage. See 549 https://cloud.google.com/dlp/docs/creating-templates- 550 deid to learn more. 551 552 Returns: 553 Callable[[~.CreateDeidentifyTemplateRequest], 554 ~.DeidentifyTemplate]: 555 A function that, when called, will call the underlying RPC 556 on the server. 557 """ 558 # Generate a "stub function" on-the-fly which will actually make 559 # the request. 560 # gRPC handles serialization and deserialization, so we just need 561 # to pass in the functions for each. 562 if "create_deidentify_template" not in self._stubs: 563 self._stubs["create_deidentify_template"] = self.grpc_channel.unary_unary( 564 "/google.privacy.dlp.v2.DlpService/CreateDeidentifyTemplate", 565 request_serializer=dlp.CreateDeidentifyTemplateRequest.serialize, 566 response_deserializer=dlp.DeidentifyTemplate.deserialize, 567 ) 568 return self._stubs["create_deidentify_template"] 569 570 @property 571 def update_deidentify_template( 572 self, 573 ) -> Callable[[dlp.UpdateDeidentifyTemplateRequest], dlp.DeidentifyTemplate]: 574 r"""Return a callable for the update deidentify template method over gRPC. 575 576 Updates the DeidentifyTemplate. 577 See https://cloud.google.com/dlp/docs/creating- 578 templates-deid to learn more. 579 580 Returns: 581 Callable[[~.UpdateDeidentifyTemplateRequest], 582 ~.DeidentifyTemplate]: 583 A function that, when called, will call the underlying RPC 584 on the server. 585 """ 586 # Generate a "stub function" on-the-fly which will actually make 587 # the request. 588 # gRPC handles serialization and deserialization, so we just need 589 # to pass in the functions for each. 590 if "update_deidentify_template" not in self._stubs: 591 self._stubs["update_deidentify_template"] = self.grpc_channel.unary_unary( 592 "/google.privacy.dlp.v2.DlpService/UpdateDeidentifyTemplate", 593 request_serializer=dlp.UpdateDeidentifyTemplateRequest.serialize, 594 response_deserializer=dlp.DeidentifyTemplate.deserialize, 595 ) 596 return self._stubs["update_deidentify_template"] 597 598 @property 599 def get_deidentify_template( 600 self, 601 ) -> Callable[[dlp.GetDeidentifyTemplateRequest], dlp.DeidentifyTemplate]: 602 r"""Return a callable for the get deidentify template method over gRPC. 603 604 Gets a DeidentifyTemplate. 605 See https://cloud.google.com/dlp/docs/creating- 606 templates-deid to learn more. 607 608 Returns: 609 Callable[[~.GetDeidentifyTemplateRequest], 610 ~.DeidentifyTemplate]: 611 A function that, when called, will call the underlying RPC 612 on the server. 613 """ 614 # Generate a "stub function" on-the-fly which will actually make 615 # the request. 616 # gRPC handles serialization and deserialization, so we just need 617 # to pass in the functions for each. 618 if "get_deidentify_template" not in self._stubs: 619 self._stubs["get_deidentify_template"] = self.grpc_channel.unary_unary( 620 "/google.privacy.dlp.v2.DlpService/GetDeidentifyTemplate", 621 request_serializer=dlp.GetDeidentifyTemplateRequest.serialize, 622 response_deserializer=dlp.DeidentifyTemplate.deserialize, 623 ) 624 return self._stubs["get_deidentify_template"] 625 626 @property 627 def list_deidentify_templates( 628 self, 629 ) -> Callable[ 630 [dlp.ListDeidentifyTemplatesRequest], dlp.ListDeidentifyTemplatesResponse 631 ]: 632 r"""Return a callable for the list deidentify templates method over gRPC. 633 634 Lists DeidentifyTemplates. 635 See https://cloud.google.com/dlp/docs/creating- 636 templates-deid to learn more. 637 638 Returns: 639 Callable[[~.ListDeidentifyTemplatesRequest], 640 ~.ListDeidentifyTemplatesResponse]: 641 A function that, when called, will call the underlying RPC 642 on the server. 643 """ 644 # Generate a "stub function" on-the-fly which will actually make 645 # the request. 646 # gRPC handles serialization and deserialization, so we just need 647 # to pass in the functions for each. 648 if "list_deidentify_templates" not in self._stubs: 649 self._stubs["list_deidentify_templates"] = self.grpc_channel.unary_unary( 650 "/google.privacy.dlp.v2.DlpService/ListDeidentifyTemplates", 651 request_serializer=dlp.ListDeidentifyTemplatesRequest.serialize, 652 response_deserializer=dlp.ListDeidentifyTemplatesResponse.deserialize, 653 ) 654 return self._stubs["list_deidentify_templates"] 655 656 @property 657 def delete_deidentify_template( 658 self, 659 ) -> Callable[[dlp.DeleteDeidentifyTemplateRequest], empty_pb2.Empty]: 660 r"""Return a callable for the delete deidentify template method over gRPC. 661 662 Deletes a DeidentifyTemplate. 663 See https://cloud.google.com/dlp/docs/creating- 664 templates-deid to learn more. 665 666 Returns: 667 Callable[[~.DeleteDeidentifyTemplateRequest], 668 ~.Empty]: 669 A function that, when called, will call the underlying RPC 670 on the server. 671 """ 672 # Generate a "stub function" on-the-fly which will actually make 673 # the request. 674 # gRPC handles serialization and deserialization, so we just need 675 # to pass in the functions for each. 676 if "delete_deidentify_template" not in self._stubs: 677 self._stubs["delete_deidentify_template"] = self.grpc_channel.unary_unary( 678 "/google.privacy.dlp.v2.DlpService/DeleteDeidentifyTemplate", 679 request_serializer=dlp.DeleteDeidentifyTemplateRequest.serialize, 680 response_deserializer=empty_pb2.Empty.FromString, 681 ) 682 return self._stubs["delete_deidentify_template"] 683 684 @property 685 def create_job_trigger( 686 self, 687 ) -> Callable[[dlp.CreateJobTriggerRequest], dlp.JobTrigger]: 688 r"""Return a callable for the create job trigger method over gRPC. 689 690 Creates a job trigger to run DLP actions such as 691 scanning storage for sensitive information on a set 692 schedule. See 693 https://cloud.google.com/dlp/docs/creating-job-triggers 694 to learn more. 695 696 Returns: 697 Callable[[~.CreateJobTriggerRequest], 698 ~.JobTrigger]: 699 A function that, when called, will call the underlying RPC 700 on the server. 701 """ 702 # Generate a "stub function" on-the-fly which will actually make 703 # the request. 704 # gRPC handles serialization and deserialization, so we just need 705 # to pass in the functions for each. 706 if "create_job_trigger" not in self._stubs: 707 self._stubs["create_job_trigger"] = self.grpc_channel.unary_unary( 708 "/google.privacy.dlp.v2.DlpService/CreateJobTrigger", 709 request_serializer=dlp.CreateJobTriggerRequest.serialize, 710 response_deserializer=dlp.JobTrigger.deserialize, 711 ) 712 return self._stubs["create_job_trigger"] 713 714 @property 715 def update_job_trigger( 716 self, 717 ) -> Callable[[dlp.UpdateJobTriggerRequest], dlp.JobTrigger]: 718 r"""Return a callable for the update job trigger method over gRPC. 719 720 Updates a job trigger. 721 See https://cloud.google.com/dlp/docs/creating-job- 722 triggers to learn more. 723 724 Returns: 725 Callable[[~.UpdateJobTriggerRequest], 726 ~.JobTrigger]: 727 A function that, when called, will call the underlying RPC 728 on the server. 729 """ 730 # Generate a "stub function" on-the-fly which will actually make 731 # the request. 732 # gRPC handles serialization and deserialization, so we just need 733 # to pass in the functions for each. 734 if "update_job_trigger" not in self._stubs: 735 self._stubs["update_job_trigger"] = self.grpc_channel.unary_unary( 736 "/google.privacy.dlp.v2.DlpService/UpdateJobTrigger", 737 request_serializer=dlp.UpdateJobTriggerRequest.serialize, 738 response_deserializer=dlp.JobTrigger.deserialize, 739 ) 740 return self._stubs["update_job_trigger"] 741 742 @property 743 def hybrid_inspect_job_trigger( 744 self, 745 ) -> Callable[[dlp.HybridInspectJobTriggerRequest], dlp.HybridInspectResponse]: 746 r"""Return a callable for the hybrid inspect job trigger method over gRPC. 747 748 Inspect hybrid content and store findings to a 749 trigger. The inspection will be processed 750 asynchronously. To review the findings monitor the jobs 751 within the trigger. 752 Early access feature is in a pre-release state and might 753 change or have limited support. For more information, 754 see 755 https://cloud.google.com/products#product-launch-stages. 756 757 Returns: 758 Callable[[~.HybridInspectJobTriggerRequest], 759 ~.HybridInspectResponse]: 760 A function that, when called, will call the underlying RPC 761 on the server. 762 """ 763 # Generate a "stub function" on-the-fly which will actually make 764 # the request. 765 # gRPC handles serialization and deserialization, so we just need 766 # to pass in the functions for each. 767 if "hybrid_inspect_job_trigger" not in self._stubs: 768 self._stubs["hybrid_inspect_job_trigger"] = self.grpc_channel.unary_unary( 769 "/google.privacy.dlp.v2.DlpService/HybridInspectJobTrigger", 770 request_serializer=dlp.HybridInspectJobTriggerRequest.serialize, 771 response_deserializer=dlp.HybridInspectResponse.deserialize, 772 ) 773 return self._stubs["hybrid_inspect_job_trigger"] 774 775 @property 776 def get_job_trigger(self) -> Callable[[dlp.GetJobTriggerRequest], dlp.JobTrigger]: 777 r"""Return a callable for the get job trigger method over gRPC. 778 779 Gets a job trigger. 780 See https://cloud.google.com/dlp/docs/creating-job- 781 triggers to learn more. 782 783 Returns: 784 Callable[[~.GetJobTriggerRequest], 785 ~.JobTrigger]: 786 A function that, when called, will call the underlying RPC 787 on the server. 788 """ 789 # Generate a "stub function" on-the-fly which will actually make 790 # the request. 791 # gRPC handles serialization and deserialization, so we just need 792 # to pass in the functions for each. 793 if "get_job_trigger" not in self._stubs: 794 self._stubs["get_job_trigger"] = self.grpc_channel.unary_unary( 795 "/google.privacy.dlp.v2.DlpService/GetJobTrigger", 796 request_serializer=dlp.GetJobTriggerRequest.serialize, 797 response_deserializer=dlp.JobTrigger.deserialize, 798 ) 799 return self._stubs["get_job_trigger"] 800 801 @property 802 def list_job_triggers( 803 self, 804 ) -> Callable[[dlp.ListJobTriggersRequest], dlp.ListJobTriggersResponse]: 805 r"""Return a callable for the list job triggers method over gRPC. 806 807 Lists job triggers. 808 See https://cloud.google.com/dlp/docs/creating-job- 809 triggers to learn more. 810 811 Returns: 812 Callable[[~.ListJobTriggersRequest], 813 ~.ListJobTriggersResponse]: 814 A function that, when called, will call the underlying RPC 815 on the server. 816 """ 817 # Generate a "stub function" on-the-fly which will actually make 818 # the request. 819 # gRPC handles serialization and deserialization, so we just need 820 # to pass in the functions for each. 821 if "list_job_triggers" not in self._stubs: 822 self._stubs["list_job_triggers"] = self.grpc_channel.unary_unary( 823 "/google.privacy.dlp.v2.DlpService/ListJobTriggers", 824 request_serializer=dlp.ListJobTriggersRequest.serialize, 825 response_deserializer=dlp.ListJobTriggersResponse.deserialize, 826 ) 827 return self._stubs["list_job_triggers"] 828 829 @property 830 def delete_job_trigger( 831 self, 832 ) -> Callable[[dlp.DeleteJobTriggerRequest], empty_pb2.Empty]: 833 r"""Return a callable for the delete job trigger method over gRPC. 834 835 Deletes a job trigger. 836 See https://cloud.google.com/dlp/docs/creating-job- 837 triggers to learn more. 838 839 Returns: 840 Callable[[~.DeleteJobTriggerRequest], 841 ~.Empty]: 842 A function that, when called, will call the underlying RPC 843 on the server. 844 """ 845 # Generate a "stub function" on-the-fly which will actually make 846 # the request. 847 # gRPC handles serialization and deserialization, so we just need 848 # to pass in the functions for each. 849 if "delete_job_trigger" not in self._stubs: 850 self._stubs["delete_job_trigger"] = self.grpc_channel.unary_unary( 851 "/google.privacy.dlp.v2.DlpService/DeleteJobTrigger", 852 request_serializer=dlp.DeleteJobTriggerRequest.serialize, 853 response_deserializer=empty_pb2.Empty.FromString, 854 ) 855 return self._stubs["delete_job_trigger"] 856 857 @property 858 def activate_job_trigger( 859 self, 860 ) -> Callable[[dlp.ActivateJobTriggerRequest], dlp.DlpJob]: 861 r"""Return a callable for the activate job trigger method over gRPC. 862 863 Activate a job trigger. Causes the immediate execute 864 of a trigger instead of waiting on the trigger event to 865 occur. 866 867 Returns: 868 Callable[[~.ActivateJobTriggerRequest], 869 ~.DlpJob]: 870 A function that, when called, will call the underlying RPC 871 on the server. 872 """ 873 # Generate a "stub function" on-the-fly which will actually make 874 # the request. 875 # gRPC handles serialization and deserialization, so we just need 876 # to pass in the functions for each. 877 if "activate_job_trigger" not in self._stubs: 878 self._stubs["activate_job_trigger"] = self.grpc_channel.unary_unary( 879 "/google.privacy.dlp.v2.DlpService/ActivateJobTrigger", 880 request_serializer=dlp.ActivateJobTriggerRequest.serialize, 881 response_deserializer=dlp.DlpJob.deserialize, 882 ) 883 return self._stubs["activate_job_trigger"] 884 885 @property 886 def create_dlp_job(self) -> Callable[[dlp.CreateDlpJobRequest], dlp.DlpJob]: 887 r"""Return a callable for the create dlp job method over gRPC. 888 889 Creates a new job to inspect storage or calculate 890 risk metrics. See 891 https://cloud.google.com/dlp/docs/inspecting-storage and 892 https://cloud.google.com/dlp/docs/compute-risk-analysis 893 to learn more. 894 When no InfoTypes or CustomInfoTypes are specified in 895 inspect jobs, the system will automatically choose what 896 detectors to run. By default this may be all types, but 897 may change over time as detectors are updated. 898 899 Returns: 900 Callable[[~.CreateDlpJobRequest], 901 ~.DlpJob]: 902 A function that, when called, will call the underlying RPC 903 on the server. 904 """ 905 # Generate a "stub function" on-the-fly which will actually make 906 # the request. 907 # gRPC handles serialization and deserialization, so we just need 908 # to pass in the functions for each. 909 if "create_dlp_job" not in self._stubs: 910 self._stubs["create_dlp_job"] = self.grpc_channel.unary_unary( 911 "/google.privacy.dlp.v2.DlpService/CreateDlpJob", 912 request_serializer=dlp.CreateDlpJobRequest.serialize, 913 response_deserializer=dlp.DlpJob.deserialize, 914 ) 915 return self._stubs["create_dlp_job"] 916 917 @property 918 def list_dlp_jobs( 919 self, 920 ) -> Callable[[dlp.ListDlpJobsRequest], dlp.ListDlpJobsResponse]: 921 r"""Return a callable for the list dlp jobs method over gRPC. 922 923 Lists DlpJobs that match the specified filter in the 924 request. See 925 https://cloud.google.com/dlp/docs/inspecting-storage and 926 https://cloud.google.com/dlp/docs/compute-risk-analysis 927 to learn more. 928 929 Returns: 930 Callable[[~.ListDlpJobsRequest], 931 ~.ListDlpJobsResponse]: 932 A function that, when called, will call the underlying RPC 933 on the server. 934 """ 935 # Generate a "stub function" on-the-fly which will actually make 936 # the request. 937 # gRPC handles serialization and deserialization, so we just need 938 # to pass in the functions for each. 939 if "list_dlp_jobs" not in self._stubs: 940 self._stubs["list_dlp_jobs"] = self.grpc_channel.unary_unary( 941 "/google.privacy.dlp.v2.DlpService/ListDlpJobs", 942 request_serializer=dlp.ListDlpJobsRequest.serialize, 943 response_deserializer=dlp.ListDlpJobsResponse.deserialize, 944 ) 945 return self._stubs["list_dlp_jobs"] 946 947 @property 948 def get_dlp_job(self) -> Callable[[dlp.GetDlpJobRequest], dlp.DlpJob]: 949 r"""Return a callable for the get dlp job method over gRPC. 950 951 Gets the latest state of a long-running DlpJob. 952 See https://cloud.google.com/dlp/docs/inspecting-storage 953 and https://cloud.google.com/dlp/docs/compute-risk- 954 analysis to learn more. 955 956 Returns: 957 Callable[[~.GetDlpJobRequest], 958 ~.DlpJob]: 959 A function that, when called, will call the underlying RPC 960 on the server. 961 """ 962 # Generate a "stub function" on-the-fly which will actually make 963 # the request. 964 # gRPC handles serialization and deserialization, so we just need 965 # to pass in the functions for each. 966 if "get_dlp_job" not in self._stubs: 967 self._stubs["get_dlp_job"] = self.grpc_channel.unary_unary( 968 "/google.privacy.dlp.v2.DlpService/GetDlpJob", 969 request_serializer=dlp.GetDlpJobRequest.serialize, 970 response_deserializer=dlp.DlpJob.deserialize, 971 ) 972 return self._stubs["get_dlp_job"] 973 974 @property 975 def delete_dlp_job(self) -> Callable[[dlp.DeleteDlpJobRequest], empty_pb2.Empty]: 976 r"""Return a callable for the delete dlp job method over gRPC. 977 978 Deletes a long-running DlpJob. This method indicates 979 that the client is no longer interested in the DlpJob 980 result. The job will be cancelled if possible. 981 See https://cloud.google.com/dlp/docs/inspecting-storage 982 and https://cloud.google.com/dlp/docs/compute-risk- 983 analysis to learn more. 984 985 Returns: 986 Callable[[~.DeleteDlpJobRequest], 987 ~.Empty]: 988 A function that, when called, will call the underlying RPC 989 on the server. 990 """ 991 # Generate a "stub function" on-the-fly which will actually make 992 # the request. 993 # gRPC handles serialization and deserialization, so we just need 994 # to pass in the functions for each. 995 if "delete_dlp_job" not in self._stubs: 996 self._stubs["delete_dlp_job"] = self.grpc_channel.unary_unary( 997 "/google.privacy.dlp.v2.DlpService/DeleteDlpJob", 998 request_serializer=dlp.DeleteDlpJobRequest.serialize, 999 response_deserializer=empty_pb2.Empty.FromString, 1000 ) 1001 return self._stubs["delete_dlp_job"] 1002 1003 @property 1004 def cancel_dlp_job(self) -> Callable[[dlp.CancelDlpJobRequest], empty_pb2.Empty]: 1005 r"""Return a callable for the cancel dlp job method over gRPC. 1006 1007 Starts asynchronous cancellation on a long-running 1008 DlpJob. The server makes a best effort to cancel the 1009 DlpJob, but success is not guaranteed. 1010 See https://cloud.google.com/dlp/docs/inspecting-storage 1011 and https://cloud.google.com/dlp/docs/compute-risk- 1012 analysis to learn more. 1013 1014 Returns: 1015 Callable[[~.CancelDlpJobRequest], 1016 ~.Empty]: 1017 A function that, when called, will call the underlying RPC 1018 on the server. 1019 """ 1020 # Generate a "stub function" on-the-fly which will actually make 1021 # the request. 1022 # gRPC handles serialization and deserialization, so we just need 1023 # to pass in the functions for each. 1024 if "cancel_dlp_job" not in self._stubs: 1025 self._stubs["cancel_dlp_job"] = self.grpc_channel.unary_unary( 1026 "/google.privacy.dlp.v2.DlpService/CancelDlpJob", 1027 request_serializer=dlp.CancelDlpJobRequest.serialize, 1028 response_deserializer=empty_pb2.Empty.FromString, 1029 ) 1030 return self._stubs["cancel_dlp_job"] 1031 1032 @property 1033 def create_stored_info_type( 1034 self, 1035 ) -> Callable[[dlp.CreateStoredInfoTypeRequest], dlp.StoredInfoType]: 1036 r"""Return a callable for the create stored info type method over gRPC. 1037 1038 Creates a pre-built stored infoType to be used for 1039 inspection. See 1040 https://cloud.google.com/dlp/docs/creating-stored- 1041 infotypes to learn more. 1042 1043 Returns: 1044 Callable[[~.CreateStoredInfoTypeRequest], 1045 ~.StoredInfoType]: 1046 A function that, when called, will call the underlying RPC 1047 on the server. 1048 """ 1049 # Generate a "stub function" on-the-fly which will actually make 1050 # the request. 1051 # gRPC handles serialization and deserialization, so we just need 1052 # to pass in the functions for each. 1053 if "create_stored_info_type" not in self._stubs: 1054 self._stubs["create_stored_info_type"] = self.grpc_channel.unary_unary( 1055 "/google.privacy.dlp.v2.DlpService/CreateStoredInfoType", 1056 request_serializer=dlp.CreateStoredInfoTypeRequest.serialize, 1057 response_deserializer=dlp.StoredInfoType.deserialize, 1058 ) 1059 return self._stubs["create_stored_info_type"] 1060 1061 @property 1062 def update_stored_info_type( 1063 self, 1064 ) -> Callable[[dlp.UpdateStoredInfoTypeRequest], dlp.StoredInfoType]: 1065 r"""Return a callable for the update stored info type method over gRPC. 1066 1067 Updates the stored infoType by creating a new 1068 version. The existing version will continue to be used 1069 until the new version is ready. See 1070 https://cloud.google.com/dlp/docs/creating-stored- 1071 infotypes to learn more. 1072 1073 Returns: 1074 Callable[[~.UpdateStoredInfoTypeRequest], 1075 ~.StoredInfoType]: 1076 A function that, when called, will call the underlying RPC 1077 on the server. 1078 """ 1079 # Generate a "stub function" on-the-fly which will actually make 1080 # the request. 1081 # gRPC handles serialization and deserialization, so we just need 1082 # to pass in the functions for each. 1083 if "update_stored_info_type" not in self._stubs: 1084 self._stubs["update_stored_info_type"] = self.grpc_channel.unary_unary( 1085 "/google.privacy.dlp.v2.DlpService/UpdateStoredInfoType", 1086 request_serializer=dlp.UpdateStoredInfoTypeRequest.serialize, 1087 response_deserializer=dlp.StoredInfoType.deserialize, 1088 ) 1089 return self._stubs["update_stored_info_type"] 1090 1091 @property 1092 def get_stored_info_type( 1093 self, 1094 ) -> Callable[[dlp.GetStoredInfoTypeRequest], dlp.StoredInfoType]: 1095 r"""Return a callable for the get stored info type method over gRPC. 1096 1097 Gets a stored infoType. 1098 See https://cloud.google.com/dlp/docs/creating-stored- 1099 infotypes to learn more. 1100 1101 Returns: 1102 Callable[[~.GetStoredInfoTypeRequest], 1103 ~.StoredInfoType]: 1104 A function that, when called, will call the underlying RPC 1105 on the server. 1106 """ 1107 # Generate a "stub function" on-the-fly which will actually make 1108 # the request. 1109 # gRPC handles serialization and deserialization, so we just need 1110 # to pass in the functions for each. 1111 if "get_stored_info_type" not in self._stubs: 1112 self._stubs["get_stored_info_type"] = self.grpc_channel.unary_unary( 1113 "/google.privacy.dlp.v2.DlpService/GetStoredInfoType", 1114 request_serializer=dlp.GetStoredInfoTypeRequest.serialize, 1115 response_deserializer=dlp.StoredInfoType.deserialize, 1116 ) 1117 return self._stubs["get_stored_info_type"] 1118 1119 @property 1120 def list_stored_info_types( 1121 self, 1122 ) -> Callable[[dlp.ListStoredInfoTypesRequest], dlp.ListStoredInfoTypesResponse]: 1123 r"""Return a callable for the list stored info types method over gRPC. 1124 1125 Lists stored infoTypes. 1126 See https://cloud.google.com/dlp/docs/creating-stored- 1127 infotypes to learn more. 1128 1129 Returns: 1130 Callable[[~.ListStoredInfoTypesRequest], 1131 ~.ListStoredInfoTypesResponse]: 1132 A function that, when called, will call the underlying RPC 1133 on the server. 1134 """ 1135 # Generate a "stub function" on-the-fly which will actually make 1136 # the request. 1137 # gRPC handles serialization and deserialization, so we just need 1138 # to pass in the functions for each. 1139 if "list_stored_info_types" not in self._stubs: 1140 self._stubs["list_stored_info_types"] = self.grpc_channel.unary_unary( 1141 "/google.privacy.dlp.v2.DlpService/ListStoredInfoTypes", 1142 request_serializer=dlp.ListStoredInfoTypesRequest.serialize, 1143 response_deserializer=dlp.ListStoredInfoTypesResponse.deserialize, 1144 ) 1145 return self._stubs["list_stored_info_types"] 1146 1147 @property 1148 def delete_stored_info_type( 1149 self, 1150 ) -> Callable[[dlp.DeleteStoredInfoTypeRequest], empty_pb2.Empty]: 1151 r"""Return a callable for the delete stored info type method over gRPC. 1152 1153 Deletes a stored infoType. 1154 See https://cloud.google.com/dlp/docs/creating-stored- 1155 infotypes to learn more. 1156 1157 Returns: 1158 Callable[[~.DeleteStoredInfoTypeRequest], 1159 ~.Empty]: 1160 A function that, when called, will call the underlying RPC 1161 on the server. 1162 """ 1163 # Generate a "stub function" on-the-fly which will actually make 1164 # the request. 1165 # gRPC handles serialization and deserialization, so we just need 1166 # to pass in the functions for each. 1167 if "delete_stored_info_type" not in self._stubs: 1168 self._stubs["delete_stored_info_type"] = self.grpc_channel.unary_unary( 1169 "/google.privacy.dlp.v2.DlpService/DeleteStoredInfoType", 1170 request_serializer=dlp.DeleteStoredInfoTypeRequest.serialize, 1171 response_deserializer=empty_pb2.Empty.FromString, 1172 ) 1173 return self._stubs["delete_stored_info_type"] 1174 1175 @property 1176 def hybrid_inspect_dlp_job( 1177 self, 1178 ) -> Callable[[dlp.HybridInspectDlpJobRequest], dlp.HybridInspectResponse]: 1179 r"""Return a callable for the hybrid inspect dlp job method over gRPC. 1180 1181 Inspect hybrid content and store findings to a job. 1182 To review the findings inspect the job. Inspection will 1183 occur asynchronously. 1184 Early access feature is in a pre-release state and might 1185 change or have limited support. For more information, 1186 see 1187 https://cloud.google.com/products#product-launch-stages. 1188 1189 Returns: 1190 Callable[[~.HybridInspectDlpJobRequest], 1191 ~.HybridInspectResponse]: 1192 A function that, when called, will call the underlying RPC 1193 on the server. 1194 """ 1195 # Generate a "stub function" on-the-fly which will actually make 1196 # the request. 1197 # gRPC handles serialization and deserialization, so we just need 1198 # to pass in the functions for each. 1199 if "hybrid_inspect_dlp_job" not in self._stubs: 1200 self._stubs["hybrid_inspect_dlp_job"] = self.grpc_channel.unary_unary( 1201 "/google.privacy.dlp.v2.DlpService/HybridInspectDlpJob", 1202 request_serializer=dlp.HybridInspectDlpJobRequest.serialize, 1203 response_deserializer=dlp.HybridInspectResponse.deserialize, 1204 ) 1205 return self._stubs["hybrid_inspect_dlp_job"] 1206 1207 @property 1208 def finish_dlp_job(self) -> Callable[[dlp.FinishDlpJobRequest], empty_pb2.Empty]: 1209 r"""Return a callable for the finish dlp job method over gRPC. 1210 1211 Finish a running hybrid DlpJob. Triggers the 1212 finalization steps and running of any enabled actions 1213 that have not yet run. Early access feature is in a pre- 1214 release state and might change or have limited support. 1215 For more information, see 1216 https://cloud.google.com/products#product-launch-stages. 1217 1218 Returns: 1219 Callable[[~.FinishDlpJobRequest], 1220 ~.Empty]: 1221 A function that, when called, will call the underlying RPC 1222 on the server. 1223 """ 1224 # Generate a "stub function" on-the-fly which will actually make 1225 # the request. 1226 # gRPC handles serialization and deserialization, so we just need 1227 # to pass in the functions for each. 1228 if "finish_dlp_job" not in self._stubs: 1229 self._stubs["finish_dlp_job"] = self.grpc_channel.unary_unary( 1230 "/google.privacy.dlp.v2.DlpService/FinishDlpJob", 1231 request_serializer=dlp.FinishDlpJobRequest.serialize, 1232 response_deserializer=empty_pb2.Empty.FromString, 1233 ) 1234 return self._stubs["finish_dlp_job"] 1235 1236 def close(self): 1237 self.grpc_channel.close() 1238 1239 1240__all__ = ("DlpServiceGrpcTransport",) 1241