Skip to content

Commit

Permalink
feat: Adding two new fields for Instance create_time and update_time (#…
Browse files Browse the repository at this point in the history
…1908)

* feat: add Session creator role
docs: clarify transaction semantics

PiperOrigin-RevId: 452634948

Source-Link: googleapis/googleapis@df51ec8

Source-Link: https://github.com/googleapis/googleapis-gen/commit/25426f6fd17c5229e17a1f37858cb6c1738f0cad
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMjU0MjZmNmZkMTdjNTIyOWUxN2ExZjM3ODU4Y2I2YzE3MzhmMGNhZCJ9

* 🦉 Updates from OwlBot post-processor

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

* chore: Integrate new gapic-generator-java and rules_gapic

PiperOrigin-RevId: 454027580

Source-Link: googleapis/googleapis@1b22277

Source-Link: https://github.com/googleapis/googleapis-gen/commit/e04cea20d0d12eb5c3bdb360a9e72b654edcb638
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZTA0Y2VhMjBkMGQxMmViNWMzYmRiMzYwYTllNzJiNjU0ZWRjYjYzOCJ9

* 🦉 Updates from OwlBot post-processor

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

* feat: Enable REST transport for most of Java and Go clients

PiperOrigin-RevId: 456641589

Source-Link: googleapis/googleapis@8a251f5

Source-Link: https://github.com/googleapis/googleapis-gen/commit/4ca52a529cf01308d9714950edffbea3560cfbdb
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNGNhNTJhNTI5Y2YwMTMwOGQ5NzE0OTUwZWRmZmJlYTM1NjBjZmJkYiJ9

* 🦉 Updates from OwlBot post-processor

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

* deps: adding gax-httpjson

* fix: update gapic-generator-java with mock service generation fixes

PiperOrigin-RevId: 457524730

Source-Link: googleapis/googleapis@917e7f2

Source-Link: https://github.com/googleapis/googleapis-gen/commit/2497f9a069d3f6b2d6810d5a4e239cda1e7e5a39
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMjQ5N2Y5YTA2OWQzZjZiMmQ2ODEwZDVhNGUyMzljZGExZTdlNWEzOSJ9

* 🦉 Updates from OwlBot post-processor

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

* feat: Adding two new fields for Instance create_time and update_time

PiperOrigin-RevId: 458877561

Source-Link: googleapis/googleapis@207bf59

Source-Link: https://github.com/googleapis/googleapis-gen/commit/5ede6e4fbc14d76f9a6f48152a16d8141d8aff52
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNWVkZTZlNGZiYzE0ZDc2ZjlhNmY0ODE1MmExNmQ4MTQxZDhhZmY1MiJ9

* 🦉 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: Tomo Suzuki <[email protected]>
  • Loading branch information
3 people authored Jul 12, 2022
1 parent 289bf79 commit 00b3817
Show file tree
Hide file tree
Showing 43 changed files with 9,686 additions and 528 deletions.
16 changes: 16 additions & 0 deletions google-cloud-spanner/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,10 @@
<groupId>com.google.api</groupId>
<artifactId>gax-grpc</artifactId>
</dependency>
<dependency>
<groupId>com.google.api</groupId>
<artifactId>gax-httpjson</artifactId>
</dependency>
<dependency>
<groupId>org.threeten</groupId>
<artifactId>threetenbp</artifactId>
Expand Down Expand Up @@ -308,12 +312,24 @@
</dependency>

<!-- Need testing utility classes for generated gRPC clients tests -->
<dependency>
<groupId>com.google.api</groupId>
<artifactId>gax</artifactId>
<classifier>testlib</classifier>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.api</groupId>
<artifactId>gax-grpc</artifactId>
<classifier>testlib</classifier>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.api</groupId>
<artifactId>gax-httpjson</artifactId>
<classifier>testlib</classifier>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.truth</groupId>
<artifactId>truth</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@

