Skip to content

Commit

Permalink
feat(spanner): add progress field to UpdateDatabaseDdlMetadata (#…
Browse files Browse the repository at this point in the history
…1063)

PiperOrigin-RevId: 368426665

Source-Author: Google APIs <noreply@google.com>
Source-Date: Wed Apr 14 07:34:31 2021 -0700
Source-Repo: googleapis/googleapis
Source-Sha: 3b236df084cf9222c529a2890f90e3a4ff0f2dfd
Source-Link: googleapis/googleapis@3b236df
  • Loading branch information
yoshi-automation authored Apr 15, 2021
1 parent f997333 commit 7992342
Show file tree
Hide file tree
Showing 65 changed files with 2,691 additions and 2,068 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -980,7 +980,9 @@ public final GetDatabaseDdlResponse getDatabaseDdl(GetDatabaseDdlRequest request
*
* <pre>{@code
* try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
* ResourceName resource = DatabaseName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]");
* ResourceName resource =
* CryptoKeyVersionName.of(
* "[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]");
* Policy policy = Policy.newBuilder().build();
* Policy response = databaseAdminClient.setIamPolicy(resource, policy);
* }
Expand Down Expand Up @@ -1015,7 +1017,10 @@ public final Policy setIamPolicy(ResourceName resource, Policy policy) {
*
* <pre>{@code
* try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
* String resource = DatabaseName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]").toString();
* String resource =
* CryptoKeyVersionName.of(
* "[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]")
* .toString();
* Policy policy = Policy.newBuilder().build();
* Policy response = databaseAdminClient.setIamPolicy(resource, policy);
* }
Expand Down Expand Up @@ -1049,7 +1054,14 @@ public final Policy setIamPolicy(String resource, Policy policy) {
* try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
* SetIamPolicyRequest request =
* SetIamPolicyRequest.newBuilder()
* .setResource(DatabaseName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]").toString())
* .setResource(
* CryptoKeyVersionName.of(
* "[PROJECT]",
* "[LOCATION]",
* "[KEY_RING]",
* "[CRYPTO_KEY]",
* "[CRYPTO_KEY_VERSION]")
* .toString())
* .setPolicy(Policy.newBuilder().build())
* .build();
* Policy response = databaseAdminClient.setIamPolicy(request);
Expand Down Expand Up @@ -1078,7 +1090,14 @@ public final Policy setIamPolicy(SetIamPolicyRequest request) {
* try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
* SetIamPolicyRequest request =
* SetIamPolicyRequest.newBuilder()
* .setResource(DatabaseName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]").toString())
* .setResource(
* CryptoKeyVersionName.of(
* "[PROJECT]",
* "[LOCATION]",
* "[KEY_RING]",
* "[CRYPTO_KEY]",
* "[CRYPTO_KEY_VERSION]")
* .toString())
* .setPolicy(Policy.newBuilder().build())
* .build();
* ApiFuture<Policy> future = databaseAdminClient.setIamPolicyCallable().futureCall(request);
Expand All @@ -1105,7 +1124,9 @@ public final UnaryCallable<SetIamPolicyRequest, Policy> setIamPolicyCallable() {
*
* <pre>{@code
* try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
* ResourceName resource = DatabaseName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]");
* ResourceName resource =
* CryptoKeyVersionName.of(
* "[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]");
* Policy response = databaseAdminClient.getIamPolicy(resource);
* }
* }</pre>
Expand Down Expand Up @@ -1136,7 +1157,10 @@ public final Policy getIamPolicy(ResourceName resource) {
*
* <pre>{@code
* try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
* String resource = DatabaseName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]").toString();
* String resource =
* CryptoKeyVersionName.of(
* "[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]")
* .toString();
* Policy response = databaseAdminClient.getIamPolicy(resource);
* }
* }</pre>
Expand Down Expand Up @@ -1166,7 +1190,14 @@ public final Policy getIamPolicy(String resource) {
* try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
* GetIamPolicyRequest request =
* GetIamPolicyRequest.newBuilder()
* .setResource(DatabaseName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]").toString())
* .setResource(
* CryptoKeyVersionName.of(
* "[PROJECT]",
* "[LOCATION]",
* "[KEY_RING]",
* "[CRYPTO_KEY]",
* "[CRYPTO_KEY_VERSION]")
* .toString())
* .setOptions(GetPolicyOptions.newBuilder().build())
* .build();
* Policy response = databaseAdminClient.getIamPolicy(request);
Expand Down Expand Up @@ -1196,7 +1227,14 @@ public final Policy getIamPolicy(GetIamPolicyRequest request) {
* try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
* GetIamPolicyRequest request =
* GetIamPolicyRequest.newBuilder()
* .setResource(DatabaseName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]").toString())
* .setResource(
* CryptoKeyVersionName.of(
* "[PROJECT]",
* "[LOCATION]",
* "[KEY_RING]",
* "[CRYPTO_KEY]",
* "[CRYPTO_KEY_VERSION]")
* .toString())
* .setOptions(GetPolicyOptions.newBuilder().build())
* .build();
* ApiFuture<Policy> future = databaseAdminClient.getIamPolicyCallable().futureCall(request);
Expand All @@ -1223,7 +1261,9 @@ public final UnaryCallable<GetIamPolicyRequest, Policy> getIamPolicyCallable() {
*
* <pre>{@code
* try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
* ResourceName resource = DatabaseName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]");
* ResourceName resource =
* CryptoKeyVersionName.of(
* "[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]");
* List<String> permissions = new ArrayList<>();
* TestIamPermissionsResponse response =
* databaseAdminClient.testIamPermissions(resource, permissions);
Expand Down Expand Up @@ -1261,7 +1301,10 @@ public final TestIamPermissionsResponse testIamPermissions(
*
* <pre>{@code
* try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
* String resource = DatabaseName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]").toString();
* String resource =
* CryptoKeyVersionName.of(
* "[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]")
* .toString();
* List<String> permissions = new ArrayList<>();
* TestIamPermissionsResponse response =
* databaseAdminClient.testIamPermissions(resource, permissions);
Expand Down Expand Up @@ -1301,7 +1344,14 @@ public final TestIamPermissionsResponse testIamPermissions(
* try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
* TestIamPermissionsRequest request =
* TestIamPermissionsRequest.newBuilder()
* .setResource(DatabaseName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]").toString())
* .setResource(
* CryptoKeyVersionName.of(
* "[PROJECT]",
* "[LOCATION]",
* "[KEY_RING]",
* "[CRYPTO_KEY]",
* "[CRYPTO_KEY_VERSION]")
* .toString())
* .addAllPermissions(new ArrayList<String>())
* .build();
* TestIamPermissionsResponse response = databaseAdminClient.testIamPermissions(request);
Expand Down Expand Up @@ -1331,7 +1381,14 @@ public final TestIamPermissionsResponse testIamPermissions(TestIamPermissionsReq
* try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
* TestIamPermissionsRequest request =
* TestIamPermissionsRequest.newBuilder()
* .setResource(DatabaseName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]").toString())
* .setResource(
* CryptoKeyVersionName.of(
* "[PROJECT]",
* "[LOCATION]",
* "[KEY_RING]",
* "[CRYPTO_KEY]",
* "[CRYPTO_KEY_VERSION]")
* .toString())
* .addAllPermissions(new ArrayList<String>())
* .build();
* ApiFuture<TestIamPermissionsResponse> future =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
import com.google.spanner.admin.database.v1.BackupName;
import com.google.spanner.admin.database.v1.CreateBackupRequest;
import com.google.spanner.admin.database.v1.CreateDatabaseRequest;
import com.google.spanner.admin.database.v1.CryptoKeyVersionName;
import com.google.spanner.admin.database.v1.Database;
import com.google.spanner.admin.database.v1.DatabaseName;
import com.google.spanner.admin.database.v1.DeleteBackupRequest;
Expand Down Expand Up @@ -650,7 +651,9 @@ public void setIamPolicyTest() throws Exception {
.build();
mockDatabaseAdmin.addResponse(expectedResponse);

ResourceName resource = DatabaseName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]");
ResourceName resource =
CryptoKeyVersionName.of(
"[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]");
Policy policy = Policy.newBuilder().build();

Policy actualResponse = client.setIamPolicy(resource, policy);
Expand All @@ -674,7 +677,9 @@ public void setIamPolicyExceptionTest() throws Exception {
mockDatabaseAdmin.addException(exception);

try {
ResourceName resource = DatabaseName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]");
ResourceName resource =
CryptoKeyVersionName.of(
"[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]");
Policy policy = Policy.newBuilder().build();
client.setIamPolicy(resource, policy);
Assert.fail("No exception raised");
Expand Down Expand Up @@ -736,7 +741,9 @@ public void getIamPolicyTest() throws Exception {
.build();
mockDatabaseAdmin.addResponse(expectedResponse);

ResourceName resource = DatabaseName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]");
ResourceName resource =
CryptoKeyVersionName.of(
"[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]");

Policy actualResponse = client.getIamPolicy(resource);
Assert.assertEquals(expectedResponse, actualResponse);
Expand All @@ -758,7 +765,9 @@ public void getIamPolicyExceptionTest() throws Exception {
mockDatabaseAdmin.addException(exception);

try {
ResourceName resource = DatabaseName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]");
ResourceName resource =
CryptoKeyVersionName.of(
"[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]");
client.getIamPolicy(resource);
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
Expand Down Expand Up @@ -812,7 +821,9 @@ public void testIamPermissionsTest() throws Exception {
TestIamPermissionsResponse.newBuilder().addAllPermissions(new ArrayList<String>()).build();
mockDatabaseAdmin.addResponse(expectedResponse);

ResourceName resource = DatabaseName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]");
ResourceName resource =
CryptoKeyVersionName.of(
"[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]");
List<String> permissions = new ArrayList<>();

TestIamPermissionsResponse actualResponse = client.testIamPermissions(resource, permissions);
Expand All @@ -836,7 +847,9 @@ public void testIamPermissionsExceptionTest() throws Exception {
mockDatabaseAdmin.addException(exception);

try {
ResourceName resource = DatabaseName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]");
ResourceName resource =
CryptoKeyVersionName.of(
"[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]");
List<String> permissions = new ArrayList<>();
client.testIamPermissions(resource, permissions);
Assert.fail("No exception raised");
Expand Down
Loading

0 comments on commit 7992342

Please sign in to comment.