Skip to content

Commit

Permalink
feat(v3beta1): added support for comparing between versions (#202)
Browse files Browse the repository at this point in the history
- [ ] Regenerate this pull request now.

PiperOrigin-RevId: 407624272

Source-Link: googleapis/googleapis@eb773f2

Source-Link: googleapis/googleapis-gen@e69f86b
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZTY5Zjg2YjViYmMyZWQ3NzdhNWQ5N2I2NWMwODBjNDY0NWVhMDJiOCJ9

docs(v3beta1): clarified security settings API reference
  • Loading branch information
gcf-owl-bot[bot] authored Nov 5, 2021
1 parent 907d258 commit a1d56e2
Show file tree
Hide file tree
Showing 11 changed files with 522 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,8 @@
from .types.transition_route_group import UpdateTransitionRouteGroupRequest
from .types.validation_message import ResourceName
from .types.validation_message import ValidationMessage
from .types.version import CompareVersionsRequest
from .types.version import CompareVersionsResponse
from .types.version import CreateVersionOperationMetadata
from .types.version import CreateVersionRequest
from .types.version import DeleteVersionRequest
Expand Down Expand Up @@ -281,6 +283,8 @@
"CalculateCoverageResponse",
"Changelog",
"ChangelogsClient",
"CompareVersionsRequest",
"CompareVersionsResponse",
"ContinuousTestResult",
"ConversationTurn",
"CreateAgentRequest",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1056,6 +1056,11 @@
"grpc": {
"libraryClient": "VersionsClient",
"rpcs": {
"CompareVersions": {
"methods": [
"compare_versions"
]
},
"CreateVersion": {
"methods": [
"create_version"
Expand Down Expand Up @@ -1091,6 +1096,11 @@
"grpc-async": {
"libraryClient": "VersionsAsyncClient",
"rpcs": {
"CompareVersions": {
"methods": [
"compare_versions"
]
},
"CreateVersion": {
"methods": [
"create_version"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -678,6 +678,84 @@ async def load_version(
# Done; return the response.
return response

async def compare_versions(
self,
request: Union[version.CompareVersionsRequest, dict] = None,
*,
base_version: str = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> version.CompareVersionsResponse:
r"""Compares the specified base version with target
version.
Args:
request (Union[google.cloud.dialogflowcx_v3beta1.types.CompareVersionsRequest, dict]):
The request object. The request message for
[Versions.CompareVersions][google.cloud.dialogflow.cx.v3beta1.Versions.CompareVersions].
base_version (:class:`str`):
Required. Name of the base flow version to compare with
the target version. Use version ID ``0`` to indicate the
draft version of the specified flow.
Format:
``projects/<Project ID>/locations/<Location ID>/agents/ <Agent ID>/flows/<Flow ID>/versions/<Version ID>``.
This corresponds to the ``base_version`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
retry (google.api_core.retry.Retry): Designation of what errors, if any,
should be retried.
timeout (float): The timeout for this request.
metadata (Sequence[Tuple[str, str]]): Strings which should be
sent along with the request as metadata.
Returns:
google.cloud.dialogflowcx_v3beta1.types.CompareVersionsResponse:
The response message for
[Versions.CompareVersions][google.cloud.dialogflow.cx.v3beta1.Versions.CompareVersions].
"""
# Create or coerce a protobuf request object.
# Sanity check: If we got a request object, we should *not* have
# gotten any keyword arguments that map to the request.
has_flattened_params = any([base_version])
if request is not None and has_flattened_params:
raise ValueError(
"If the `request` argument is set, then none of "
"the individual field arguments should be set."
)

request = version.CompareVersionsRequest(request)

# If we have keyword arguments corresponding to fields on the
# request, apply these.
if base_version is not None:
request.base_version = base_version

# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = gapic_v1.method_async.wrap_method(
self._client._transport.compare_versions,
default_timeout=None,
client_info=DEFAULT_CLIENT_INFO,
)

# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata(
(("base_version", request.base_version),)
),
)

# Send the request.
response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,)

# Done; return the response.
return response

async def __aenter__(self):
return self

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -872,6 +872,84 @@ def load_version(
# Done; return the response.
return response

def compare_versions(
self,
request: Union[version.CompareVersionsRequest, dict] = None,
*,
base_version: str = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> version.CompareVersionsResponse:
r"""Compares the specified base version with target
version.
Args:
request (Union[google.cloud.dialogflowcx_v3beta1.types.CompareVersionsRequest, dict]):
The request object. The request message for
[Versions.CompareVersions][google.cloud.dialogflow.cx.v3beta1.Versions.CompareVersions].
base_version (str):
Required. Name of the base flow version to compare with
the target version. Use version ID ``0`` to indicate the
draft version of the specified flow.
Format:
``projects/<Project ID>/locations/<Location ID>/agents/ <Agent ID>/flows/<Flow ID>/versions/<Version ID>``.
This corresponds to the ``base_version`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
retry (google.api_core.retry.Retry): Designation of what errors, if any,
should be retried.
timeout (float): The timeout for this request.
metadata (Sequence[Tuple[str, str]]): Strings which should be
sent along with the request as metadata.
Returns:
google.cloud.dialogflowcx_v3beta1.types.CompareVersionsResponse:
The response message for
[Versions.CompareVersions][google.cloud.dialogflow.cx.v3beta1.Versions.CompareVersions].
"""
# Create or coerce a protobuf request object.
# Sanity check: If we got a request object, we should *not* have
# gotten any keyword arguments that map to the request.
has_flattened_params = any([base_version])
if request is not None and has_flattened_params:
raise ValueError(
"If the `request` argument is set, then none of "
"the individual field arguments should be set."
)

# Minor optimization to avoid making a copy if the user passes
# in a version.CompareVersionsRequest.
# There's no risk of modifying the input as we've already verified
# there are no flattened fields.
if not isinstance(request, version.CompareVersionsRequest):
request = version.CompareVersionsRequest(request)
# If we have keyword arguments corresponding to fields on the
# request, apply these.
if base_version is not None:
request.base_version = base_version

# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._transport._wrapped_methods[self._transport.compare_versions]

# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata(
(("base_version", request.base_version),)
),
)

# Send the request.
response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,)

# Done; return the response.
return response

def __enter__(self):
return self

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,9 @@ def _prep_wrapped_messages(self, client_info):
self.load_version: gapic_v1.method.wrap_method(
self.load_version, default_timeout=None, client_info=client_info,
),
self.compare_versions: gapic_v1.method.wrap_method(
self.compare_versions, default_timeout=None, client_info=client_info,
),
}

def close(self):
Expand Down Expand Up @@ -215,5 +218,16 @@ def load_version(
]:
raise NotImplementedError()

@property
def compare_versions(
self,
) -> Callable[
[version.CompareVersionsRequest],
Union[
version.CompareVersionsResponse, Awaitable[version.CompareVersionsResponse]
],
]:
raise NotImplementedError()


__all__ = ("VersionsTransport",)
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,33 @@ def load_version(
)
return self._stubs["load_version"]

@property
def compare_versions(
self,
) -> Callable[[version.CompareVersionsRequest], version.CompareVersionsResponse]:
r"""Return a callable for the compare versions method over gRPC.
Compares the specified base version with target
version.
Returns:
Callable[[~.CompareVersionsRequest],
~.CompareVersionsResponse]:
A function that, when called, will call the underlying RPC
on the server.
"""
# Generate a "stub function" on-the-fly which will actually make
# the request.
# gRPC handles serialization and deserialization, so we just need
# to pass in the functions for each.
if "compare_versions" not in self._stubs:
self._stubs["compare_versions"] = self.grpc_channel.unary_unary(
"/google.cloud.dialogflow.cx.v3beta1.Versions/CompareVersions",
request_serializer=version.CompareVersionsRequest.serialize,
response_deserializer=version.CompareVersionsResponse.deserialize,
)
return self._stubs["compare_versions"]

def close(self):
self.grpc_channel.close()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,35 @@ def load_version(
)
return self._stubs["load_version"]

@property
def compare_versions(
self,
) -> Callable[
[version.CompareVersionsRequest], Awaitable[version.CompareVersionsResponse]
]:
r"""Return a callable for the compare versions method over gRPC.
Compares the specified base version with target
version.
Returns:
Callable[[~.CompareVersionsRequest],
Awaitable[~.CompareVersionsResponse]]:
A function that, when called, will call the underlying RPC
on the server.
"""
# Generate a "stub function" on-the-fly which will actually make
# the request.
# gRPC handles serialization and deserialization, so we just need
# to pass in the functions for each.
if "compare_versions" not in self._stubs:
self._stubs["compare_versions"] = self.grpc_channel.unary_unary(
"/google.cloud.dialogflow.cx.v3beta1.Versions/CompareVersions",
request_serializer=version.CompareVersionsRequest.serialize,
response_deserializer=version.CompareVersionsResponse.deserialize,
)
return self._stubs["compare_versions"]

def close(self):
return self.grpc_channel.close()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,8 @@
ValidationMessage,
)
from .version import (
CompareVersionsRequest,
CompareVersionsResponse,
CreateVersionOperationMetadata,
CreateVersionRequest,
DeleteVersionRequest,
Expand Down Expand Up @@ -435,6 +437,8 @@
"UpdateTransitionRouteGroupRequest",
"ResourceName",
"ValidationMessage",
"CompareVersionsRequest",
"CompareVersionsResponse",
"CreateVersionOperationMetadata",
"CreateVersionRequest",
"DeleteVersionRequest",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,11 @@ class SecuritySettings(proto.Message):
`DLP <https://cloud.google.com/dlp/docs>`__ inspect template
name. Use this template to define inspect base settings.
The ``DLP Inspect Templates Reader`` role is needed on the
Dialogflow service identity service account (has the form
``[email protected]``)
for your agent's project.
If empty, we use the default DLP inspect config.
The template name will have one of the following formats:
Expand All @@ -187,6 +192,12 @@ class SecuritySettings(proto.Message):
template name. Use this template to define de-identification
configuration for the content.
The ``DLP De-identify Templates Reader`` role is needed on
the Dialogflow service identity service account (has the
form
``[email protected]``)
for your agent's project.
If empty, Dialogflow replaces sensitive info with
``[redacted]`` text.
Expand All @@ -202,8 +213,8 @@ class SecuritySettings(proto.Message):
specified number of days. This does not apply to
Cloud logging, which is owned by the user - not
Dialogflow.
User must Set a value lower than Dialogflow's
default 30d TTL. Setting a value higher than
User must set a value lower than Dialogflow's
default 365d TTL. Setting a value higher than
that has no effect.
A missing value or setting to 0 also means we
use Dialogflow's default TTL.
Expand Down
Loading

0 comments on commit a1d56e2

Please sign in to comment.