import com.google.api.core.ApiFuture;
import com.google.api.core.ApiFutures;
import com.google.api.core.BetaApi;
import com.google.api.gax.core.BackgroundResource;
import com.google.api.gax.httpjson.longrunning.OperationsClient;
import com.google.api.gax.longrunning.OperationFuture;
import com.google.api.gax.paging.AbstractFixedSizeCollection;
import com.google.api.gax.paging.AbstractPage;
Expand All @@ -36,7 +38,6 @@
import com.google.iam.v1.TestIamPermissionsRequest;
import com.google.iam.v1.TestIamPermissionsResponse;
import com.google.longrunning.Operation;
import com.google.longrunning.OperationsClient;
import com.google.protobuf.Empty;
import com.google.protobuf.FieldMask;
import com.google.protobuf.Timestamp;
Expand Down Expand Up @@ -143,13 +144,28 @@
* DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create(databaseAdminSettings);
* }</pre>
*
* <p>To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over
* the wire:
*
* <pre>{@code
* // This snippet has been automatically generated for illustrative purposes only.
* // It may require modifications to work in your environment.
* DatabaseAdminSettings databaseAdminSettings =
* DatabaseAdminSettings.newBuilder()
* .setTransportChannelProvider(
* DatabaseAdminSettings.defaultHttpJsonTransportProviderBuilder().build())
* .build();
* DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create(databaseAdminSettings);
* }</pre>
*
* <p>Please refer to the GitHub repository's samples for more quickstart code snippets.
*/
@Generated("by gapic-generator-java")
public class DatabaseAdminClient implements BackgroundResource {
private final DatabaseAdminSettings settings;
private final DatabaseAdminStub stub;
private final OperationsClient operationsClient;
private final OperationsClient httpJsonOperationsClient;
private final com.google.longrunning.OperationsClient operationsClient;

/** Constructs an instance of DatabaseAdminClient with default settings. */
public static final DatabaseAdminClient create() throws IOException {
Expand Down Expand Up @@ -181,13 +197,17 @@ public static final DatabaseAdminClient create(DatabaseAdminStub stub) {
protected DatabaseAdminClient(DatabaseAdminSettings settings) throws IOException {
this.settings = settings;
this.stub = ((DatabaseAdminStubSettings) settings.getStubSettings()).createStub();
this.operationsClient = OperationsClient.create(this.stub.getOperationsStub());
this.operationsClient =
com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub());
this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub());
}

protected DatabaseAdminClient(DatabaseAdminStub stub) {
this.settings = null;
this.stub = stub;
this.operationsClient = OperationsClient.create(this.stub.getOperationsStub());
this.operationsClient =
com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub());
this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub());
}

