From c74e3acb609363cdf941586e98ed2c8c5804980b Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 12 Aug 2021 15:32:27 +0000 Subject: [PATCH] feat(v3): added support for DLP templates (#144) PiperOrigin-RevId: 389939863 Source-Link: https://github.com/googleapis/googleapis/commit/626df528c5ae8839254f28b1f8daa1bac75be3a4 Source-Link: https://github.com/googleapis/googleapis-gen/commit/6d110f5fb7540ab832798e838d226539122fccf2 feat(v3): expose `Locations` service to get/list avaliable locations of Dialogflow products --- .../security_settings_service/async_client.py | 12 ++++ .../security_settings_service/client.py | 40 +++++++++++ .../types/security_settings.py | 26 ++++++-- .../test_security_settings_service.py | 66 +++++++++++++++++++ 4 files changed, 140 insertions(+), 4 deletions(-) diff --git a/google/cloud/dialogflowcx_v3/services/security_settings_service/async_client.py b/google/cloud/dialogflowcx_v3/services/security_settings_service/async_client.py index 0ddde9bc..b0bb2f4b 100644 --- a/google/cloud/dialogflowcx_v3/services/security_settings_service/async_client.py +++ b/google/cloud/dialogflowcx_v3/services/security_settings_service/async_client.py @@ -45,6 +45,18 @@ class SecuritySettingsServiceAsyncClient: DEFAULT_ENDPOINT = SecuritySettingsServiceClient.DEFAULT_ENDPOINT DEFAULT_MTLS_ENDPOINT = SecuritySettingsServiceClient.DEFAULT_MTLS_ENDPOINT + deidentify_template_path = staticmethod( + SecuritySettingsServiceClient.deidentify_template_path + ) + parse_deidentify_template_path = staticmethod( + SecuritySettingsServiceClient.parse_deidentify_template_path + ) + inspect_template_path = staticmethod( + SecuritySettingsServiceClient.inspect_template_path + ) + parse_inspect_template_path = staticmethod( + SecuritySettingsServiceClient.parse_inspect_template_path + ) security_settings_path = staticmethod( SecuritySettingsServiceClient.security_settings_path ) diff --git a/google/cloud/dialogflowcx_v3/services/security_settings_service/client.py b/google/cloud/dialogflowcx_v3/services/security_settings_service/client.py index 5a0a4e19..0e876f3b 100644 --- a/google/cloud/dialogflowcx_v3/services/security_settings_service/client.py +++ b/google/cloud/dialogflowcx_v3/services/security_settings_service/client.py @@ -161,6 +161,46 @@ def transport(self) -> SecuritySettingsServiceTransport: """ return self._transport + @staticmethod + def deidentify_template_path( + organization: str, location: str, deidentify_template: str, + ) -> str: + """Returns a fully-qualified deidentify_template string.""" + return "organizations/{organization}/locations/{location}/deidentifyTemplates/{deidentify_template}".format( + organization=organization, + location=location, + deidentify_template=deidentify_template, + ) + + @staticmethod + def parse_deidentify_template_path(path: str) -> Dict[str, str]: + """Parses a deidentify_template path into its component segments.""" + m = re.match( + r"^organizations/(?P.+?)/locations/(?P.+?)/deidentifyTemplates/(?P.+?)$", + path, + ) + return m.groupdict() if m else {} + + @staticmethod + def inspect_template_path( + organization: str, location: str, inspect_template: str, + ) -> str: + """Returns a fully-qualified inspect_template string.""" + return "organizations/{organization}/locations/{location}/inspectTemplates/{inspect_template}".format( + organization=organization, + location=location, + inspect_template=inspect_template, + ) + + @staticmethod + def parse_inspect_template_path(path: str) -> Dict[str, str]: + """Parses a inspect_template path into its component segments.""" + m = re.match( + r"^organizations/(?P.+?)/locations/(?P.+?)/inspectTemplates/(?P.+?)$", + path, + ) + return m.groupdict() if m else {} + @staticmethod def security_settings_path( project: str, location: str, security_settings: str, diff --git a/google/cloud/dialogflowcx_v3/types/security_settings.py b/google/cloud/dialogflowcx_v3/types/security_settings.py index 7b0e1bff..63c4587d 100644 --- a/google/cloud/dialogflowcx_v3/types/security_settings.py +++ b/google/cloud/dialogflowcx_v3/types/security_settings.py @@ -165,10 +165,27 @@ class SecuritySettings(proto.Message): If empty, we use the default DLP inspect config. The template name will have one of the following formats: - ``projects//inspectTemplates/