Skip to content

Commit

Permalink
feat(v3): allow setting custom CA for generic webhooks (#214)
Browse files Browse the repository at this point in the history
- [ ] Regenerate this pull request now.

PiperOrigin-RevId: 410299375

Source-Link: googleapis/googleapis@4a4ec6d

Source-Link: googleapis/googleapis-gen@043e044
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMDQzZTA0NGNhOTYzYTE1OTY2ZDUwZjRjMmIyMWJmYmQ3M2FmYWE5NCJ9

feat(v3): release CompareVersions API
docs: clarify DLP template reader usage
  • Loading branch information
gcf-owl-bot[bot] authored Nov 17, 2021
1 parent a799cef commit ec9085a
Show file tree
Hide file tree
Showing 15 changed files with 571 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,8 @@
)
from google.cloud.dialogflowcx_v3.types.validation_message import ResourceName
from google.cloud.dialogflowcx_v3.types.validation_message import ValidationMessage
from google.cloud.dialogflowcx_v3.types.version import CompareVersionsRequest
from google.cloud.dialogflowcx_v3.types.version import CompareVersionsResponse
from google.cloud.dialogflowcx_v3.types.version import CreateVersionOperationMetadata
from google.cloud.dialogflowcx_v3.types.version import CreateVersionRequest
from google.cloud.dialogflowcx_v3.types.version import DeleteVersionRequest
Expand Down Expand Up @@ -543,6 +545,8 @@
"UpdateTransitionRouteGroupRequest",
"ResourceName",
"ValidationMessage",
"CompareVersionsRequest",
"CompareVersionsResponse",
"CreateVersionOperationMetadata",
"CreateVersionRequest",
"DeleteVersionRequest",
Expand Down
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 @@ -187,7 +187,7 @@ async def list_versions(
parent (:class:`str`):
Required. The [Flow][google.cloud.dialogflow.cx.v3.Flow]
to list all versions for. Format:
``projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/flows/<Flow ID>``.
``projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/flows/<FlowID>``.
This corresponds to the ``parent`` field
on the ``request`` instance; if ``request`` is provided, this
Expand All @@ -201,7 +201,7 @@ async def list_versions(
Returns:
google.cloud.dialogflowcx_v3.services.versions.pagers.ListVersionsAsyncPager:
The response message for
[Versions.ListVersions][google.cloud.dialogflow.cx.v3.Versions.ListVersions].
[Versions.ListVersions][google.cloud.dialogflow.cx.v3.Versions.ListVersions].
Iterating over this object will yield results and
resolve additional pages automatically.
Expand Down Expand Up @@ -270,7 +270,7 @@ async def get_version(
Required. The name of the
[Version][google.cloud.dialogflow.cx.v3.Version].
Format:
``projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/flows/<Flow ID>/versions/<Version ID>``.
``projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/flows/<FlowID>/versions/<VersionID>``.
This corresponds to the ``name`` field
on the ``request`` instance; if ``request`` is provided, this
Expand Down Expand Up @@ -354,7 +354,7 @@ async def create_version(
to create an
[Version][google.cloud.dialogflow.cx.v3.Version] for.
Format:
``projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/flows/<Flow ID>``.
``projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/flows/<FlowID>``.
This corresponds to the ``parent`` field
on the ``request`` instance; if ``request`` is provided, this
Expand Down Expand Up @@ -527,7 +527,7 @@ async def delete_version(
Required. The name of the
[Version][google.cloud.dialogflow.cx.v3.Version] to
delete. Format:
``projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/flows/<Flow ID>/versions/<Version ID>``.
``projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/flows/<FlowID>/versions/<VersionID>``.
This corresponds to the ``name`` field
on the ``request`` instance; if ``request`` is provided, this
Expand Down Expand Up @@ -603,7 +603,7 @@ async def load_version(
Required. The
[Version][google.cloud.dialogflow.cx.v3.Version] to be
loaded to draft flow. Format:
``projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/flows/<Flow ID>/versions/<Version ID>``.
``projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/flows/<FlowID>/versions/<VersionID>``.
This corresponds to the ``name`` field
on the ``request`` instance; if ``request`` is provided, this
Expand Down 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_v3.types.CompareVersionsRequest, dict]):
The request object. The request message for
[Versions.CompareVersions][google.cloud.dialogflow.cx.v3.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/<ProjectID>/locations/<LocationID>/agents/<AgentID>/flows/<FlowID>/versions/<VersionID>``.
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_v3.types.CompareVersionsResponse:
The response message for
[Versions.CompareVersions][google.cloud.dialogflow.cx.v3.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 @@ -387,7 +387,7 @@ def list_versions(
parent (str):
Required. The [Flow][google.cloud.dialogflow.cx.v3.Flow]
to list all versions for. Format:
``projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/flows/<Flow ID>``.
``projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/flows/<FlowID>``.
This corresponds to the ``parent`` field
on the ``request`` instance; if ``request`` is provided, this
Expand All @@ -401,7 +401,7 @@ def list_versions(
Returns:
google.cloud.dialogflowcx_v3.services.versions.pagers.ListVersionsPager:
The response message for
[Versions.ListVersions][google.cloud.dialogflow.cx.v3.Versions.ListVersions].
[Versions.ListVersions][google.cloud.dialogflow.cx.v3.Versions.ListVersions].
Iterating over this object will yield results and
resolve additional pages automatically.
Expand Down Expand Up @@ -470,7 +470,7 @@ def get_version(
Required. The name of the
[Version][google.cloud.dialogflow.cx.v3.Version].
Format:
``projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/flows/<Flow ID>/versions/<Version ID>``.
``projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/flows/<FlowID>/versions/<VersionID>``.
This corresponds to the ``name`` field
on the ``request`` instance; if ``request`` is provided, this
Expand Down Expand Up @@ -554,7 +554,7 @@ def create_version(
to create an
[Version][google.cloud.dialogflow.cx.v3.Version] for.
Format:
``projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/flows/<Flow ID>``.
``projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/flows/<FlowID>``.
This corresponds to the ``parent`` field
on the ``request`` instance; if ``request`` is provided, this
Expand Down Expand Up @@ -727,7 +727,7 @@ def delete_version(
Required. The name of the
[Version][google.cloud.dialogflow.cx.v3.Version] to
delete. Format:
``projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/flows/<Flow ID>/versions/<Version ID>``.
``projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/flows/<FlowID>/versions/<VersionID>``.
This corresponds to the ``name`` field
on the ``request`` instance; if ``request`` is provided, this
Expand Down Expand Up @@ -803,7 +803,7 @@ def load_version(
Required. The
[Version][google.cloud.dialogflow.cx.v3.Version] to be
loaded to draft flow. Format:
``projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/flows/<Flow ID>/versions/<Version ID>``.
``projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/flows/<FlowID>/versions/<VersionID>``.
This corresponds to the ``name`` field
on the ``request`` instance; if ``request`` is provided, this
Expand Down Expand Up @@ -878,6 +878,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_v3.types.CompareVersionsRequest, dict]):
The request object. The request message for
[Versions.CompareVersions][google.cloud.dialogflow.cx.v3.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/<ProjectID>/locations/<LocationID>/agents/<AgentID>/flows/<FlowID>/versions/<VersionID>``.
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_v3.types.CompareVersionsResponse:
The response message for
[Versions.CompareVersions][google.cloud.dialogflow.cx.v3.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 @@ -424,6 +424,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.v3.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
Loading

0 comments on commit ec9085a

Please sign in to comment.