public final DatabaseAdminSettings getSettings() {
Expand All @@ -202,10 +222,19 @@ public DatabaseAdminStub getStub() {
* Returns the OperationsClient that can be used to query the status of a long-running operation
* returned by another API method call.
*/
public final OperationsClient getOperationsClient() {
public final com.google.longrunning.OperationsClient getOperationsClient() {
return operationsClient;
}

/**
* Returns the OperationsClient that can be used to query the status of a long-running operation
* returned by another API method call.
*/
@BetaApi
public final OperationsClient getHttpJsonOperationsClient() {
return httpJsonOperationsClient;
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists Cloud Spanner databases.
Expand Down Expand Up @@ -338,7 +367,7 @@ public final ListDatabasesPagedResponse listDatabases(ListDatabasesRequest reque
* .build();
* while (true) {
* ListDatabasesResponse response = databaseAdminClient.listDatabasesCallable().call(request);
* for (Database element : response.getResponsesList()) {
* for (Database element : response.getDatabasesList()) {
* // doThingsWith(element);
* }
* String nextPageToken = response.getNextPageToken();
Expand Down Expand Up @@ -2395,7 +2424,7 @@ public final ListBackupsPagedResponse listBackups(ListBackupsRequest request) {
* .build();
* while (true) {
* ListBackupsResponse response = databaseAdminClient.listBackupsCallable().call(request);
* for (Backup element : response.getResponsesList()) {
* for (Backup element : response.getBackupsList()) {
* // doThingsWith(element);
* }
* String nextPageToken = response.getNextPageToken();
Expand Down Expand Up @@ -2913,7 +2942,7 @@ public final ListDatabaseOperationsPagedResponse listDatabaseOperations(
* while (true) {
* ListDatabaseOperationsResponse response =
* databaseAdminClient.listDatabaseOperationsCallable().call(request);
* for (Operation element : response.getResponsesList()) {
* for (Operation element : response.getOperationsList()) {
* // doThingsWith(element);
* }
* String nextPageToken = response.getNextPageToken();
Expand Down Expand Up @@ -3104,7 +3133,7 @@ public final ListBackupOperationsPagedResponse listBackupOperations(
* while (true) {
* ListBackupOperationsResponse response =
* databaseAdminClient.listBackupOperationsCallable().call(request);
* for (Operation element : response.getResponsesList()) {
* for (Operation element : response.getOperationsList()) {
* // doThingsWith(element);
* }
* String nextPageToken = response.getNextPageToken();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import com.google.api.gax.core.GoogleCredentialsProvider;
import com.google.api.gax.core.InstantiatingExecutorProvider;
import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider;
import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider;
import com.google.api.gax.rpc.ApiClientHeaderProvider;
import com.google.api.gax.rpc.ClientContext;
import com.google.api.gax.rpc.ClientSettings;
Expand Down Expand Up @@ -264,11 +265,18 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde
return DatabaseAdminStubSettings.defaultCredentialsProviderBuilder();
}

/** Returns a builder for the default ChannelProvider for this service. */
/** Returns a builder for the default gRPC ChannelProvider for this service. */
public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() {
return DatabaseAdminStubSettings.defaultGrpcTransportProviderBuilder();
}

/** Returns a builder for the default REST ChannelProvider for this service. */
@BetaApi
public static InstantiatingHttpJsonChannelProvider.Builder
defaultHttpJsonTransportProviderBuilder() {
return DatabaseAdminStubSettings.defaultHttpJsonTransportProviderBuilder();
}

public static TransportChannelProvider defaultTransportChannelProvider() {
return DatabaseAdminStubSettings.defaultTransportChannelProvider();
}
Expand All @@ -278,11 +286,17 @@ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuil
return DatabaseAdminStubSettings.defaultApiClientHeaderProviderBuilder();
}

/** Returns a new builder for this class. */
/** Returns a new gRPC builder for this class. */
public static Builder newBuilder() {
return Builder.createDefault();
}

/** Returns a new REST builder for this class. */
@BetaApi
public static Builder newHttpJsonBuilder() {
return Builder.createHttpJsonDefault();
}

/** Returns a new builder for this class. */
public static Builder newBuilder(ClientContext clientContext) {
return new Builder(clientContext);
Expand Down Expand Up @@ -320,6 +334,11 @@ private static Builder createDefault() {
return new Builder(DatabaseAdminStubSettings.newBuilder());
}

@BetaApi
private static Builder createHttpJsonDefault() {
return new Builder(DatabaseAdminStubSettings.newHttpJsonBuilder());
}

public DatabaseAdminStubSettings.Builder getStubSettingsBuilder() {
return ((DatabaseAdminStubSettings.Builder) getStubSettings());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,11 @@
public abstract class DatabaseAdminStub implements BackgroundResource {

public OperationsStub getOperationsStub() {
throw new UnsupportedOperationException("Not implemented: getOperationsStub()");
return null;
}

public com.google.api.gax.httpjson.longrunning.stub.OperationsStub getHttpJsonOperationsStub() {
return null;
}

public UnaryCallable<ListDatabasesRequest, ListDatabasesPagedResponse>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@
import com.google.api.gax.grpc.GrpcTransportChannel;
import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider;
import com.google.api.gax.grpc.ProtoOperationTransformers;
import com.google.api.gax.httpjson.GaxHttpJsonProperties;
import com.google.api.gax.httpjson.HttpJsonTransportChannel;
import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider;
import com.google.api.gax.longrunning.OperationSnapshot;
import com.google.api.gax.longrunning.OperationTimedPollAlgorithm;
import com.google.api.gax.retrying.RetrySettings;
Expand Down Expand Up @@ -547,6 +550,11 @@ public DatabaseAdminStub createStub() throws IOException {
.equals(GrpcTransportChannel.getGrpcTransportName())) {
return GrpcDatabaseAdminStub.create(this);
}
if (getTransportChannelProvider()
.getTransportName()
.equals(HttpJsonTransportChannel.getHttpJsonTransportName())) {
return HttpJsonDatabaseAdminStub.create(this);
}
throw new UnsupportedOperationException(
String.format(
"Transport not supported: %s", getTransportChannelProvider().getTransportName()));
Expand Down Expand Up @@ -579,30 +587,56 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde
.setUseJwtAccessWithScope(true);
}

/** Returns a builder for the default ChannelProvider for this service. */
/** Returns a builder for the default gRPC ChannelProvider for this service. */
public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() {
return InstantiatingGrpcChannelProvider.newBuilder()
.setMaxInboundMessageSize(Integer.MAX_VALUE);
}

/** Returns a builder for the default REST ChannelProvider for this service. */
@BetaApi
public static InstantiatingHttpJsonChannelProvider.Builder
defaultHttpJsonTransportProviderBuilder() {
return InstantiatingHttpJsonChannelProvider.newBuilder();
}

public static TransportChannelProvider defaultTransportChannelProvider() {
return defaultGrpcTransportProviderBuilder().build();
}

@BetaApi("The surface for customizing headers is not stable yet and may change in the future.")
public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() {
public static ApiClientHeaderProvider.Builder defaultGrpcApiClientHeaderProviderBuilder() {
return ApiClientHeaderProvider.newBuilder()
.setGeneratedLibToken(
"gapic", GaxProperties.getLibraryVersion(DatabaseAdminStubSettings.class))
.setTransportToken(
GaxGrpcProperties.getGrpcTokenName(), GaxGrpcProperties.getGrpcVersion());
}

/** Returns a new builder for this class. */
@BetaApi("The surface for customizing headers is not stable yet and may change in the future.")
public static ApiClientHeaderProvider.Builder defaultHttpJsonApiClientHeaderProviderBuilder() {
return ApiClientHeaderProvider.newBuilder()
.setGeneratedLibToken(
"gapic", GaxProperties.getLibraryVersion(DatabaseAdminStubSettings.class))
.setTransportToken(
GaxHttpJsonProperties.getHttpJsonTokenName(),
GaxHttpJsonProperties.getHttpJsonVersion());
}

public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() {
return DatabaseAdminStubSettings.defaultGrpcApiClientHeaderProviderBuilder();
}

/** Returns a new gRPC builder for this class. */
public static Builder newBuilder() {
return Builder.createDefault();
}

/** Returns a new REST builder for this class. */
public static Builder newHttpJsonBuilder() {
return Builder.createHttpJsonDefault();
}

/** Returns a new builder for this class. */
public static Builder newBuilder(ClientContext clientContext) {
return new Builder(clientContext);
Expand Down Expand Up @@ -880,6 +914,19 @@ private static Builder createDefault() {
return initDefaults(builder);
}

private static Builder createHttpJsonDefault() {
Builder builder = new Builder(((ClientContext) null));

builder.setTransportChannelProvider(defaultHttpJsonTransportProviderBuilder().build());
builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build());
builder.setInternalHeaderProvider(defaultHttpJsonApiClientHeaderProviderBuilder().build());
builder.setEndpoint(getDefaultEndpoint());
builder.setMtlsEndpoint(getDefaultMtlsEndpoint());
builder.setSwitchToMtlsEndpointAllowed(true);

return initDefaults(builder);
}

private static Builder initDefaults(Builder builder) {
builder
.listDatabasesSettings()
Expand Down
Loading

0 comments on commit 00b3817

Please sign in to comment.