Skip to content
This repository was archived by the owner on Jan 6, 2024. It is now read-only.

Commit b8e16f8

Browse files
feat(v3beta1): added support for comparing between versions (#202)
- [ ] Regenerate this pull request now. PiperOrigin-RevId: 407624272 Source-Link: googleapis/googleapis@eb773f2 Source-Link: https://github.com/googleapis/googleapis-gen/commit/e69f86b5bbc2ed777a5d97b65c080c4645ea02b8 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZTY5Zjg2YjViYmMyZWQ3NzdhNWQ5N2I2NWMwODBjNDY0NWVhMDJiOCJ9 docs(v3beta1): clarified security settings API reference
1 parent e56005b commit b8e16f8

File tree

11 files changed

+522
-2
lines changed

11 files changed

+522
-2
lines changed

google/cloud/dialogflowcx_v3beta1/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,8 @@
229229
from .types.transition_route_group import UpdateTransitionRouteGroupRequest
230230
from .types.validation_message import ResourceName
231231
from .types.validation_message import ValidationMessage
232+
from .types.version import CompareVersionsRequest
233+
from .types.version import CompareVersionsResponse
232234
from .types.version import CreateVersionOperationMetadata
233235
from .types.version import CreateVersionRequest
234236
from .types.version import DeleteVersionRequest
@@ -281,6 +283,8 @@
281283
"CalculateCoverageResponse",
282284
"Changelog",
283285
"ChangelogsClient",
286+
"CompareVersionsRequest",
287+
"CompareVersionsResponse",
284288
"ContinuousTestResult",
285289
"ConversationTurn",
286290
"CreateAgentRequest",

google/cloud/dialogflowcx_v3beta1/gapic_metadata.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1056,6 +1056,11 @@
10561056
"grpc": {
10571057
"libraryClient": "VersionsClient",
10581058
"rpcs": {
1059+
"CompareVersions": {
1060+
"methods": [
1061+
"compare_versions"
1062+
]
1063+
},
10591064
"CreateVersion": {
10601065
"methods": [
10611066
"create_version"
@@ -1091,6 +1096,11 @@
10911096
"grpc-async": {
10921097
"libraryClient": "VersionsAsyncClient",
10931098
"rpcs": {
1099+
"CompareVersions": {
1100+
"methods": [
1101+
"compare_versions"
1102+
]
1103+
},
10941104
"CreateVersion": {
10951105
"methods": [
10961106
"create_version"

google/cloud/dialogflowcx_v3beta1/services/versions/async_client.py

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -678,6 +678,84 @@ async def load_version(
678678
# Done; return the response.
679679
return response
680680

681+
async def compare_versions(
682+
self,
683+
request: Union[version.CompareVersionsRequest, dict] = None,
684+
*,
685+
base_version: str = None,
686+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
687+
timeout: float = None,
688+
metadata: Sequence[Tuple[str, str]] = (),
689+
) -> version.CompareVersionsResponse:
690+
r"""Compares the specified base version with target
691+
version.
692+
693+
Args:
694+
request (Union[google.cloud.dialogflowcx_v3beta1.types.CompareVersionsRequest, dict]):
695+
The request object. The request message for
696+
[Versions.CompareVersions][google.cloud.dialogflow.cx.v3beta1.Versions.CompareVersions].
697+
base_version (:class:`str`):
698+
Required. Name of the base flow version to compare with
699+
the target version. Use version ID ``0`` to indicate the
700+
draft version of the specified flow.
701+
702+
Format:
703+
``projects/<Project ID>/locations/<Location ID>/agents/ <Agent ID>/flows/<Flow ID>/versions/<Version ID>``.
704+
705+
This corresponds to the ``base_version`` field
706+
on the ``request`` instance; if ``request`` is provided, this
707+
should not be set.
708+
retry (google.api_core.retry.Retry): Designation of what errors, if any,
709+
should be retried.
710+
timeout (float): The timeout for this request.
711+
metadata (Sequence[Tuple[str, str]]): Strings which should be
712+
sent along with the request as metadata.
713+
714+
Returns:
715+
google.cloud.dialogflowcx_v3beta1.types.CompareVersionsResponse:
716+
The response message for
717+
[Versions.CompareVersions][google.cloud.dialogflow.cx.v3beta1.Versions.CompareVersions].
718+
719+
"""
720+
# Create or coerce a protobuf request object.
721+
# Sanity check: If we got a request object, we should *not* have
722+
# gotten any keyword arguments that map to the request.
723+
has_flattened_params = any([base_version])
724+
if request is not None and has_flattened_params:
725+
raise ValueError(
726+
"If the `request` argument is set, then none of "
727+
"the individual field arguments should be set."
728+
)
729+
730+
request = version.CompareVersionsRequest(request)
731+
732+
# If we have keyword arguments corresponding to fields on the
733+
# request, apply these.
734+
if base_version is not None:
735+
request.base_version = base_version
736+
737+
# Wrap the RPC method; this adds retry and timeout information,
738+
# and friendly error handling.
739+
rpc = gapic_v1.method_async.wrap_method(
740+
self._client._transport.compare_versions,
741+
default_timeout=None,
742+
client_info=DEFAULT_CLIENT_INFO,
743+
)
744+
745+
# Certain fields should be provided within the metadata header;
746+
# add these here.
747+
metadata = tuple(metadata) + (
748+
gapic_v1.routing_header.to_grpc_metadata(
749+
(("base_version", request.base_version),)
750+
),
751+
)
752+
753+
# Send the request.
754+
response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,)
755+
756+
# Done; return the response.
757+
return response
758+
681759
async def __aenter__(self):
682760
return self
683761

google/cloud/dialogflowcx_v3beta1/services/versions/client.py

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -872,6 +872,84 @@ def load_version(
872872
# Done; return the response.
873873
return response
874874

875+
def compare_versions(
876+
self,
877+
request: Union[version.CompareVersionsRequest, dict] = None,
878+
*,
879+
base_version: str = None,
880+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
881+
timeout: float = None,
882+
metadata: Sequence[Tuple[str, str]] = (),
883+
) -> version.CompareVersionsResponse:
884+
r"""Compares the specified base version with target
885+
version.
886+
887+
Args:
888+
request (Union[google.cloud.dialogflowcx_v3beta1.types.CompareVersionsRequest, dict]):
889+
The request object. The request message for
890+
[Versions.CompareVersions][google.cloud.dialogflow.cx.v3beta1.Versions.CompareVersions].
891+
base_version (str):
892+
Required. Name of the base flow version to compare with
893+
the target version. Use version ID ``0`` to indicate the
894+
draft version of the specified flow.
895+
896+
Format:
897+
``projects/<Project ID>/locations/<Location ID>/agents/ <Agent ID>/flows/<Flow ID>/versions/<Version ID>``.
898+
899+
This corresponds to the ``base_version`` field
900+
on the ``request`` instance; if ``request`` is provided, this
901+
should not be set.
902+
retry (google.api_core.retry.Retry): Designation of what errors, if any,
903+
should be retried.
904+
timeout (float): The timeout for this request.
905+
metadata (Sequence[Tuple[str, str]]): Strings which should be
906+
sent along with the request as metadata.
907+
908+
Returns:
909+
google.cloud.dialogflowcx_v3beta1.types.CompareVersionsResponse:
910+
The response message for
911+
[Versions.CompareVersions][google.cloud.dialogflow.cx.v3beta1.Versions.CompareVersions].
912+
913+
"""
914+
# Create or coerce a protobuf request object.
915+
# Sanity check: If we got a request object, we should *not* have
916+
# gotten any keyword arguments that map to the request.
917+
has_flattened_params = any([base_version])
918+
if request is not None and has_flattened_params:
919+
raise ValueError(
920+
"If the `request` argument is set, then none of "
921+
"the individual field arguments should be set."
922+
)
923+
924+
# Minor optimization to avoid making a copy if the user passes
925+
# in a version.CompareVersionsRequest.
926+
# There's no risk of modifying the input as we've already verified
927+
# there are no flattened fields.
928+
if not isinstance(request, version.CompareVersionsRequest):
929+
request = version.CompareVersionsRequest(request)
930+
# If we have keyword arguments corresponding to fields on the
931+
# request, apply these.
932+
if base_version is not None:
933+
request.base_version = base_version
934+
935+
# Wrap the RPC method; this adds retry and timeout information,
936+
# and friendly error handling.
937+
rpc = self._transport._wrapped_methods[self._transport.compare_versions]
938+
939+
# Certain fields should be provided within the metadata header;
940+
# add these here.
941+
metadata = tuple(metadata) + (
942+
gapic_v1.routing_header.to_grpc_metadata(
943+
(("base_version", request.base_version),)
944+
),
945+
)
946+
947+
# Send the request.
948+
response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,)
949+
950+
# Done; return the response.
951+
return response
952+
875953
def __enter__(self):
876954
return self
877955

google/cloud/dialogflowcx_v3beta1/services/versions/transports/base.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,9 @@ def _prep_wrapped_messages(self, client_info):
146146
self.load_version: gapic_v1.method.wrap_method(
147147
self.load_version, default_timeout=None, client_info=client_info,
148148
),
149+
self.compare_versions: gapic_v1.method.wrap_method(
150+
self.compare_versions, default_timeout=None, client_info=client_info,
151+
),
149152
}
150153

151154
def close(self):
@@ -215,5 +218,16 @@ def load_version(
215218
]:
216219
raise NotImplementedError()
217220

221+
@property
222+
def compare_versions(
223+
self,
224+
) -> Callable[
225+
[version.CompareVersionsRequest],
226+
Union[
227+
version.CompareVersionsResponse, Awaitable[version.CompareVersionsResponse]
228+
],
229+
]:
230+
raise NotImplementedError()
231+
218232

219233
__all__ = ("VersionsTransport",)

google/cloud/dialogflowcx_v3beta1/services/versions/transports/grpc.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,33 @@ def load_version(
425425
)
426426
return self._stubs["load_version"]
427427

428+
@property
429+
def compare_versions(
430+
self,
431+
) -> Callable[[version.CompareVersionsRequest], version.CompareVersionsResponse]:
432+
r"""Return a callable for the compare versions method over gRPC.
433+
434+
Compares the specified base version with target
435+
version.
436+
437+
Returns:
438+
Callable[[~.CompareVersionsRequest],
439+
~.CompareVersionsResponse]:
440+
A function that, when called, will call the underlying RPC
441+
on the server.
442+
"""
443+
# Generate a "stub function" on-the-fly which will actually make
444+
# the request.
445+
# gRPC handles serialization and deserialization, so we just need
446+
# to pass in the functions for each.
447+
if "compare_versions" not in self._stubs:
448+
self._stubs["compare_versions"] = self.grpc_channel.unary_unary(
449+
"/google.cloud.dialogflow.cx.v3beta1.Versions/CompareVersions",
450+
request_serializer=version.CompareVersionsRequest.serialize,
451+
response_deserializer=version.CompareVersionsResponse.deserialize,
452+
)
453+
return self._stubs["compare_versions"]
454+
428455
def close(self):
429456
self.grpc_channel.close()
430457

google/cloud/dialogflowcx_v3beta1/services/versions/transports/grpc_asyncio.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -435,6 +435,35 @@ def load_version(
435435
)
436436
return self._stubs["load_version"]
437437

438+
@property
439+
def compare_versions(
440+
self,
441+
) -> Callable[
442+
[version.CompareVersionsRequest], Awaitable[version.CompareVersionsResponse]
443+
]:
444+
r"""Return a callable for the compare versions method over gRPC.
445+
446+
Compares the specified base version with target
447+
version.
448+
449+
Returns:
450+
Callable[[~.CompareVersionsRequest],
451+
Awaitable[~.CompareVersionsResponse]]:
452+
A function that, when called, will call the underlying RPC
453+
on the server.
454+
"""
455+
# Generate a "stub function" on-the-fly which will actually make
456+
# the request.
457+
# gRPC handles serialization and deserialization, so we just need
458+
# to pass in the functions for each.
459+
if "compare_versions" not in self._stubs:
460+
self._stubs["compare_versions"] = self.grpc_channel.unary_unary(
461+
"/google.cloud.dialogflow.cx.v3beta1.Versions/CompareVersions",
462+
request_serializer=version.CompareVersionsRequest.serialize,
463+
response_deserializer=version.CompareVersionsResponse.deserialize,
464+
)
465+
return self._stubs["compare_versions"]
466+
438467
def close(self):
439468
return self.grpc_channel.close()
440469

google/cloud/dialogflowcx_v3beta1/types/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,8 @@
228228
ValidationMessage,
229229
)
230230
from .version import (
231+
CompareVersionsRequest,
232+
CompareVersionsResponse,
231233
CreateVersionOperationMetadata,
232234
CreateVersionRequest,
233235
DeleteVersionRequest,
@@ -435,6 +437,8 @@
435437
"UpdateTransitionRouteGroupRequest",
436438
"ResourceName",
437439
"ValidationMessage",
440+
"CompareVersionsRequest",
441+
"CompareVersionsResponse",
438442
"CreateVersionOperationMetadata",
439443
"CreateVersionRequest",
440444
"DeleteVersionRequest",

google/cloud/dialogflowcx_v3beta1/types/security_settings.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,11 @@ class SecuritySettings(proto.Message):
173173
`DLP <https://cloud.google.com/dlp/docs>`__ inspect template
174174
name. Use this template to define inspect base settings.
175175
176+
The ``DLP Inspect Templates Reader`` role is needed on the
177+
Dialogflow service identity service account (has the form
178+
``service-PROJECT_NUMBER@gcp-sa-dialogflow.iam.gserviceaccount.com``)
179+
for your agent's project.
180+
176181
If empty, we use the default DLP inspect config.
177182
178183
The template name will have one of the following formats:
@@ -187,6 +192,12 @@ class SecuritySettings(proto.Message):
187192
template name. Use this template to define de-identification
188193
configuration for the content.
189194
195+
The ``DLP De-identify Templates Reader`` role is needed on
196+
the Dialogflow service identity service account (has the
197+
form
198+
``service-PROJECT_NUMBER@gcp-sa-dialogflow.iam.gserviceaccount.com``)
199+
for your agent's project.
200+
190201
If empty, Dialogflow replaces sensitive info with
191202
``[redacted]`` text.
192203
@@ -202,8 +213,8 @@ class SecuritySettings(proto.Message):
202213
specified number of days. This does not apply to
203214
Cloud logging, which is owned by the user - not
204215
Dialogflow.
205-
User must Set a value lower than Dialogflow's
206-
default 30d TTL. Setting a value higher than
216+
User must set a value lower than Dialogflow's
217+
default 365d TTL. Setting a value higher than
207218
that has no effect.
208219
A missing value or setting to 0 also means we
209220
use Dialogflow's default TTL.

0 commit comments

Comments
 (0)