Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add use_topic_schema for Cloud Storage Subscriptions #2082

Merged
merged 2 commits into from
Jun 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,20 +52,20 @@ If you are using Maven without the BOM, add this to your dependencies:
If you are using Gradle 5.x or later, add this to your dependencies:

```Groovy
implementation platform('com.google.cloud:libraries-bom:26.41.0')
implementation platform('com.google.cloud:libraries-bom:26.42.0')

implementation 'com.google.cloud:google-cloud-pubsub'
```
If you are using Gradle without BOM, add this to your dependencies:

```Groovy
implementation 'com.google.cloud:google-cloud-pubsub:1.130.0'
implementation 'com.google.cloud:google-cloud-pubsub:1.130.1'
```

If you are using SBT, add this to your dependencies:

```Scala
libraryDependencies += "com.google.cloud" % "google-cloud-pubsub" % "1.130.0"
libraryDependencies += "com.google.cloud" % "google-cloud-pubsub" % "1.130.1"
```
<!-- {x-version-update-end} -->

Expand Down Expand Up @@ -411,7 +411,7 @@ Java is a registered trademark of Oracle and/or its affiliates.
[kokoro-badge-link-5]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-pubsub/java11.html
[stability-image]: https://img.shields.io/badge/stability-stable-green
[maven-version-image]: https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-pubsub.svg
[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-pubsub/1.130.0
[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-pubsub/1.130.1
[authentication]: https://github.com/googleapis/google-cloud-java#authentication
[auth-scopes]: https://developers.google.com/identity/protocols/oauth2/scopes
[predefined-iam-roles]: https://cloud.google.com/iam/docs/understanding-roles#predefined_roles
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,17 @@ public enum State implements com.google.protobuf.ProtocolMessageEnum {
* <code>IN_TRANSIT_LOCATION_RESTRICTION = 4;</code>
*/
IN_TRANSIT_LOCATION_RESTRICTION(4),
/**
*
*
* <pre>
* Cannot write to the Cloud Storage bucket due to an incompatibility
* between the topic schema and subscription settings.
* </pre>
*
* <code>SCHEMA_MISMATCH = 5;</code>
*/
SCHEMA_MISMATCH(5),
UNRECOGNIZED(-1),
;

Expand Down Expand Up @@ -185,6 +196,17 @@ public enum State implements com.google.protobuf.ProtocolMessageEnum {
* <code>IN_TRANSIT_LOCATION_RESTRICTION = 4;</code>
*/
public static final int IN_TRANSIT_LOCATION_RESTRICTION_VALUE = 4;
/**
*
*
* <pre>
* Cannot write to the Cloud Storage bucket due to an incompatibility
* between the topic schema and subscription settings.
* </pre>
*
* <code>SCHEMA_MISMATCH = 5;</code>
*/
public static final int SCHEMA_MISMATCH_VALUE = 5;

public final int getNumber() {
if (this == UNRECOGNIZED) {
Expand Down Expand Up @@ -220,6 +242,8 @@ public static State forNumber(int value) {
return NOT_FOUND;
case 4:
return IN_TRANSIT_LOCATION_RESTRICTION;
case 5:
return SCHEMA_MISMATCH;
default:
return null;
}
Expand Down Expand Up @@ -721,6 +745,20 @@ public interface AvroConfigOrBuilder
* @return The writeMetadata.
*/
boolean getWriteMetadata();

/**
*
*
* <pre>
* Optional. When true, the output Cloud Storage file will be serialized
* using the topic schema, if it exists.
* </pre>
*
* <code>bool use_topic_schema = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
*
* @return The useTopicSchema.
*/
boolean getUseTopicSchema();
}
/**
*
Expand Down Expand Up @@ -788,6 +826,25 @@ public boolean getWriteMetadata() {
return writeMetadata_;
}

public static final int USE_TOPIC_SCHEMA_FIELD_NUMBER = 2;
private boolean useTopicSchema_ = false;
/**
*
*
* <pre>
* Optional. When true, the output Cloud Storage file will be serialized
* using the topic schema, if it exists.
* </pre>
*
* <code>bool use_topic_schema = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
*
* @return The useTopicSchema.
*/
@java.lang.Override
public boolean getUseTopicSchema() {
return useTopicSchema_;
}

private byte memoizedIsInitialized = -1;

@java.lang.Override
Expand All @@ -805,6 +862,9 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io
if (writeMetadata_ != false) {
output.writeBool(1, writeMetadata_);
}
if (useTopicSchema_ != false) {
output.writeBool(2, useTopicSchema_);
}
getUnknownFields().writeTo(output);
}

Expand All @@ -817,6 +877,9 @@ public int getSerializedSize() {
if (writeMetadata_ != false) {
size += com.google.protobuf.CodedOutputStream.computeBoolSize(1, writeMetadata_);
}
if (useTopicSchema_ != false) {
size += com.google.protobuf.CodedOutputStream.computeBoolSize(2, useTopicSchema_);
}
size += getUnknownFields().getSerializedSize();
memoizedSize = size;
return size;
Expand All @@ -834,6 +897,7 @@ public boolean equals(final java.lang.Object obj) {
(com.google.pubsub.v1.CloudStorageConfig.AvroConfig) obj;

if (getWriteMetadata() != other.getWriteMetadata()) return false;
if (getUseTopicSchema() != other.getUseTopicSchema()) return false;
if (!getUnknownFields().equals(other.getUnknownFields())) return false;
return true;
}
Expand All @@ -847,6 +911,8 @@ public int hashCode() {
hash = (19 * hash) + getDescriptor().hashCode();
hash = (37 * hash) + WRITE_METADATA_FIELD_NUMBER;
hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getWriteMetadata());
hash = (37 * hash) + USE_TOPIC_SCHEMA_FIELD_NUMBER;
hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getUseTopicSchema());
hash = (29 * hash) + getUnknownFields().hashCode();
memoizedHashCode = hash;
return hash;
Expand Down Expand Up @@ -990,6 +1056,7 @@ public Builder clear() {
super.clear();
bitField0_ = 0;
writeMetadata_ = false;
useTopicSchema_ = false;
return this;
}

Expand Down Expand Up @@ -1029,6 +1096,9 @@ private void buildPartial0(com.google.pubsub.v1.CloudStorageConfig.AvroConfig re
if (((from_bitField0_ & 0x00000001) != 0)) {
result.writeMetadata_ = writeMetadata_;
}
if (((from_bitField0_ & 0x00000002) != 0)) {
result.useTopicSchema_ = useTopicSchema_;
}
}

@java.lang.Override
Expand Down Expand Up @@ -1082,6 +1152,9 @@ public Builder mergeFrom(com.google.pubsub.v1.CloudStorageConfig.AvroConfig othe
if (other.getWriteMetadata() != false) {
setWriteMetadata(other.getWriteMetadata());
}
if (other.getUseTopicSchema() != false) {
setUseTopicSchema(other.getUseTopicSchema());
}
this.mergeUnknownFields(other.getUnknownFields());
onChanged();
return this;
Expand Down Expand Up @@ -1114,6 +1187,12 @@ public Builder mergeFrom(
bitField0_ |= 0x00000001;
break;
} // case 8
case 16:
{
useTopicSchema_ = input.readBool();
bitField0_ |= 0x00000002;
break;
} // case 16
default:
{
if (!super.parseUnknownField(input, extensionRegistry, tag)) {
Expand Down Expand Up @@ -1201,6 +1280,62 @@ public Builder clearWriteMetadata() {
return this;
}

private boolean useTopicSchema_;
/**
*
*
* <pre>
* Optional. When true, the output Cloud Storage file will be serialized
* using the topic schema, if it exists.
* </pre>
*
* <code>bool use_topic_schema = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
*
* @return The useTopicSchema.
*/
@java.lang.Override
public boolean getUseTopicSchema() {
return useTopicSchema_;
}
/**
*
*
* <pre>
* Optional. When true, the output Cloud Storage file will be serialized
* using the topic schema, if it exists.
* </pre>
*
* <code>bool use_topic_schema = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
*
* @param value The useTopicSchema to set.
* @return This builder for chaining.
*/
public Builder setUseTopicSchema(boolean value) {

useTopicSchema_ = value;
bitField0_ |= 0x00000002;
onChanged();
return this;
}
/**
*
*
* <pre>
* Optional. When true, the output Cloud Storage file will be serialized
* using the topic schema, if it exists.
* </pre>
*
* <code>bool use_topic_schema = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
*
* @return This builder for chaining.
*/
public Builder clearUseTopicSchema() {
bitField0_ = (bitField0_ & ~0x00000002);
useTopicSchema_ = false;
onChanged();
return this;
}

@java.lang.Override
public final Builder setUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
Expand Down
Loading
Loading