From ae2f0fea9c32db279c4f4121b394d13c75924bfd Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 8 Nov 2022 11:11:10 -0500 Subject: [PATCH] feat: [eventarcpublishing] Introduce the event publishing using JSON representation of CloudEvents (#8730) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: Introduce the event publishing using JSON representation of CloudEvents Clients can now use either the Protobuf or the JSON CloudEvents representation when interacting with Eventarc Publishing API. This change benefits both Channel and ChannelConnection consumers. PiperOrigin-RevId: 486208303 Source-Link: https://github.com/googleapis/googleapis/commit/079ef843a85546a6d352f8936f5a8442c60f9601 Source-Link: https://github.com/googleapis/googleapis-gen/commit/dd62dfc174abb25bf2e50a2a54651da70daed781 Copy-Tag: eyJwIjoiamF2YS1ldmVudGFyYy1wdWJsaXNoaW5nLy5Pd2xCb3QueWFtbCIsImgiOiJkZDYyZGZjMTc0YWJiMjViZjJlNTBhMmE1NDY1MWRhNzBkYWVkNzgxIn0= * 🦉 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 --- .../publishing/v1/PublisherClient.java | 5 + .../eventarc/publishing/v1/package-info.java | 1 + .../v1/PublisherClientHttpJsonTest.java | 4 + .../publishing/v1/PublisherClientTest.java | 6 + ...PublishChannelConnectionEventsRequest.java | 345 ++++++++++++++++++ ...annelConnectionEventsRequestOrBuilder.java | 72 ++++ .../publishing/v1/PublishEventsRequest.java | 345 ++++++++++++++++++ .../v1/PublishEventsRequestOrBuilder.java | 72 ++++ .../publishing/v1/PublisherProto.java | 61 ++-- .../eventarc/publishing/v1/publisher.proto | 36 +- 10 files changed, 901 insertions(+), 46 deletions(-) diff --git a/java-eventarc-publishing/google-cloud-eventarc-publishing/src/main/java/com/google/cloud/eventarc/publishing/v1/PublisherClient.java b/java-eventarc-publishing/google-cloud-eventarc-publishing/src/main/java/com/google/cloud/eventarc/publishing/v1/PublisherClient.java index a4596bbb0eed..cb20dc43a770 100644 --- a/java-eventarc-publishing/google-cloud-eventarc-publishing/src/main/java/com/google/cloud/eventarc/publishing/v1/PublisherClient.java +++ b/java-eventarc-publishing/google-cloud-eventarc-publishing/src/main/java/com/google/cloud/eventarc/publishing/v1/PublisherClient.java @@ -62,6 +62,7 @@ * PublishChannelConnectionEventsRequest.newBuilder() * .setChannelConnection("channelConnection-1932021695") * .addAllEvents(new ArrayList()) + * .addAllTextEvents(new ArrayList()) * .build(); * PublishChannelConnectionEventsResponse response = * publisherClient.publishChannelConnectionEvents(request); @@ -202,6 +203,7 @@ public PublisherStub getStub() { * PublishChannelConnectionEventsRequest.newBuilder() * .setChannelConnection("channelConnection-1932021695") * .addAllEvents(new ArrayList()) + * .addAllTextEvents(new ArrayList()) * .build(); * PublishChannelConnectionEventsResponse response = * publisherClient.publishChannelConnectionEvents(request); @@ -233,6 +235,7 @@ public final PublishChannelConnectionEventsResponse publishChannelConnectionEven * PublishChannelConnectionEventsRequest.newBuilder() * .setChannelConnection("channelConnection-1932021695") * .addAllEvents(new ArrayList()) + * .addAllTextEvents(new ArrayList()) * .build(); * ApiFuture future = * publisherClient.publishChannelConnectionEventsCallable().futureCall(request); @@ -264,6 +267,7 @@ public final PublishChannelConnectionEventsResponse publishChannelConnectionEven * PublishEventsRequest.newBuilder() * .setChannel("channel738950403") * .addAllEvents(new ArrayList()) + * .addAllTextEvents(new ArrayList()) * .build(); * PublishEventsResponse response = publisherClient.publishEvents(request); * } @@ -293,6 +297,7 @@ public final PublishEventsResponse publishEvents(PublishEventsRequest request) { * PublishEventsRequest.newBuilder() * .setChannel("channel738950403") * .addAllEvents(new ArrayList()) + * .addAllTextEvents(new ArrayList()) * .build(); * ApiFuture future = * publisherClient.publishEventsCallable().futureCall(request); diff --git a/java-eventarc-publishing/google-cloud-eventarc-publishing/src/main/java/com/google/cloud/eventarc/publishing/v1/package-info.java b/java-eventarc-publishing/google-cloud-eventarc-publishing/src/main/java/com/google/cloud/eventarc/publishing/v1/package-info.java index 306671e57e64..52c80bacaec5 100644 --- a/java-eventarc-publishing/google-cloud-eventarc-publishing/src/main/java/com/google/cloud/eventarc/publishing/v1/package-info.java +++ b/java-eventarc-publishing/google-cloud-eventarc-publishing/src/main/java/com/google/cloud/eventarc/publishing/v1/package-info.java @@ -56,6 +56,7 @@ * PublishChannelConnectionEventsRequest.newBuilder() * .setChannelConnection("channelConnection-1932021695") * .addAllEvents(new ArrayList()) + * .addAllTextEvents(new ArrayList()) * .build(); * PublishChannelConnectionEventsResponse response = * publisherClient.publishChannelConnectionEvents(request); diff --git a/java-eventarc-publishing/google-cloud-eventarc-publishing/src/test/java/com/google/cloud/eventarc/publishing/v1/PublisherClientHttpJsonTest.java b/java-eventarc-publishing/google-cloud-eventarc-publishing/src/test/java/com/google/cloud/eventarc/publishing/v1/PublisherClientHttpJsonTest.java index 0ee976880785..4805d2542a5c 100644 --- a/java-eventarc-publishing/google-cloud-eventarc-publishing/src/test/java/com/google/cloud/eventarc/publishing/v1/PublisherClientHttpJsonTest.java +++ b/java-eventarc-publishing/google-cloud-eventarc-publishing/src/test/java/com/google/cloud/eventarc/publishing/v1/PublisherClientHttpJsonTest.java @@ -83,6 +83,7 @@ public void publishChannelConnectionEventsTest() throws Exception { .setChannelConnection( "projects/project-748/locations/location-748/channelConnections/channelConnection-748") .addAllEvents(new ArrayList()) + .addAllTextEvents(new ArrayList()) .build(); PublishChannelConnectionEventsResponse actualResponse = @@ -117,6 +118,7 @@ public void publishChannelConnectionEventsExceptionTest() throws Exception { .setChannelConnection( "projects/project-748/locations/location-748/channelConnections/channelConnection-748") .addAllEvents(new ArrayList()) + .addAllTextEvents(new ArrayList()) .build(); client.publishChannelConnectionEvents(request); Assert.fail("No exception raised"); @@ -134,6 +136,7 @@ public void publishEventsTest() throws Exception { PublishEventsRequest.newBuilder() .setChannel("projects/project-2616/locations/location-2616/channels/channel-2616") .addAllEvents(new ArrayList()) + .addAllTextEvents(new ArrayList()) .build(); PublishEventsResponse actualResponse = client.publishEvents(request); @@ -166,6 +169,7 @@ public void publishEventsExceptionTest() throws Exception { PublishEventsRequest.newBuilder() .setChannel("projects/project-2616/locations/location-2616/channels/channel-2616") .addAllEvents(new ArrayList()) + .addAllTextEvents(new ArrayList()) .build(); client.publishEvents(request); Assert.fail("No exception raised"); diff --git a/java-eventarc-publishing/google-cloud-eventarc-publishing/src/test/java/com/google/cloud/eventarc/publishing/v1/PublisherClientTest.java b/java-eventarc-publishing/google-cloud-eventarc-publishing/src/test/java/com/google/cloud/eventarc/publishing/v1/PublisherClientTest.java index 15dafbd3d743..7e425614f985 100644 --- a/java-eventarc-publishing/google-cloud-eventarc-publishing/src/test/java/com/google/cloud/eventarc/publishing/v1/PublisherClientTest.java +++ b/java-eventarc-publishing/google-cloud-eventarc-publishing/src/test/java/com/google/cloud/eventarc/publishing/v1/PublisherClientTest.java @@ -87,6 +87,7 @@ public void publishChannelConnectionEventsTest() throws Exception { PublishChannelConnectionEventsRequest.newBuilder() .setChannelConnection("channelConnection-1932021695") .addAllEvents(new ArrayList()) + .addAllTextEvents(new ArrayList()) .build(); PublishChannelConnectionEventsResponse actualResponse = @@ -100,6 +101,7 @@ public void publishChannelConnectionEventsTest() throws Exception { Assert.assertEquals(request.getChannelConnection(), actualRequest.getChannelConnection()); Assert.assertEquals(request.getEventsList(), actualRequest.getEventsList()); + Assert.assertEquals(request.getTextEventsList(), actualRequest.getTextEventsList()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -116,6 +118,7 @@ public void publishChannelConnectionEventsExceptionTest() throws Exception { PublishChannelConnectionEventsRequest.newBuilder() .setChannelConnection("channelConnection-1932021695") .addAllEvents(new ArrayList()) + .addAllTextEvents(new ArrayList()) .build(); client.publishChannelConnectionEvents(request); Assert.fail("No exception raised"); @@ -133,6 +136,7 @@ public void publishEventsTest() throws Exception { PublishEventsRequest.newBuilder() .setChannel("channel738950403") .addAllEvents(new ArrayList()) + .addAllTextEvents(new ArrayList()) .build(); PublishEventsResponse actualResponse = client.publishEvents(request); @@ -144,6 +148,7 @@ public void publishEventsTest() throws Exception { Assert.assertEquals(request.getChannel(), actualRequest.getChannel()); Assert.assertEquals(request.getEventsList(), actualRequest.getEventsList()); + Assert.assertEquals(request.getTextEventsList(), actualRequest.getTextEventsList()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -160,6 +165,7 @@ public void publishEventsExceptionTest() throws Exception { PublishEventsRequest.newBuilder() .setChannel("channel738950403") .addAllEvents(new ArrayList()) + .addAllTextEvents(new ArrayList()) .build(); client.publishEvents(request); Assert.fail("No exception raised"); diff --git a/java-eventarc-publishing/proto-google-cloud-eventarc-publishing-v1/src/main/java/com/google/cloud/eventarc/publishing/v1/PublishChannelConnectionEventsRequest.java b/java-eventarc-publishing/proto-google-cloud-eventarc-publishing-v1/src/main/java/com/google/cloud/eventarc/publishing/v1/PublishChannelConnectionEventsRequest.java index c6357554e3a7..ba5a84e2afa6 100644 --- a/java-eventarc-publishing/proto-google-cloud-eventarc-publishing-v1/src/main/java/com/google/cloud/eventarc/publishing/v1/PublishChannelConnectionEventsRequest.java +++ b/java-eventarc-publishing/proto-google-cloud-eventarc-publishing-v1/src/main/java/com/google/cloud/eventarc/publishing/v1/PublishChannelConnectionEventsRequest.java @@ -42,6 +42,7 @@ private PublishChannelConnectionEventsRequest( private PublishChannelConnectionEventsRequest() { channelConnection_ = ""; events_ = java.util.Collections.emptyList(); + textEvents_ = com.google.protobuf.LazyStringArrayList.EMPTY; } @java.lang.Override @@ -129,6 +130,7 @@ public com.google.protobuf.ByteString getChannelConnectionBytes() { * *
    * The CloudEvents v1.0 events to publish. No other types are allowed.
+   * If this field is set, then the `text_events` fields must not be set.
    * 
* * repeated .google.protobuf.Any events = 2; @@ -142,6 +144,7 @@ public java.util.List getEventsList() { * *
    * The CloudEvents v1.0 events to publish. No other types are allowed.
+   * If this field is set, then the `text_events` fields must not be set.
    * 
* * repeated .google.protobuf.Any events = 2; @@ -155,6 +158,7 @@ public java.util.List getEventsOrBui * *
    * The CloudEvents v1.0 events to publish. No other types are allowed.
+   * If this field is set, then the `text_events` fields must not be set.
    * 
* * repeated .google.protobuf.Any events = 2; @@ -168,6 +172,7 @@ public int getEventsCount() { * *
    * The CloudEvents v1.0 events to publish. No other types are allowed.
+   * If this field is set, then the `text_events` fields must not be set.
    * 
* * repeated .google.protobuf.Any events = 2; @@ -181,6 +186,7 @@ public com.google.protobuf.Any getEvents(int index) { * *
    * The CloudEvents v1.0 events to publish. No other types are allowed.
+   * If this field is set, then the `text_events` fields must not be set.
    * 
* * repeated .google.protobuf.Any events = 2; @@ -190,6 +196,83 @@ public com.google.protobuf.AnyOrBuilder getEventsOrBuilder(int index) { return events_.get(index); } + public static final int TEXT_EVENTS_FIELD_NUMBER = 3; + private com.google.protobuf.LazyStringList textEvents_; + /** + * + * + *
+   * The text representation of events to publish.
+   * CloudEvent v1.0 in JSON format is the only allowed type. Refer to
+   * https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/formats/json-format.md
+   * for specification.
+   * If this field is set, then the `events` fields must not be set.
+   * 
+ * + * repeated string text_events = 3; + * + * @return A list containing the textEvents. + */ + public com.google.protobuf.ProtocolStringList getTextEventsList() { + return textEvents_; + } + /** + * + * + *
+   * The text representation of events to publish.
+   * CloudEvent v1.0 in JSON format is the only allowed type. Refer to
+   * https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/formats/json-format.md
+   * for specification.
+   * If this field is set, then the `events` fields must not be set.
+   * 
+ * + * repeated string text_events = 3; + * + * @return The count of textEvents. + */ + public int getTextEventsCount() { + return textEvents_.size(); + } + /** + * + * + *
+   * The text representation of events to publish.
+   * CloudEvent v1.0 in JSON format is the only allowed type. Refer to
+   * https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/formats/json-format.md
+   * for specification.
+   * If this field is set, then the `events` fields must not be set.
+   * 
+ * + * repeated string text_events = 3; + * + * @param index The index of the element to return. + * @return The textEvents at the given index. + */ + public java.lang.String getTextEvents(int index) { + return textEvents_.get(index); + } + /** + * + * + *
+   * The text representation of events to publish.
+   * CloudEvent v1.0 in JSON format is the only allowed type. Refer to
+   * https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/formats/json-format.md
+   * for specification.
+   * If this field is set, then the `events` fields must not be set.
+   * 
+ * + * repeated string text_events = 3; + * + * @param index The index of the value to return. + * @return The bytes of the textEvents at the given index. + */ + public com.google.protobuf.ByteString getTextEventsBytes(int index) { + return textEvents_.getByteString(index); + } + private byte memoizedIsInitialized = -1; @java.lang.Override @@ -210,6 +293,9 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io for (int i = 0; i < events_.size(); i++) { output.writeMessage(2, events_.get(i)); } + for (int i = 0; i < textEvents_.size(); i++) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, textEvents_.getRaw(i)); + } getUnknownFields().writeTo(output); } @@ -225,6 +311,14 @@ public int getSerializedSize() { for (int i = 0; i < events_.size(); i++) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, events_.get(i)); } + { + int dataSize = 0; + for (int i = 0; i < textEvents_.size(); i++) { + dataSize += computeStringSizeNoTag(textEvents_.getRaw(i)); + } + size += dataSize; + size += 1 * getTextEventsList().size(); + } size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -244,6 +338,7 @@ public boolean equals(final java.lang.Object obj) { if (!getChannelConnection().equals(other.getChannelConnection())) return false; if (!getEventsList().equals(other.getEventsList())) return false; + if (!getTextEventsList().equals(other.getTextEventsList())) return false; if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -261,6 +356,10 @@ public int hashCode() { hash = (37 * hash) + EVENTS_FIELD_NUMBER; hash = (53 * hash) + getEventsList().hashCode(); } + if (getTextEventsCount() > 0) { + hash = (37 * hash) + TEXT_EVENTS_FIELD_NUMBER; + hash = (53 * hash) + getTextEventsList().hashCode(); + } hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; @@ -417,6 +516,8 @@ public Builder clear() { eventsBuilder_.clear(); } bitField0_ = (bitField0_ & ~0x00000001); + textEvents_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000002); return this; } @@ -459,6 +560,11 @@ public com.google.cloud.eventarc.publishing.v1.PublishChannelConnectionEventsReq } else { result.events_ = eventsBuilder_.build(); } + if (((bitField0_ & 0x00000002) != 0)) { + textEvents_ = textEvents_.getUnmodifiableView(); + bitField0_ = (bitField0_ & ~0x00000002); + } + result.textEvents_ = textEvents_; onBuilt(); return result; } @@ -545,6 +651,16 @@ public Builder mergeFrom( } } } + if (!other.textEvents_.isEmpty()) { + if (textEvents_.isEmpty()) { + textEvents_ = other.textEvents_; + bitField0_ = (bitField0_ & ~0x00000002); + } else { + ensureTextEventsIsMutable(); + textEvents_.addAll(other.textEvents_); + } + onChanged(); + } this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; @@ -589,6 +705,13 @@ public Builder mergeFrom( } break; } // case 18 + case 26: + { + java.lang.String s = input.readStringRequireUtf8(); + ensureTextEventsIsMutable(); + textEvents_.add(s); + break; + } // case 26 default: { if (!super.parseUnknownField(input, extensionRegistry, tag)) { @@ -739,6 +862,7 @@ private void ensureEventsIsMutable() { * *
      * The CloudEvents v1.0 events to publish. No other types are allowed.
