Skip to content

Commit

Permalink
feat: add schema evolution methods and fields (#1384)
Browse files Browse the repository at this point in the history
* chore: Set `rest_numeric_enums = False` for all gapic rules explicitly

PiperOrigin-RevId: 485623855

Source-Link: googleapis/googleapis@807125e

Source-Link: googleapis/googleapis-gen@c4ddd6d
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYzRkZGQ2ZDY1MWRhNjk2NThhNDc2MmM1ZWFmZmY1Y2Q4ZjBlMjVjNSJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* chore: Enable requesting numeric enums in "transport=rest" responses for services supporting this (Java, Go, Python, PHP, TypeScript, C#, and Ruby), even if they do not yet turn on REST transport

chore: disallow "transport=rest" for services where numeric enums are not confirmed to be supported (except in PHP and Java)
PiperOrigin-RevId: 493113566

Source-Link: googleapis/googleapis@758f0d1

Source-Link: googleapis/googleapis-gen@78bd8f0
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNzhiZDhmMDVlMTI3NjM2M2ViMTRlYWU3MGU5MWZlNGJjMjA3MDNhYiJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* chore(pubsub): remove extraneous ctype field annotations

PiperOrigin-RevId: 496666857

Source-Link: googleapis/googleapis@bc27df2

Source-Link: googleapis/googleapis-gen@941b568
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiOTQxYjU2ODAyN2IxNDViZmI1NDBlOGVlMWRmNGQ0Y2NkNDQ5NzdmYyJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* chore: regenerate API index

Source-Link: googleapis/googleapis@b84b4fe

Source-Link: googleapis/googleapis-gen@916424c
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiOTE2NDI0Yzk3MjE1YjEyMjExMDM3YjUwNTdiODMzNDQ3ZDA3M2JiZCJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* feat: add schema evolution methods and fields

PiperOrigin-RevId: 500819578

Source-Link: googleapis/googleapis@05a375f

Source-Link: googleapis/googleapis-gen@303c959
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMzAzYzk1OTJjNDk4ZGMwMjQzMmRhYTI5YWNiNDZkNjdkZWNmYjBjMiJ9

* 🦉 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>
Co-authored-by: Lawrence Qiu <[email protected]>
Co-authored-by: Kamal Aboul-Hosn <[email protected]>
  • Loading branch information
4 people committed Jan 10, 2023
1 parent 511dc3d commit 746a6e0
Show file tree
Hide file tree
Showing 45 changed files with 9,623 additions and 583 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,20 +51,20 @@ If you are using Maven without 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.1.5')
implementation platform('com.google.cloud:libraries-bom:26.3.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.122.1'
implementation 'com.google.cloud:google-cloud-pubsub:1.122.2'
```

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

```Scala
libraryDependencies += "com.google.cloud" % "google-cloud-pubsub" % "1.122.1"
libraryDependencies += "com.google.cloud" % "google-cloud-pubsub" % "1.122.2"
```

## Authentication
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package com.google.cloud.pubsub.v1;

import static com.google.cloud.pubsub.v1.SchemaServiceClient.ListSchemaRevisionsPagedResponse;
import static com.google.cloud.pubsub.v1.SchemaServiceClient.ListSchemasPagedResponse;

import com.google.api.core.ApiFunction;
Expand All @@ -37,11 +38,16 @@
import com.google.iam.v1.TestIamPermissionsRequest;
import com.google.iam.v1.TestIamPermissionsResponse;
import com.google.protobuf.Empty;
import com.google.pubsub.v1.CommitSchemaRequest;
import com.google.pubsub.v1.CreateSchemaRequest;
import com.google.pubsub.v1.DeleteSchemaRequest;
import com.google.pubsub.v1.DeleteSchemaRevisionRequest;
import com.google.pubsub.v1.GetSchemaRequest;
import com.google.pubsub.v1.ListSchemaRevisionsRequest;
import com.google.pubsub.v1.ListSchemaRevisionsResponse;
import com.google.pubsub.v1.ListSchemasRequest;
import com.google.pubsub.v1.ListSchemasResponse;
import com.google.pubsub.v1.RollbackSchemaRequest;
import com.google.pubsub.v1.Schema;
import com.google.pubsub.v1.ValidateMessageRequest;
import com.google.pubsub.v1.ValidateMessageResponse;
Expand Down Expand Up @@ -78,7 +84,10 @@
* schemaServiceSettingsBuilder
* .createSchemaSettings()
* .setRetrySettings(
* schemaServiceSettingsBuilder.createSchemaSettings().getRetrySettings().toBuilder()
* schemaServiceSettingsBuilder
* .createSchemaSettings()
* .getRetrySettings()
* .toBuilder()
* .setTotalTimeout(Duration.ofSeconds(30))
* .build());
* SchemaServiceSettings schemaServiceSettings = schemaServiceSettingsBuilder.build();
Expand All @@ -103,6 +112,28 @@ public UnaryCallSettings<GetSchemaRequest, Schema> getSchemaSettings() {
return ((SchemaServiceStubSettings) getStubSettings()).listSchemasSettings();
}

/** Returns the object with the settings used for calls to listSchemaRevisions. */
public PagedCallSettings<
ListSchemaRevisionsRequest, ListSchemaRevisionsResponse, ListSchemaRevisionsPagedResponse>
listSchemaRevisionsSettings() {
return ((SchemaServiceStubSettings) getStubSettings()).listSchemaRevisionsSettings();
}

/** Returns the object with the settings used for calls to commitSchema. */
public UnaryCallSettings<CommitSchemaRequest, Schema> commitSchemaSettings() {
return ((SchemaServiceStubSettings) getStubSettings()).commitSchemaSettings();
}

/** Returns the object with the settings used for calls to rollbackSchema. */
public UnaryCallSettings<RollbackSchemaRequest, Schema> rollbackSchemaSettings() {
return ((SchemaServiceStubSettings) getStubSettings()).rollbackSchemaSettings();
}

/** Returns the object with the settings used for calls to deleteSchemaRevision. */
public UnaryCallSettings<DeleteSchemaRevisionRequest, Schema> deleteSchemaRevisionSettings() {
return ((SchemaServiceStubSettings) getStubSettings()).deleteSchemaRevisionSettings();
}

/** Returns the object with the settings used for calls to deleteSchema. */
public UnaryCallSettings<DeleteSchemaRequest, Empty> deleteSchemaSettings() {
return ((SchemaServiceStubSettings) getStubSettings()).deleteSchemaSettings();
Expand Down Expand Up @@ -267,6 +298,31 @@ public UnaryCallSettings.Builder<GetSchemaRequest, Schema> getSchemaSettings() {
return getStubSettingsBuilder().listSchemasSettings();
}

/** Returns the builder for the settings used for calls to listSchemaRevisions. */
public PagedCallSettings.Builder<
ListSchemaRevisionsRequest,
ListSchemaRevisionsResponse,
ListSchemaRevisionsPagedResponse>
listSchemaRevisionsSettings() {
return getStubSettingsBuilder().listSchemaRevisionsSettings();
}

/** Returns the builder for the settings used for calls to commitSchema. */
public UnaryCallSettings.Builder<CommitSchemaRequest, Schema> commitSchemaSettings() {
return getStubSettingsBuilder().commitSchemaSettings();
}

/** Returns the builder for the settings used for calls to rollbackSchema. */
public UnaryCallSettings.Builder<RollbackSchemaRequest, Schema> rollbackSchemaSettings() {
return getStubSettingsBuilder().rollbackSchemaSettings();
}

/** Returns the builder for the settings used for calls to deleteSchemaRevision. */
public UnaryCallSettings.Builder<DeleteSchemaRevisionRequest, Schema>
deleteSchemaRevisionSettings() {
return getStubSettingsBuilder().deleteSchemaRevisionSettings();
}

/** Returns the builder for the settings used for calls to deleteSchema. */
public UnaryCallSettings.Builder<DeleteSchemaRequest, Empty> deleteSchemaSettings() {
return getStubSettingsBuilder().deleteSchemaSettings();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,7 @@
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* SubscriptionAdminSettings subscriptionAdminSettings =
* SubscriptionAdminSettings.newBuilder()
* .setTransportChannelProvider(
* SubscriptionAdminSettings.defaultHttpJsonTransportProviderBuilder().build())
* .build();
* SubscriptionAdminSettings.newHttpJsonBuilder().build();
* SubscriptionAdminClient subscriptionAdminClient =
* SubscriptionAdminClient.create(subscriptionAdminSettings);
* }</pre>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,7 @@
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* TopicAdminSettings topicAdminSettings =
* TopicAdminSettings.newBuilder()
* .setTransportChannelProvider(
* TopicAdminSettings.defaultHttpJsonTransportProviderBuilder().build())
* .build();
* TopicAdminSettings topicAdminSettings = TopicAdminSettings.newHttpJsonBuilder().build();
* TopicAdminClient topicAdminClient = TopicAdminClient.create(topicAdminSettings);
* }</pre>
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,10 @@
* topicAdminSettingsBuilder
* .createTopicSettings()
* .setRetrySettings(
* topicAdminSettingsBuilder.createTopicSettings().getRetrySettings().toBuilder()
* topicAdminSettingsBuilder
* .createTopicSettings()
* .getRetrySettings()
* .toBuilder()
* .setTotalTimeout(Duration.ofSeconds(30))
* .build());
* TopicAdminSettings topicAdminSettings = topicAdminSettingsBuilder.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,21 +121,33 @@
"grpc": {
"libraryClient": "SchemaServiceClient",
"rpcs": {
"CommitSchema": {
"methods": ["commitSchema", "commitSchema", "commitSchema", "commitSchemaCallable"]
},
"CreateSchema": {
"methods": ["createSchema", "createSchema", "createSchema", "createSchemaCallable"]
},
"DeleteSchema": {
"methods": ["deleteSchema", "deleteSchema", "deleteSchema", "deleteSchemaCallable"]
},
"DeleteSchemaRevision": {
"methods": ["deleteSchemaRevision", "deleteSchemaRevision", "deleteSchemaRevision", "deleteSchemaRevisionCallable"]
},
"GetIamPolicy": {
"methods": ["getIamPolicy", "getIamPolicyCallable"]
},
"GetSchema": {
"methods": ["getSchema", "getSchema", "getSchema", "getSchemaCallable"]
},
"ListSchemaRevisions": {
"methods": ["listSchemaRevisions", "listSchemaRevisions", "listSchemaRevisions", "listSchemaRevisionsPagedCallable", "listSchemaRevisionsCallable"]
},
"ListSchemas": {
"methods": ["listSchemas", "listSchemas", "listSchemas", "listSchemasPagedCallable", "listSchemasCallable"]
},
"RollbackSchema": {
"methods": ["rollbackSchema", "rollbackSchema", "rollbackSchema", "rollbackSchemaCallable"]
},
"SetIamPolicy": {
"methods": ["setIamPolicy", "setIamPolicyCallable"]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package com.google.cloud.pubsub.v1.stub;

import static com.google.cloud.pubsub.v1.SchemaServiceClient.ListSchemaRevisionsPagedResponse;
import static com.google.cloud.pubsub.v1.SchemaServiceClient.ListSchemasPagedResponse;

import com.google.api.gax.core.BackgroundResource;
Expand All @@ -32,11 +33,16 @@
import com.google.iam.v1.TestIamPermissionsResponse;
import com.google.longrunning.stub.GrpcOperationsStub;
import com.google.protobuf.Empty;
import com.google.pubsub.v1.CommitSchemaRequest;
import com.google.pubsub.v1.CreateSchemaRequest;
import com.google.pubsub.v1.DeleteSchemaRequest;
import com.google.pubsub.v1.DeleteSchemaRevisionRequest;
import com.google.pubsub.v1.GetSchemaRequest;
import com.google.pubsub.v1.ListSchemaRevisionsRequest;
import com.google.pubsub.v1.ListSchemaRevisionsResponse;
import com.google.pubsub.v1.ListSchemasRequest;
import com.google.pubsub.v1.ListSchemasResponse;
import com.google.pubsub.v1.RollbackSchemaRequest;
import com.google.pubsub.v1.Schema;
import com.google.pubsub.v1.ValidateMessageRequest;
import com.google.pubsub.v1.ValidateMessageResponse;
Expand Down Expand Up @@ -82,6 +88,45 @@ public class GrpcSchemaServiceStub extends SchemaServiceStub {
ProtoUtils.marshaller(ListSchemasResponse.getDefaultInstance()))
.build();

private static final MethodDescriptor<ListSchemaRevisionsRequest, ListSchemaRevisionsResponse>
listSchemaRevisionsMethodDescriptor =
MethodDescriptor.<ListSchemaRevisionsRequest, ListSchemaRevisionsResponse>newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.pubsub.v1.SchemaService/ListSchemaRevisions")
.setRequestMarshaller(
ProtoUtils.marshaller(ListSchemaRevisionsRequest.getDefaultInstance()))
.setResponseMarshaller(
ProtoUtils.marshaller(ListSchemaRevisionsResponse.getDefaultInstance()))
.build();

private static final MethodDescriptor<CommitSchemaRequest, Schema> commitSchemaMethodDescriptor =
MethodDescriptor.<CommitSchemaRequest, Schema>newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.pubsub.v1.SchemaService/CommitSchema")
.setRequestMarshaller(ProtoUtils.marshaller(CommitSchemaRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(Schema.getDefaultInstance()))
.build();

private static final MethodDescriptor<RollbackSchemaRequest, Schema>
rollbackSchemaMethodDescriptor =
MethodDescriptor.<RollbackSchemaRequest, Schema>newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.pubsub.v1.SchemaService/RollbackSchema")
.setRequestMarshaller(
ProtoUtils.marshaller(RollbackSchemaRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(Schema.getDefaultInstance()))
.build();

private static final MethodDescriptor<DeleteSchemaRevisionRequest, Schema>
deleteSchemaRevisionMethodDescriptor =
MethodDescriptor.<DeleteSchemaRevisionRequest, Schema>newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.pubsub.v1.SchemaService/DeleteSchemaRevision")
.setRequestMarshaller(
ProtoUtils.marshaller(DeleteSchemaRevisionRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(Schema.getDefaultInstance()))
.build();

private static final MethodDescriptor<DeleteSchemaRequest, Empty> deleteSchemaMethodDescriptor =
MethodDescriptor.<DeleteSchemaRequest, Empty>newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
Expand Down Expand Up @@ -144,6 +189,13 @@ public class GrpcSchemaServiceStub extends SchemaServiceStub {
private final UnaryCallable<ListSchemasRequest, ListSchemasResponse> listSchemasCallable;
private final UnaryCallable<ListSchemasRequest, ListSchemasPagedResponse>
listSchemasPagedCallable;
private final UnaryCallable<ListSchemaRevisionsRequest, ListSchemaRevisionsResponse>
listSchemaRevisionsCallable;
private final UnaryCallable<ListSchemaRevisionsRequest, ListSchemaRevisionsPagedResponse>
listSchemaRevisionsPagedCallable;
private final UnaryCallable<CommitSchemaRequest, Schema> commitSchemaCallable;
private final UnaryCallable<RollbackSchemaRequest, Schema> rollbackSchemaCallable;
private final UnaryCallable<DeleteSchemaRevisionRequest, Schema> deleteSchemaRevisionCallable;
private final UnaryCallable<DeleteSchemaRequest, Empty> deleteSchemaCallable;
private final UnaryCallable<ValidateSchemaRequest, ValidateSchemaResponse> validateSchemaCallable;
private final UnaryCallable<ValidateMessageRequest, ValidateMessageResponse>
Expand Down Expand Up @@ -225,6 +277,47 @@ protected GrpcSchemaServiceStub(
return params.build();
})
.build();
GrpcCallSettings<ListSchemaRevisionsRequest, ListSchemaRevisionsResponse>
listSchemaRevisionsTransportSettings =
GrpcCallSettings.<ListSchemaRevisionsRequest, ListSchemaRevisionsResponse>newBuilder()
.setMethodDescriptor(listSchemaRevisionsMethodDescriptor)
.setParamsExtractor(
request -> {
ImmutableMap.Builder<String, String> params = ImmutableMap.builder();
params.put("name", String.valueOf(request.getName()));
return params.build();
})
.build();
GrpcCallSettings<CommitSchemaRequest, Schema> commitSchemaTransportSettings =
GrpcCallSettings.<CommitSchemaRequest, Schema>newBuilder()
.setMethodDescriptor(commitSchemaMethodDescriptor)
.setParamsExtractor(
request -> {
ImmutableMap.Builder<String, String> params = ImmutableMap.builder();
params.put("name", String.valueOf(request.getName()));
return params.build();
})
.build();
GrpcCallSettings<RollbackSchemaRequest, Schema> rollbackSchemaTransportSettings =
GrpcCallSettings.<RollbackSchemaRequest, Schema>newBuilder()
.setMethodDescriptor(rollbackSchemaMethodDescriptor)
.setParamsExtractor(
request -> {
ImmutableMap.Builder<String, String> params = ImmutableMap.builder();
params.put("name", String.valueOf(request.getName()));
return params.build();
})
.build();
GrpcCallSettings<DeleteSchemaRevisionRequest, Schema> deleteSchemaRevisionTransportSettings =
GrpcCallSettings.<DeleteSchemaRevisionRequest, Schema>newBuilder()
.setMethodDescriptor(deleteSchemaRevisionMethodDescriptor)
.setParamsExtractor(
request -> {
ImmutableMap.Builder<String, String> params = ImmutableMap.builder();
params.put("name", String.valueOf(request.getName()));
return params.build();
})
.build();
GrpcCallSettings<DeleteSchemaRequest, Empty> deleteSchemaTransportSettings =
GrpcCallSettings.<DeleteSchemaRequest, Empty>newBuilder()
.setMethodDescriptor(deleteSchemaMethodDescriptor)
Expand Down Expand Up @@ -301,6 +394,27 @@ protected GrpcSchemaServiceStub(
this.listSchemasPagedCallable =
callableFactory.createPagedCallable(
listSchemasTransportSettings, settings.listSchemasSettings(), clientContext);
this.listSchemaRevisionsCallable =
callableFactory.createUnaryCallable(
listSchemaRevisionsTransportSettings,
settings.listSchemaRevisionsSettings(),
clientContext);
this.listSchemaRevisionsPagedCallable =
callableFactory.createPagedCallable(
listSchemaRevisionsTransportSettings,
settings.listSchemaRevisionsSettings(),
clientContext);
this.commitSchemaCallable =
callableFactory.createUnaryCallable(
commitSchemaTransportSettings, settings.commitSchemaSettings(), clientContext);
this.rollbackSchemaCallable =
callableFactory.createUnaryCallable(
rollbackSchemaTransportSettings, settings.rollbackSchemaSettings(), clientContext);
this.deleteSchemaRevisionCallable =
callableFactory.createUnaryCallable(
deleteSchemaRevisionTransportSettings,
settings.deleteSchemaRevisionSettings(),
clientContext);
this.deleteSchemaCallable =
callableFactory.createUnaryCallable(
deleteSchemaTransportSettings, settings.deleteSchemaSettings(), clientContext);
Expand Down Expand Up @@ -350,6 +464,33 @@ public UnaryCallable<ListSchemasRequest, ListSchemasPagedResponse> listSchemasPa
return listSchemasPagedCallable;
}

@Override
public UnaryCallable<ListSchemaRevisionsRequest, ListSchemaRevisionsResponse>
listSchemaRevisionsCallable() {
return listSchemaRevisionsCallable;
}

@Override
public UnaryCallable<ListSchemaRevisionsRequest, ListSchemaRevisionsPagedResponse>
listSchemaRevisionsPagedCallable() {
return listSchemaRevisionsPagedCallable;
}

@Override
public UnaryCallable<CommitSchemaRequest, Schema> commitSchemaCallable() {
return commitSchemaCallable;
}

@Override
public UnaryCallable<RollbackSchemaRequest, Schema> rollbackSchemaCallable() {
return rollbackSchemaCallable;
}

@Override
public UnaryCallable<DeleteSchemaRevisionRequest, Schema> deleteSchemaRevisionCallable() {
return deleteSchemaRevisionCallable;
}

@Override
public UnaryCallable<DeleteSchemaRequest, Empty> deleteSchemaCallable() {
return deleteSchemaCallable;
Expand Down

0 comments on commit 746a6e0

Please sign in to comment.