Skip to content

Commit 8e803cf

Browse files
feat: add push config wrapper fields (#925)
* feat: add push config wrapper fields PiperOrigin-RevId: 534994946 Source-Link: googleapis/googleapis@64ecfeb Source-Link: googleapis/googleapis-gen@03534b3 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMDM1MzRiM2RkNGM5MjZmNzA2NzI5ZDk3OWQ4OTM0NThkYjdlMTc0ZCJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent 0854a7d commit 8e803cf

File tree

2 files changed

+53
-1
lines changed

2 files changed

+53
-1
lines changed

google/pubsub_v1/types/pubsub.py

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -959,6 +959,11 @@ class ExpirationPolicy(proto.Message):
959959
class PushConfig(proto.Message):
960960
r"""Configuration for a push delivery endpoint.
961961
962+
This message has `oneof`_ fields (mutually exclusive fields).
963+
For each oneof, at most one member field can be set at the same time.
964+
Setting any member of the oneof automatically clears all other
965+
members.
966+
962967
.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
963968
964969
Attributes:
@@ -998,6 +1003,18 @@ class PushConfig(proto.Message):
9981003
every pushed message.
9991004
10001005
This field is a member of `oneof`_ ``authentication_method``.
1006+
pubsub_wrapper (google.pubsub_v1.types.PushConfig.PubsubWrapper):
1007+
When set, the payload to the push endpoint is
1008+
in the form of the JSON representation of a
1009+
PubsubMessage
1010+
(https://cloud.google.com/pubsub/docs/reference/rpc/google.pubsub.v1#pubsubmessage).
1011+
1012+
This field is a member of `oneof`_ ``wrapper``.
1013+
no_wrapper (google.pubsub_v1.types.PushConfig.NoWrapper):
1014+
When set, the payload to the push endpoint is
1015+
not wrapped.
1016+
1017+
This field is a member of `oneof`_ ``wrapper``.
10011018
"""
10021019

10031020
class OidcToken(proto.Message):
@@ -1033,6 +1050,29 @@ class OidcToken(proto.Message):
10331050
number=2,
10341051
)
10351052

1053+
class PubsubWrapper(proto.Message):
1054+
r"""The payload to the push endpoint is in the form of the JSON
1055+
representation of a PubsubMessage
1056+
(https://cloud.google.com/pubsub/docs/reference/rpc/google.pubsub.v1#pubsubmessage).
1057+
1058+
"""
1059+
1060+
class NoWrapper(proto.Message):
1061+
r"""Sets the ``data`` field as the HTTP body for delivery.
1062+
1063+
Attributes:
1064+
write_metadata (bool):
1065+
When true, writes the Pub/Sub message metadata to
1066+
``x-goog-pubsub-<KEY>:<VAL>`` headers of the HTTP request.
1067+
Writes the Pub/Sub message attributes to ``<KEY>:<VAL>``
1068+
headers of the HTTP request.
1069+
"""
1070+
1071+
write_metadata: bool = proto.Field(
1072+
proto.BOOL,
1073+
number=1,
1074+
)
1075+
10361076
push_endpoint: str = proto.Field(
10371077
proto.STRING,
10381078
number=1,
@@ -1048,6 +1088,18 @@ class OidcToken(proto.Message):
10481088
oneof="authentication_method",
10491089
message=OidcToken,
10501090
)
1091+
pubsub_wrapper: PubsubWrapper = proto.Field(
1092+
proto.MESSAGE,
1093+
number=4,
1094+
oneof="wrapper",
1095+
message=PubsubWrapper,
1096+
)
1097+
no_wrapper: NoWrapper = proto.Field(
1098+
proto.MESSAGE,
1099+
number=5,
1100+
oneof="wrapper",
1101+
message=NoWrapper,
1102+
)
10511103

10521104

10531105
class BigQueryConfig(proto.Message):

samples/generated_samples/snippet_metadata_google.pubsub.v1.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
],
99
"language": "PYTHON",
1010
"name": "google-cloud-pubsub",
11-
"version": "2.17.1"
11+
"version": "0.1.0"
1212
},
1313
"snippets": [
1414
{

0 commit comments

Comments
 (0)