+     * If this field is set, then the `text_events` fields must not be set.
      * 
* * repeated .google.protobuf.Any events = 2; @@ -755,6 +879,7 @@ public java.util.List getEventsList() { * *
      * The CloudEvents v1.0 events to publish. No other types are allowed.
+     * If this field is set, then the `text_events` fields must not be set.
      * 
* * repeated .google.protobuf.Any events = 2; @@ -771,6 +896,7 @@ public int getEventsCount() { * *
      * The CloudEvents v1.0 events to publish. No other types are allowed.
+     * If this field is set, then the `text_events` fields must not be set.
      * 
* * repeated .google.protobuf.Any events = 2; @@ -787,6 +913,7 @@ public com.google.protobuf.Any getEvents(int index) { * *
      * The CloudEvents v1.0 events to publish. No other types are allowed.
+     * If this field is set, then the `text_events` fields must not be set.
      * 
* * repeated .google.protobuf.Any events = 2; @@ -809,6 +936,7 @@ public Builder setEvents(int index, com.google.protobuf.Any value) { * *
      * The CloudEvents v1.0 events to publish. No other types are allowed.
+     * If this field is set, then the `text_events` fields must not be set.
      * 
* * repeated .google.protobuf.Any events = 2; @@ -828,6 +956,7 @@ public Builder setEvents(int index, com.google.protobuf.Any.Builder builderForVa * *
      * The CloudEvents v1.0 events to publish. No other types are allowed.
+     * If this field is set, then the `text_events` fields must not be set.
      * 
* * repeated .google.protobuf.Any events = 2; @@ -850,6 +979,7 @@ public Builder addEvents(com.google.protobuf.Any value) { * *
      * The CloudEvents v1.0 events to publish. No other types are allowed.
+     * If this field is set, then the `text_events` fields must not be set.
      * 
* * repeated .google.protobuf.Any events = 2; @@ -872,6 +1002,7 @@ public Builder addEvents(int index, com.google.protobuf.Any value) { * *
      * The CloudEvents v1.0 events to publish. No other types are allowed.
+     * If this field is set, then the `text_events` fields must not be set.
      * 
* * repeated .google.protobuf.Any events = 2; @@ -891,6 +1022,7 @@ public Builder addEvents(com.google.protobuf.Any.Builder builderForValue) { * *
      * The CloudEvents v1.0 events to publish. No other types are allowed.
+     * If this field is set, then the `text_events` fields must not be set.
      * 
* * repeated .google.protobuf.Any events = 2; @@ -910,6 +1042,7 @@ public Builder addEvents(int index, com.google.protobuf.Any.Builder builderForVa * *
      * The CloudEvents v1.0 events to publish. No other types are allowed.
+     * If this field is set, then the `text_events` fields must not be set.
      * 
* * repeated .google.protobuf.Any events = 2; @@ -929,6 +1062,7 @@ public Builder addAllEvents(java.lang.Iterable * The CloudEvents v1.0 events to publish. No other types are allowed. + * If this field is set, then the `text_events` fields must not be set. * * * repeated .google.protobuf.Any events = 2; @@ -948,6 +1082,7 @@ public Builder clearEvents() { * *
      * The CloudEvents v1.0 events to publish. No other types are allowed.
+     * If this field is set, then the `text_events` fields must not be set.
      * 
* * repeated .google.protobuf.Any events = 2; @@ -967,6 +1102,7 @@ public Builder removeEvents(int index) { * *
      * The CloudEvents v1.0 events to publish. No other types are allowed.
+     * If this field is set, then the `text_events` fields must not be set.
      * 
* * repeated .google.protobuf.Any events = 2; @@ -979,6 +1115,7 @@ public com.google.protobuf.Any.Builder getEventsBuilder(int index) { * *
      * The CloudEvents v1.0 events to publish. No other types are allowed.
+     * If this field is set, then the `text_events` fields must not be set.
      * 
* * repeated .google.protobuf.Any events = 2; @@ -995,6 +1132,7 @@ public com.google.protobuf.AnyOrBuilder getEventsOrBuilder(int index) { * *
      * The CloudEvents v1.0 events to publish. No other types are allowed.
+     * If this field is set, then the `text_events` fields must not be set.
      * 
* * repeated .google.protobuf.Any events = 2; @@ -1011,6 +1149,7 @@ public java.util.List getEventsOrBui * *
      * The CloudEvents v1.0 events to publish. No other types are allowed.
+     * If this field is set, then the `text_events` fields must not be set.
      * 
* * repeated .google.protobuf.Any events = 2; @@ -1023,6 +1162,7 @@ public com.google.protobuf.Any.Builder addEventsBuilder() { * *
      * The CloudEvents v1.0 events to publish. No other types are allowed.
+     * If this field is set, then the `text_events` fields must not be set.
      * 
* * repeated .google.protobuf.Any events = 2; @@ -1036,6 +1176,7 @@ public com.google.protobuf.Any.Builder addEventsBuilder(int index) { * *
      * The CloudEvents v1.0 events to publish. No other types are allowed.
+     * If this field is set, then the `text_events` fields must not be set.
      * 
* * repeated .google.protobuf.Any events = 2; @@ -1061,6 +1202,210 @@ public java.util.List getEventsBuilderList() { return eventsBuilder_; } + private com.google.protobuf.LazyStringList textEvents_ = + com.google.protobuf.LazyStringArrayList.EMPTY; + + private void ensureTextEventsIsMutable() { + if (!((bitField0_ & 0x00000002) != 0)) { + textEvents_ = new com.google.protobuf.LazyStringArrayList(textEvents_); + bitField0_ |= 0x00000002; + } + } + /** + * + * + *
+     * The text representation of events to publish.
+     * CloudEvent v1.0 in JSON format is the only allowed type. Refer to
+     * https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/formats/json-format.md
+     * for specification.
+     * If this field is set, then the `events` fields must not be set.
+     * 
+ * + * repeated string text_events = 3; + * + * @return A list containing the textEvents. + */ + public com.google.protobuf.ProtocolStringList getTextEventsList() { + return textEvents_.getUnmodifiableView(); + } + /** + * + * + *
+     * The text representation of events to publish.
+     * CloudEvent v1.0 in JSON format is the only allowed type. Refer to
+     * https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/formats/json-format.md
+     * for specification.
+     * If this field is set, then the `events` fields must not be set.
+     * 
+ * + * repeated string text_events = 3; + * + * @return The count of textEvents. + */ + public int getTextEventsCount() { + return textEvents_.size(); + } + /** + * + * + *
+     * The text representation of events to publish.
+     * CloudEvent v1.0 in JSON format is the only allowed type. Refer to
+     * https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/formats/json-format.md
+     * for specification.
+     * If this field is set, then the `events` fields must not be set.
+     * 
+ * + * repeated string text_events = 3; + * + * @param index The index of the element to return. + * @return The textEvents at the given index. + */ + public java.lang.String getTextEvents(int index) { + return textEvents_.get(index); + } + /** + * + * + *
+     * The text representation of events to publish.
+     * CloudEvent v1.0 in JSON format is the only allowed type. Refer to
+     * https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/formats/json-format.md
+     * for specification.
+     * If this field is set, then the `events` fields must not be set.
+     * 
+ * + * repeated string text_events = 3; + * + * @param index The index of the value to return. + * @return The bytes of the textEvents at the given index. + */ + public com.google.protobuf.ByteString getTextEventsBytes(int index) { + return textEvents_.getByteString(index); + } + /** + * + * + *
+     * The text representation of events to publish.
+     * CloudEvent v1.0 in JSON format is the only allowed type. Refer to
+     * https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/formats/json-format.md
+     * for specification.
+     * If this field is set, then the `events` fields must not be set.
+     * 
+ * + * repeated string text_events = 3; + * + * @param index The index to set the value at. + * @param value The textEvents to set. + * @return This builder for chaining. + */ + public Builder setTextEvents(int index, java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureTextEventsIsMutable(); + textEvents_.set(index, value); + onChanged(); + return this; + } + /** + * + * + *
+     * The text representation of events to publish.
+     * CloudEvent v1.0 in JSON format is the only allowed type. Refer to
+     * https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/formats/json-format.md
+     * for specification.
+     * If this field is set, then the `events` fields must not be set.
+     * 
+ * + * repeated string text_events = 3; + * + * @param value The textEvents to add. + * @return This builder for chaining. + */ + public Builder addTextEvents(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureTextEventsIsMutable(); + textEvents_.add(value); + onChanged(); + return this; + } + /** + * + * + *
+     * The text representation of events to publish.
+     * CloudEvent v1.0 in JSON format is the only allowed type. Refer to
+     * https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/formats/json-format.md
+     * for specification.
+     * If this field is set, then the `events` fields must not be set.
+     * 
+ * + * repeated string text_events = 3; + * + * @param values The textEvents to add. + * @return This builder for chaining. + */ + public Builder addAllTextEvents(java.lang.Iterable values) { + ensureTextEventsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, textEvents_); + onChanged(); + return this; + } + /** + * + * + *
+     * The text representation of events to publish.
+     * CloudEvent v1.0 in JSON format is the only allowed type. Refer to
+     * https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/formats/json-format.md
+     * for specification.
+     * If this field is set, then the `events` fields must not be set.
+     * 
+ * + * repeated string text_events = 3; + * + * @return This builder for chaining. + */ + public Builder clearTextEvents() { + textEvents_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + /** + * + * + *
+     * The text representation of events to publish.
+     * CloudEvent v1.0 in JSON format is the only allowed type. Refer to
+     * https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/formats/json-format.md
+     * for specification.
+     * If this field is set, then the `events` fields must not be set.
+     * 
+ * + * repeated string text_events = 3; + * + * @param value The bytes of the textEvents to add. + * @return This builder for chaining. + */ + public Builder addTextEventsBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + ensureTextEventsIsMutable(); + textEvents_.add(value); + onChanged(); + return this; + } + @java.lang.Override public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { return super.setUnknownFields(unknownFields); diff --git a/java-eventarc-publishing/proto-google-cloud-eventarc-publishing-v1/src/main/java/com/google/cloud/eventarc/publishing/v1/PublishChannelConnectionEventsRequestOrBuilder.java b/java-eventarc-publishing/proto-google-cloud-eventarc-publishing-v1/src/main/java/com/google/cloud/eventarc/publishing/v1/PublishChannelConnectionEventsRequestOrBuilder.java index 10e6d565a4ce..abded7434e14 100644 --- a/java-eventarc-publishing/proto-google-cloud-eventarc-publishing-v1/src/main/java/com/google/cloud/eventarc/publishing/v1/PublishChannelConnectionEventsRequestOrBuilder.java +++ b/java-eventarc-publishing/proto-google-cloud-eventarc-publishing-v1/src/main/java/com/google/cloud/eventarc/publishing/v1/PublishChannelConnectionEventsRequestOrBuilder.java @@ -55,6 +55,7 @@ public interface PublishChannelConnectionEventsRequestOrBuilder * *
    * The CloudEvents v1.0 events to publish. No other types are allowed.
+   * If this field is set, then the `text_events` fields must not be set.
    * 
* * repeated .google.protobuf.Any events = 2; @@ -65,6 +66,7 @@ public interface PublishChannelConnectionEventsRequestOrBuilder * *
    * The CloudEvents v1.0 events to publish. No other types are allowed.
+   * If this field is set, then the `text_events` fields must not be set.
    * 
* * repeated .google.protobuf.Any events = 2; @@ -75,6 +77,7 @@ public interface PublishChannelConnectionEventsRequestOrBuilder * *
    * The CloudEvents v1.0 events to publish. No other types are allowed.
+   * If this field is set, then the `text_events` fields must not be set.
    * 
* * repeated .google.protobuf.Any events = 2; @@ -85,6 +88,7 @@ public interface PublishChannelConnectionEventsRequestOrBuilder * *
    * The CloudEvents v1.0 events to publish. No other types are allowed.
+   * If this field is set, then the `text_events` fields must not be set.
    * 
* * repeated .google.protobuf.Any events = 2; @@ -95,9 +99,77 @@ public interface PublishChannelConnectionEventsRequestOrBuilder * *
    * The CloudEvents v1.0 events to publish. No other types are allowed.
+   * If this field is set, then the `text_events` fields must not be set.
    * 
* * repeated .google.protobuf.Any events = 2; */ com.google.protobuf.AnyOrBuilder getEventsOrBuilder(int index); + + /** + * + * + *
+   * The text representation of events to publish.
+   * CloudEvent v1.0 in JSON format is the only allowed type. Refer to
+   * https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/formats/json-format.md
+   * for specification.
+   * If this field is set, then the `events` fields must not be set.
+   * 
+ * + * repeated string text_events = 3; + * + * @return A list containing the textEvents. + */ + java.util.List getTextEventsList(); + /** + * + * + *
+   * The text representation of events to publish.
+   * CloudEvent v1.0 in JSON format is the only allowed type. Refer to
+   * https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/formats/json-format.md
+   * for specification.
+   * If this field is set, then the `events` fields must not be set.
+   * 
+ * + * repeated string text_events = 3; + * + * @return The count of textEvents. + */ + int getTextEventsCount(); + /** + * + * + *
+   * The text representation of events to publish.
+   * CloudEvent v1.0 in JSON format is the only allowed type. Refer to
+   * https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/formats/json-format.md
+   * for specification.
+   * If this field is set, then the `events` fields must not be set.
+   * 
+ * + * repeated string text_events = 3; + * + * @param index The index of the element to return. + * @return The textEvents at the given index. + */ + java.lang.String getTextEvents(int index); + /** + * + * + *
+   * The text representation of events to publish.
+   * CloudEvent v1.0 in JSON format is the only allowed type. Refer to
+   * https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/formats/json-format.md
+   * for specification.
+   * If this field is set, then the `events` fields must not be set.
+   * 
+ * + * repeated string text_events = 3; + * + * @param index The index of the value to return. + * @return The bytes of the textEvents at the given index. + */ + com.google.protobuf.ByteString getTextEventsBytes(int index); } diff --git a/java-eventarc-publishing/proto-google-cloud-eventarc-publishing-v1/src/main/java/com/google/cloud/eventarc/publishing/v1/PublishEventsRequest.java b/java-eventarc-publishing/proto-google-cloud-eventarc-publishing-v1/src/main/java/com/google/cloud/eventarc/publishing/v1/PublishEventsRequest.java index 6e993494948a..a83d10300d59 100644 --- a/java-eventarc-publishing/proto-google-cloud-eventarc-publishing-v1/src/main/java/com/google/cloud/eventarc/publishing/v1/PublishEventsRequest.java +++ b/java-eventarc-publishing/proto-google-cloud-eventarc-publishing-v1/src/main/java/com/google/cloud/eventarc/publishing/v1/PublishEventsRequest.java @@ -40,6 +40,7 @@ private PublishEventsRequest(com.google.protobuf.GeneratedMessageV3.Builder b private PublishEventsRequest() { channel_ = ""; events_ = java.util.Collections.emptyList(); + textEvents_ = com.google.protobuf.LazyStringArrayList.EMPTY; } @java.lang.Override @@ -126,6 +127,7 @@ public com.google.protobuf.ByteString getChannelBytes() { * *
    * The CloudEvents v1.0 events to publish. No other types are allowed.
+   * If this field is set, then the `text_events` fields must not be set.
    * 
* * repeated .google.protobuf.Any events = 2; @@ -139,6 +141,7 @@ public java.util.List getEventsList() { * *
    * The CloudEvents v1.0 events to publish. No other types are allowed.
+   * If this field is set, then the `text_events` fields must not be set.
    * 
* * repeated .google.protobuf.Any events = 2; @@ -152,6 +155,7 @@ public java.util.List getEventsOrBui * *
    * The CloudEvents v1.0 events to publish. No other types are allowed.
+   * If this field is set, then the `text_events` fields must not be set.
    * 
* * repeated .google.protobuf.Any events = 2; @@ -165,6 +169,7 @@ public int getEventsCount() { * *
    * The CloudEvents v1.0 events to publish. No other types are allowed.
+   * If this field is set, then the `text_events` fields must not be set.
    * 
* * repeated .google.protobuf.Any events = 2; @@ -178,6 +183,7 @@ public com.google.protobuf.Any getEvents(int index) { * *
    * The CloudEvents v1.0 events to publish. No other types are allowed.
+   * If this field is set, then the `text_events` fields must not be set.
    * 
* * repeated .google.protobuf.Any events = 2; @@ -187,6 +193,83 @@ public com.google.protobuf.AnyOrBuilder getEventsOrBuilder(int index) { return events_.get(index); } + public static final int TEXT_EVENTS_FIELD_NUMBER = 3; + private com.google.protobuf.LazyStringList textEvents_; + /** + * + * + *
+   * The text representation of events to publish.
+   * CloudEvent v1.0 in JSON format is the only allowed type. Refer to
+   * https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/formats/json-format.md
+   * for specification.
+   * If this field is set, then the `events` fields must not be set.
+   * 
+ * + * repeated string text_events = 3; + * + * @return A list containing the textEvents. + */ + public com.google.protobuf.ProtocolStringList getTextEventsList() { + return textEvents_; + } + /** + * + * + *
+   * The text representation of events to publish.
+   * CloudEvent v1.0 in JSON format is the only allowed type. Refer to
+   * https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/formats/json-format.md
+   * for specification.
+   * If this field is set, then the `events` fields must not be set.
+   * 
+ * + * repeated string text_events = 3; + * + * @return The count of textEvents. + */ + public int getTextEventsCount() { + return textEvents_.size(); + } + /** + * + * + *
+   * The text representation of events to publish.
+   * CloudEvent v1.0 in JSON format is the only allowed type. Refer to
+   * https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/formats/json-format.md
+   * for specification.
+   * If this field is set, then the `events` fields must not be set.
+   * 
+ * + * repeated string text_events = 3; + * + * @param index The index of the element to return. + * @return The textEvents at the given index. + */ + public java.lang.String getTextEvents(int index) { + return textEvents_.get(index); + } + /** + * + * + *
+   * The text representation of events to publish.
+   * CloudEvent v1.0 in JSON format is the only allowed type. Refer to
+   * https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/formats/json-format.md
+   * for specification.
+   * If this field is set, then the `events` fields must not be set.
+   * 
+ * + * repeated string text_events = 3; + * + * @param index The index of the value to return. + * @return The bytes of the textEvents at the given index. + */ + public com.google.protobuf.ByteString getTextEventsBytes(int index) { + return textEvents_.getByteString(index); + } + private byte memoizedIsInitialized = -1; @java.lang.Override @@ -207,6 +290,9 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io for (int i = 0; i < events_.size(); i++) { output.writeMessage(2, events_.get(i)); } + for (int i = 0; i < textEvents_.size(); i++) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, textEvents_.getRaw(i)); + } getUnknownFields().writeTo(output); } @@ -222,6 +308,14 @@ public int getSerializedSize() { for (int i = 0; i < events_.size(); i++) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, events_.get(i)); } + { + int dataSize = 0; + for (int i = 0; i < textEvents_.size(); i++) { + dataSize += computeStringSizeNoTag(textEvents_.getRaw(i)); + } + size += dataSize; + size += 1 * getTextEventsList().size(); + } size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -240,6 +334,7 @@ public boolean equals(final java.lang.Object obj) { if (!getChannel().equals(other.getChannel())) return false; if (!getEventsList().equals(other.getEventsList())) return false; + if (!getTextEventsList().equals(other.getTextEventsList())) return false; if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -257,6 +352,10 @@ public int hashCode() { hash = (37 * hash) + EVENTS_FIELD_NUMBER; hash = (53 * hash) + getEventsList().hashCode(); } + if (getTextEventsCount() > 0) { + hash = (37 * hash) + TEXT_EVENTS_FIELD_NUMBER; + hash = (53 * hash) + getTextEventsList().hashCode(); + } hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; @@ -405,6 +504,8 @@ public Builder clear() { eventsBuilder_.clear(); } bitField0_ = (bitField0_ & ~0x00000001); + textEvents_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000002); return this; } @@ -444,6 +545,11 @@ public com.google.cloud.eventarc.publishing.v1.PublishEventsRequest buildPartial } else { result.events_ = eventsBuilder_.build(); } + if (((bitField0_ & 0x00000002) != 0)) { + textEvents_ = textEvents_.getUnmodifiableView(); + bitField0_ = (bitField0_ & ~0x00000002); + } + result.textEvents_ = textEvents_; onBuilt(); return result; } @@ -526,6 +632,16 @@ public Builder mergeFrom(com.google.cloud.eventarc.publishing.v1.PublishEventsRe } } } + if (!other.textEvents_.isEmpty()) { + if (textEvents_.isEmpty()) { + textEvents_ = other.textEvents_; + bitField0_ = (bitField0_ & ~0x00000002); + } else { + ensureTextEventsIsMutable(); + textEvents_.addAll(other.textEvents_); + } + onChanged(); + } this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; @@ -570,6 +686,13 @@ public Builder mergeFrom( } break; } // case 18 + case 26: + { + java.lang.String s = input.readStringRequireUtf8(); + ensureTextEventsIsMutable(); + textEvents_.add(s); + break; + } // case 26 default: { if (!super.parseUnknownField(input, extensionRegistry, tag)) { @@ -720,6 +843,7 @@ private void ensureEventsIsMutable() { * *
      * The CloudEvents v1.0 events to publish. No other types are allowed.
+     * If this field is set, then the `text_events` fields must not be set.
      * 
* * repeated .google.protobuf.Any events = 2; @@ -736,6 +860,7 @@ public java.util.List getEventsList() { * *
      * The CloudEvents v1.0 events to publish. No other types are allowed.
+     * If this field is set, then the `text_events` fields must not be set.
      * 
* * repeated .google.protobuf.Any events = 2; @@ -752,6 +877,7 @@ public int getEventsCount() { * *
      * The CloudEvents v1.0 events to publish. No other types are allowed.
+     * If this field is set, then the `text_events` fields must not be set.
      * 
* * repeated .google.protobuf.Any events = 2; @@ -768,6 +894,7 @@ public com.google.protobuf.Any getEvents(int index) { * *
      * The CloudEvents v1.0 events to publish. No other types are allowed.
+     * If this field is set, then the `text_events` fields must not be set.
      * 
* * repeated .google.protobuf.Any events = 2; @@ -790,6 +917,7 @@ public Builder setEvents(int index, com.google.protobuf.Any value) { * *
      * The CloudEvents v1.0 events to publish. No other types are allowed.
+     * If this field is set, then the `text_events` fields must not be set.
      * 
* * repeated .google.protobuf.Any events = 2; @@ -809,6 +937,7 @@ public Builder setEvents(int index, com.google.protobuf.Any.Builder builderForVa * *
      * The CloudEvents v1.0 events to publish. No other types are allowed.
+     * If this field is set, then the `text_events` fields must not be set.
      * 
* * repeated .google.protobuf.Any events = 2; @@ -831,6 +960,7 @@ public Builder addEvents(com.google.protobuf.Any value) { * *
      * The CloudEvents v1.0 events to publish. No other types are allowed.
+     * If this field is set, then the `text_events` fields must not be set.
      * 
* * repeated .google.protobuf.Any events = 2; @@ -853,6 +983,7 @@ public Builder addEvents(int index, com.google.protobuf.Any value) { * *
      * The CloudEvents v1.0 events to publish. No other types are allowed.
+     * If this field is set, then the `text_events` fields must not be set.
      * 
* * repeated .google.protobuf.Any events = 2; @@ -872,6 +1003,7 @@ public Builder addEvents(com.google.protobuf.Any.Builder builderForValue) { * *
      * The CloudEvents v1.0 events to publish. No other types are allowed.
+     * If this field is set, then the `text_events` fields must not be set.
      * 
* * repeated .google.protobuf.Any events = 2; @@ -891,6 +1023,7 @@ public Builder addEvents(int index, com.google.protobuf.Any.Builder builderForVa * *
      * The CloudEvents v1.0 events to publish. No other types are allowed.
+     * If this field is set, then the `text_events` fields must not be set.
      * 
* * repeated .google.protobuf.Any events = 2; @@ -910,6 +1043,7 @@ public Builder addAllEvents(java.lang.Iterable * The CloudEvents v1.0 events to publish. No other types are allowed. + * If this field is set, then the `text_events` fields must not be set. * * * repeated .google.protobuf.Any events = 2; @@ -929,6 +1063,7 @@ public Builder clearEvents() { * *
      * The CloudEvents v1.0 events to publish. No other types are allowed.
+     * If this field is set, then the `text_events` fields must not be set.
      * 
* * repeated .google.protobuf.Any events = 2; @@ -948,6 +1083,7 @@ public Builder removeEvents(int index) { * *
      * The CloudEvents v1.0 events to publish. No other types are allowed.
+     * If this field is set, then the `text_events` fields must not be set.
      * 
* * repeated .google.protobuf.Any events = 2; @@ -960,6 +1096,7 @@ public com.google.protobuf.Any.Builder getEventsBuilder(int index) { * *
      * The CloudEvents v1.0 events to publish. No other types are allowed.
+     * If this field is set, then the `text_events` fields must not be set.
      * 
* * repeated .google.protobuf.Any events = 2; @@ -976,6 +1113,7 @@ public com.google.protobuf.AnyOrBuilder getEventsOrBuilder(int index) { * *
      * The CloudEvents v1.0 events to publish. No other types are allowed.
+     * If this field is set, then the `text_events` fields must not be set.
      * 
* * repeated .google.protobuf.Any events = 2; @@ -992,6 +1130,7 @@ public java.util.List getEventsOrBui * *
      * The CloudEvents v1.0 events to publish. No other types are allowed.
+     * If this field is set, then the `text_events` fields must not be set.
      * 
* * repeated .google.protobuf.Any events = 2; @@ -1004,6 +1143,7 @@ public com.google.protobuf.Any.Builder addEventsBuilder() { * *
      * The CloudEvents v1.0 events to publish. No other types are allowed.
+     * If this field is set, then the `text_events` fields must not be set.
      * 
* * repeated .google.protobuf.Any events = 2; @@ -1017,6 +1157,7 @@ public com.google.protobuf.Any.Builder addEventsBuilder(int index) { * *
      * The CloudEvents v1.0 events to publish. No other types are allowed.
+     * If this field is set, then the `text_events` fields must not be set.
      * 
* * repeated .google.protobuf.Any events = 2; @@ -1042,6 +1183,210 @@ public java.util.List getEventsBuilderList() { return eventsBuilder_; } + private com.google.protobuf.LazyStringList textEvents_ = + com.google.protobuf.LazyStringArrayList.EMPTY; + + private void ensureTextEventsIsMutable() { + if (!((bitField0_ & 0x00000002) != 0)) { + textEvents_ = new com.google.protobuf.LazyStringArrayList(textEvents_); + bitField0_ |= 0x00000002; + } + } + /** + * + * + *
+     * The text representation of events to publish.
+     * CloudEvent v1.0 in JSON format is the only allowed type. Refer to
+     * https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/formats/json-format.md
+     * for specification.
+     * If this field is set, then the `events` fields must not be set.
+     * 
+ * + * repeated string text_events = 3; + * + * @return A list containing the textEvents. + */ + public com.google.protobuf.ProtocolStringList getTextEventsList() { + return textEvents_.getUnmodifiableView(); + } + /** + * + * + *
+     * The text representation of events to publish.
+     * CloudEvent v1.0 in JSON format is the only allowed type. Refer to
+     * https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/formats/json-format.md
+     * for specification.
+     * If this field is set, then the `events` fields must not be set.
+     * 
+ * + * repeated string text_events = 3; + * + * @return The count of textEvents. + */ + public int getTextEventsCount() { + return textEvents_.size(); + } + /** + * + * + *
+     * The text representation of events to publish.
+     * CloudEvent v1.0 in JSON format is the only allowed type. Refer to
+     * https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/formats/json-format.md
+     * for specification.
+     * If this field is set, then the `events` fields must not be set.
+     * 
+ * + * repeated string text_events = 3; + * + * @param index The index of the element to return. + * @return The textEvents at the given index. + */ + public java.lang.String getTextEvents(int index) { + return textEvents_.get(index); + } + /** + * + * + *
+     * The text representation of events to publish.
+     * CloudEvent v1.0 in JSON format is the only allowed type. Refer to
+     * https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/formats/json-format.md
+     * for specification.
+     * If this field is set, then the `events` fields must not be set.
+     * 
+ * + * repeated string text_events = 3; + * + * @param index The index of the value to return. + * @return The bytes of the textEvents at the given index. + */ + public com.google.protobuf.ByteString getTextEventsBytes(int index) { + return textEvents_.getByteString(index); + } + /** + * + * + *
+     * The text representation of events to publish.
+     * CloudEvent v1.0 in JSON format is the only allowed type. Refer to
+     * https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/formats/json-format.md
+     * for specification.
+     * If this field is set, then the `events` fields must not be set.
+     * 
+ * + * repeated string text_events = 3; + * + * @param index The index to set the value at. + * @param value The textEvents to set. + * @return This builder for chaining. + */ + public Builder setTextEvents(int index, java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureTextEventsIsMutable(); + textEvents_.set(index, value); + onChanged(); + return this; + } + /** + * + * + *
+     * The text representation of events to publish.
+     * CloudEvent v1.0 in JSON format is the only allowed type. Refer to
+     * https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/formats/json-format.md
+     * for specification.
+     * If this field is set, then the `events` fields must not be set.
+     * 
+ * + * repeated string text_events = 3; + * + * @param value The textEvents to add. + * @return This builder for chaining. + */ + public Builder addTextEvents(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureTextEventsIsMutable(); + textEvents_.add(value); + onChanged(); + return this; + } + /** + * + * + *
+     * The text representation of events to publish.
+     * CloudEvent v1.0 in JSON format is the only allowed type. Refer to
+     * https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/formats/json-format.md
+     * for specification.
+     * If this field is set, then the `events` fields must not be set.
+     * 
+ * + * repeated string text_events = 3; + * + * @param values The textEvents to add. + * @return This builder for chaining. + */ + public Builder addAllTextEvents(java.lang.Iterable values) { + ensureTextEventsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, textEvents_); + onChanged(); + return this; + } + /** + * + * + *
+     * The text representation of events to publish.
+     * CloudEvent v1.0 in JSON format is the only allowed type. Refer to
+     * https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/formats/json-format.md
+     * for specification.
+     * If this field is set, then the `events` fields must not be set.
+     * 
+ * + * repeated string text_events = 3; + * + * @return This builder for chaining. + */ + public Builder clearTextEvents() { + textEvents_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + /** + * + * + *
+     * The text representation of events to publish.
+     * CloudEvent v1.0 in JSON format is the only allowed type. Refer to
+     * https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/formats/json-format.md
+     * for specification.
+     * If this field is set, then the `events` fields must not be set.
+     * 
+ * + * repeated string text_events = 3; + * + * @param value The bytes of the textEvents to add. + * @return This builder for chaining. + */ + public Builder addTextEventsBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + ensureTextEventsIsMutable(); + textEvents_.add(value); + onChanged(); + return this; + } + @java.lang.Override public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { return super.setUnknownFields(unknownFields); diff --git a/java-eventarc-publishing/proto-google-cloud-eventarc-publishing-v1/src/main/java/com/google/cloud/eventarc/publishing/v1/PublishEventsRequestOrBuilder.java b/java-eventarc-publishing/proto-google-cloud-eventarc-publishing-v1/src/main/java/com/google/cloud/eventarc/publishing/v1/PublishEventsRequestOrBuilder.java index 06fdddf512a2..0c79afb57ab8 100644 --- a/java-eventarc-publishing/proto-google-cloud-eventarc-publishing-v1/src/main/java/com/google/cloud/eventarc/publishing/v1/PublishEventsRequestOrBuilder.java +++ b/java-eventarc-publishing/proto-google-cloud-eventarc-publishing-v1/src/main/java/com/google/cloud/eventarc/publishing/v1/PublishEventsRequestOrBuilder.java @@ -55,6 +55,7 @@ public interface PublishEventsRequestOrBuilder * *
    * The CloudEvents v1.0 events to publish. No other types are allowed.
+   * If this field is set, then the `text_events` fields must not be set.
    * 
* * repeated .google.protobuf.Any events = 2; @@ -65,6 +66,7 @@ public interface PublishEventsRequestOrBuilder * *
    * The CloudEvents v1.0 events to publish. No other types are allowed.
+   * If this field is set, then the `text_events` fields must not be set.
    * 
* * repeated .google.protobuf.Any events = 2; @@ -75,6 +77,7 @@ public interface PublishEventsRequestOrBuilder * *
    * The CloudEvents v1.0 events to publish. No other types are allowed.
+   * If this field is set, then the `text_events` fields must not be set.
    * 
* * repeated .google.protobuf.Any events = 2; @@ -85,6 +88,7 @@ public interface PublishEventsRequestOrBuilder * *
    * The CloudEvents v1.0 events to publish. No other types are allowed.
+   * If this field is set, then the `text_events` fields must not be set.
    * 
* * repeated .google.protobuf.Any events = 2; @@ -95,9 +99,77 @@ public interface PublishEventsRequestOrBuilder * *
    * The CloudEvents v1.0 events to publish. No other types are allowed.
+   * If this field is set, then the `text_events` fields must not be set.
    * 
* * repeated .google.protobuf.Any events = 2; */ com.google.protobuf.AnyOrBuilder getEventsOrBuilder(int index); + + /** + * + * + *
+   * The text representation of events to publish.
+   * CloudEvent v1.0 in JSON format is the only allowed type. Refer to
+   * https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/formats/json-format.md
+   * for specification.
+   * If this field is set, then the `events` fields must not be set.
+   * 
+ * + * repeated string text_events = 3; + * + * @return A list containing the textEvents. + */ + java.util.List getTextEventsList(); + /** + * + * + *
+   * The text representation of events to publish.
+   * CloudEvent v1.0 in JSON format is the only allowed type. Refer to
+   * https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/formats/json-format.md
+   * for specification.
+   * If this field is set, then the `events` fields must not be set.
+   * 
+ * + * repeated string text_events = 3; + * + * @return The count of textEvents. + */ + int getTextEventsCount(); + /** + * + * + *
+   * The text representation of events to publish.
+   * CloudEvent v1.0 in JSON format is the only allowed type. Refer to
+   * https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/formats/json-format.md
+   * for specification.
+   * If this field is set, then the `events` fields must not be set.
+   * 
+ * + * repeated string text_events = 3; + * + * @param index The index of the element to return. + * @return The textEvents at the given index. + */ + java.lang.String getTextEvents(int index); + /** + * + * + *
+   * The text representation of events to publish.
+   * CloudEvent v1.0 in JSON format is the only allowed type. Refer to
+   * https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/formats/json-format.md
+   * for specification.
+   * If this field is set, then the `events` fields must not be set.
+   * 
+ * + * repeated string text_events = 3; + * + * @param index The index of the value to return. + * @return The bytes of the textEvents at the given index. + */ + com.google.protobuf.ByteString getTextEventsBytes(int index); } diff --git a/java-eventarc-publishing/proto-google-cloud-eventarc-publishing-v1/src/main/java/com/google/cloud/eventarc/publishing/v1/PublisherProto.java b/java-eventarc-publishing/proto-google-cloud-eventarc-publishing-v1/src/main/java/com/google/cloud/eventarc/publishing/v1/PublisherProto.java index 6175fc326776..b9df53b75946 100644 --- a/java-eventarc-publishing/proto-google-cloud-eventarc-publishing-v1/src/main/java/com/google/cloud/eventarc/publishing/v1/PublisherProto.java +++ b/java-eventarc-publishing/proto-google-cloud-eventarc-publishing-v1/src/main/java/com/google/cloud/eventarc/publishing/v1/PublisherProto.java @@ -56,35 +56,36 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "blisher.proto\022#google.cloud.eventarc.pub" + "lishing.v1\032\034google/api/annotations.proto" + "\032\027google/api/client.proto\032\031google/protob" - + "uf/any.proto\"i\n%PublishChannelConnection" + + "uf/any.proto\"~\n%PublishChannelConnection" + "EventsRequest\022\032\n\022channel_connection\030\001 \001(" - + "\t\022$\n\006events\030\002 \003(\0132\024.google.protobuf.Any\"" - + "(\n&PublishChannelConnectionEventsRespons" - + "e\"M\n\024PublishEventsRequest\022\017\n\007channel\030\001 \001" - + "(\t\022$\n\006events\030\002 \003(\0132\024.google.protobuf.Any" - + "\"\027\n\025PublishEventsResponse2\320\004\n\tPublisher\022" - + "\230\002\n\036PublishChannelConnectionEvents\022J.goo" - + "gle.cloud.eventarc.publishing.v1.Publish" - + "ChannelConnectionEventsRequest\032K.google." - + "cloud.eventarc.publishing.v1.PublishChan" - + "nelConnectionEventsResponse\"]\202\323\344\223\002W\"R/v1" - + "/{channel_connection=projects/*/location" - + "s/*/channelConnections/*}:publishEvents:" - + "\001*\022\320\001\n\rPublishEvents\0229.google.cloud.even" - + "tarc.publishing.v1.PublishEventsRequest\032" - + ":.google.cloud.eventarc.publishing.v1.Pu" - + "blishEventsResponse\"H\202\323\344\223\002B\"=/v1/{channe" - + "l=projects/*/locations/*/channels/*}:pub" - + "lishEvents:\001*\032U\312A!eventarcpublishing.goo" - + "gleapis.com\322A.https://www.googleapis.com" - + "/auth/cloud-platformB\377\001\n\'com.google.clou" - + "d.eventarc.publishing.v1B\016PublisherProto" - + "P\001ZLgoogle.golang.org/genproto/googleapi" - + "s/cloud/eventarc/publishing/v1;publisher" - + "\252\002#Google.Cloud.Eventarc.Publishing.V1\312\002" - + "#Google\\Cloud\\Eventarc\\Publishing\\V1\352\002\'G" - + "oogle::Cloud::Eventarc::Publishing::V1b\006" - + "proto3" + + "\t\022$\n\006events\030\002 \003(\0132\024.google.protobuf.Any\022" + + "\023\n\013text_events\030\003 \003(\t\"(\n&PublishChannelCo" + + "nnectionEventsResponse\"b\n\024PublishEventsR" + + "equest\022\017\n\007channel\030\001 \001(\t\022$\n\006events\030\002 \003(\0132" + + "\024.google.protobuf.Any\022\023\n\013text_events\030\003 \003" + + "(\t\"\027\n\025PublishEventsResponse2\320\004\n\tPublishe" + + "r\022\230\002\n\036PublishChannelConnectionEvents\022J.g" + + "oogle.cloud.eventarc.publishing.v1.Publi" + + "shChannelConnectionEventsRequest\032K.googl" + + "e.cloud.eventarc.publishing.v1.PublishCh" + + "annelConnectionEventsResponse\"]\202\323\344\223\002W\"R/" + + "v1/{channel_connection=projects/*/locati" + + "ons/*/channelConnections/*}:publishEvent" + + "s:\001*\022\320\001\n\rPublishEvents\0229.google.cloud.ev" + + "entarc.publishing.v1.PublishEventsReques" + + "t\032:.google.cloud.eventarc.publishing.v1." + + "PublishEventsResponse\"H\202\323\344\223\002B\"=/v1/{chan" + + "nel=projects/*/locations/*/channels/*}:p" + + "ublishEvents:\001*\032U\312A!eventarcpublishing.g" + + "oogleapis.com\322A.https://www.googleapis.c" + + "om/auth/cloud-platformB\377\001\n\'com.google.cl" + + "oud.eventarc.publishing.v1B\016PublisherPro" + + "toP\001ZLgoogle.golang.org/genproto/googlea" + + "pis/cloud/eventarc/publishing/v1;publish" + + "er\252\002#Google.Cloud.Eventarc.Publishing.V1" + + "\312\002#Google\\Cloud\\Eventarc\\Publishing\\V1\352\002" + + "\'Google::Cloud::Eventarc::Publishing::V1" + + "b\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( @@ -100,7 +101,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_cloud_eventarc_publishing_v1_PublishChannelConnectionEventsRequest_descriptor, new java.lang.String[] { - "ChannelConnection", "Events", + "ChannelConnection", "Events", "TextEvents", }); internal_static_google_cloud_eventarc_publishing_v1_PublishChannelConnectionEventsResponse_descriptor = getDescriptor().getMessageTypes().get(1); @@ -114,7 +115,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_cloud_eventarc_publishing_v1_PublishEventsRequest_descriptor, new java.lang.String[] { - "Channel", "Events", + "Channel", "Events", "TextEvents", }); internal_static_google_cloud_eventarc_publishing_v1_PublishEventsResponse_descriptor = getDescriptor().getMessageTypes().get(3); diff --git a/java-eventarc-publishing/proto-google-cloud-eventarc-publishing-v1/src/main/proto/google/cloud/eventarc/publishing/v1/publisher.proto b/java-eventarc-publishing/proto-google-cloud-eventarc-publishing-v1/src/main/proto/google/cloud/eventarc/publishing/v1/publisher.proto index ce4153bb99a0..b68f1ece8470 100644 --- a/java-eventarc-publishing/proto-google-cloud-eventarc-publishing-v1/src/main/proto/google/cloud/eventarc/publishing/v1/publisher.proto +++ b/java-eventarc-publishing/proto-google-cloud-eventarc-publishing-v1/src/main/proto/google/cloud/eventarc/publishing/v1/publisher.proto @@ -11,7 +11,6 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. - syntax = "proto3"; package google.cloud.eventarc.publishing.v1; @@ -54,16 +53,17 @@ option ruby_package = "Google::Cloud::Eventarc::Publishing::V1"; // Publisher allows an event provider to publish events to Eventarc. service Publisher { option (google.api.default_host) = "eventarcpublishing.googleapis.com"; - option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; // Publish events to a ChannelConnection in a partner's project. - rpc PublishChannelConnectionEvents(PublishChannelConnectionEventsRequest) returns (PublishChannelConnectionEventsResponse) { + rpc PublishChannelConnectionEvents(PublishChannelConnectionEventsRequest) + returns (PublishChannelConnectionEventsResponse) { option (google.api.http) = { post: "/v1/{channel_connection=projects/*/locations/*/channelConnections/*}:publishEvents" body: "*" }; } - // Publish events to a subscriber's channel. rpc PublishEvents(PublishEventsRequest) returns (PublishEventsResponse) { option (google.api.http) = { @@ -72,33 +72,37 @@ service Publisher { }; } } - // The request message for the PublishChannelConnectionEvents method. message PublishChannelConnectionEventsRequest { // The channel_connection that the events are published from. For example: // `projects/{partner_project_id}/locations/{location}/channelConnections/{channel_connection_id}`. string channel_connection = 1; - // The CloudEvents v1.0 events to publish. No other types are allowed. + // If this field is set, then the `text_events` fields must not be set. repeated google.protobuf.Any events = 2; + // The text representation of events to publish. + // CloudEvent v1.0 in JSON format is the only allowed type. Refer to + // https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/formats/json-format.md + // for specification. + // If this field is set, then the `events` fields must not be set. + repeated string text_events = 3; } - // The response message for the PublishChannelConnectionEvents method. -message PublishChannelConnectionEventsResponse { - -} - +message PublishChannelConnectionEventsResponse {} // The request message for the PublishEvents method. message PublishEventsRequest { // The full name of the channel to publish to. For example: // `projects/{project}/locations/{location}/channels/{channel-id}`. string channel = 1; - // The CloudEvents v1.0 events to publish. No other types are allowed. + // If this field is set, then the `text_events` fields must not be set. repeated google.protobuf.Any events = 2; + // The text representation of events to publish. + // CloudEvent v1.0 in JSON format is the only allowed type. Refer to + // https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/formats/json-format.md + // for specification. + // If this field is set, then the `events` fields must not be set. + repeated string text_events = 3; } - // The response message for the PublishEvents method. -message PublishEventsResponse { - -} +message PublishEventsResponse {}