From e859b29ccf4e68b1ab62cffdd4cf197011ba9878 Mon Sep 17 00:00:00 2001
From: cloud-java-bot <122572305+cloud-java-bot@users.noreply.github.com>
Date: Tue, 16 Jul 2024 06:04:17 -0400
Subject: [PATCH] chore: Update generation configuration at Thu Jul 11 11:15:38
UTC 2024 (#3208)
This pull request is generated with proto changes between [googleapis/googleapis@6f289d7](https://togithub.com/googleapis/googleapis/commit/6f289d775912966eb0cf04bda91e5e355c998d30) (exclusive) and [googleapis/googleapis@19577ed](https://togithub.com/googleapis/googleapis/commit/19577edb4d439db98d2fb1f6f48f2e1b29fba099) (inclusive).
BEGIN_COMMIT_OVERRIDE
BEGIN_NESTED_COMMIT
chore: update the libraries_bom version to 26.43.0
END_NESTED_COMMIT
BEGIN_NESTED_COMMIT
feat(spanner): Add support for Cloud Spanner Scheduled Backups
PiperOrigin-RevId: 649277844
Source Link: [googleapis/googleapis@fd7efa2](https://togithub.com/googleapis/googleapis/commit/fd7efa2da3860e813485e63661d3bdd21fc9ba82)
END_NESTED_COMMIT
BEGIN_NESTED_COMMIT
feat: add field order_by in spanner.proto
feat: add field lock_hint in spanner.proto
PiperOrigin-RevId: 636759139
Source Link: [googleapis/googleapis@eeed69d](https://togithub.com/googleapis/googleapis/commit/eeed69d446a90eb4a4a2d1762c49d637075390c1)
END_NESTED_COMMIT
BEGIN_NESTED_COMMIT
feat: Add QueryCancellationAction message in executor protos
PiperOrigin-RevId: 633451546
Source Link: [googleapis/googleapis@e3a34df](https://togithub.com/googleapis/googleapis/commit/e3a34df5b36e38a1ee0b1544ed4ae3b99cdf0f91)
END_NESTED_COMMIT
BEGIN_NESTED_COMMIT
chore: update copyright year for auto-generated protos
PiperOrigin-RevId: 631538781
Source Link: [googleapis/googleapis@3597f7d](https://togithub.com/googleapis/googleapis/commit/3597f7db2191c00b100400991ef96e52d62f5841)
END_NESTED_COMMIT
BEGIN_NESTED_COMMIT
feat: Add support for multi region encryption config
docs: fix linting for several doc comments
PiperOrigin-RevId: 630422337
Source Link: [googleapis/googleapis@65db386](https://togithub.com/googleapis/googleapis/commit/65db386b43905c561686b58344c5b620a10ed808)
END_NESTED_COMMIT
BEGIN_NESTED_COMMIT
feat: add `RESOURCE_EXHAUSTED` to the list of retryable error codes
PiperOrigin-RevId: 628281023
Source Link: [googleapis/googleapis@60536a2](https://togithub.com/googleapis/googleapis/commit/60536a2a263b6d33b0b1adb5b10c10e34ccf4528)
END_NESTED_COMMIT
BEGIN_NESTED_COMMIT
feat(spanner): adding `EXPECTED_FULFILLMENT_PERIOD` to the indicate instance creation times (with `FULFILLMENT_PERIOD_NORMAL` or `FULFILLMENT_PERIOD_EXTENDED` ENUM) with the extended instance creation time triggered by On-Demand Capacity Feature
PiperOrigin-RevId: 621488048
Source Link: [googleapis/googleapis@0aa0992](https://togithub.com/googleapis/googleapis/commit/0aa0992a5430c211a73c9b861d65e1e8a7a91a9e)
END_NESTED_COMMIT
BEGIN_NESTED_COMMIT
feat: Add SessionPoolOptions, SpannerOptions protos in executor protos
PiperOrigin-RevId: 621265883
Source Link: [googleapis/googleapis@fed9845](https://togithub.com/googleapis/googleapis/commit/fed9845c564d6acf8d03beee69b36666c8bd7fa4)
END_NESTED_COMMIT
END_COMMIT_OVERRIDE
---
.repo-metadata.json | 15 +-
README.md | 12 +-
generation_config.yaml | 4 +-
.../reflect-config.json | 180 ++
.../database/v1/DatabaseAdminClient.java | 914 ++++++-
.../database/v1/DatabaseAdminSettings.java | 70 +
.../admin/database/v1/gapic_metadata.json | 15 +
.../database/v1/stub/DatabaseAdminStub.java | 34 +
.../v1/stub/DatabaseAdminStubSettings.java | 209 +-
.../v1/stub/GrpcDatabaseAdminStub.java | 190 ++
.../v1/stub/HttpJsonDatabaseAdminStub.java | 342 ++-
.../reflect-config.json | 180 ++
.../v1/DatabaseAdminClientHttpJsonTest.java | 486 ++++
.../database/v1/DatabaseAdminClientTest.java | 423 +++
.../database/v1/MockDatabaseAdminImpl.java | 113 +
.../admin/database/v1/DatabaseAdminGrpc.java | 614 +++++
.../spanner/admin/database/v1/Backup.java | 394 +++
.../admin/database/v1/BackupOrBuilder.java | 87 +
.../admin/database/v1/BackupProto.java | 182 +-
.../admin/database/v1/BackupSchedule.java | 2335 +++++++++++++++++
.../admin/database/v1/BackupScheduleName.java | 261 ++
.../database/v1/BackupScheduleOrBuilder.java | 287 ++
.../database/v1/BackupScheduleProto.java | 237 ++
.../admin/database/v1/BackupScheduleSpec.java | 820 ++++++
.../v1/BackupScheduleSpecOrBuilder.java | 63 +
.../v1/CreateBackupScheduleRequest.java | 1152 ++++++++
.../CreateBackupScheduleRequestOrBuilder.java | 125 +
.../admin/database/v1/CrontabSpec.java | 1269 +++++++++
.../database/v1/CrontabSpecOrBuilder.java | 159 ++
.../v1/DeleteBackupScheduleRequest.java | 663 +++++
.../DeleteBackupScheduleRequestOrBuilder.java | 59 +
.../admin/database/v1/FullBackupSpec.java | 436 +++
.../database/v1/FullBackupSpecOrBuilder.java | 25 +
.../database/v1/GetBackupScheduleRequest.java | 660 +++++
.../v1/GetBackupScheduleRequestOrBuilder.java | 59 +
.../v1/ListBackupSchedulesRequest.java | 970 +++++++
.../ListBackupSchedulesRequestOrBuilder.java | 106 +
.../v1/ListBackupSchedulesResponse.java | 1158 ++++++++
.../ListBackupSchedulesResponseOrBuilder.java | 108 +
.../v1/SpannerDatabaseAdminProto.java | 549 ++--
.../v1/UpdateBackupScheduleRequest.java | 1107 ++++++++
.../UpdateBackupScheduleRequestOrBuilder.java | 123 +
.../spanner/admin/database/v1/backup.proto | 17 +
.../admin/database/v1/backup_schedule.proto | 227 ++
.../database/v1/spanner_database_admin.proto | 60 +
renovate.json | 4 +-
46 files changed, 17097 insertions(+), 406 deletions(-)
create mode 100644 proto-google-cloud-spanner-admin-database-v1/src/main/java/com/google/spanner/admin/database/v1/BackupSchedule.java
create mode 100644 proto-google-cloud-spanner-admin-database-v1/src/main/java/com/google/spanner/admin/database/v1/BackupScheduleName.java
create mode 100644 proto-google-cloud-spanner-admin-database-v1/src/main/java/com/google/spanner/admin/database/v1/BackupScheduleOrBuilder.java
create mode 100644 proto-google-cloud-spanner-admin-database-v1/src/main/java/com/google/spanner/admin/database/v1/BackupScheduleProto.java
create mode 100644 proto-google-cloud-spanner-admin-database-v1/src/main/java/com/google/spanner/admin/database/v1/BackupScheduleSpec.java
create mode 100644 proto-google-cloud-spanner-admin-database-v1/src/main/java/com/google/spanner/admin/database/v1/BackupScheduleSpecOrBuilder.java
create mode 100644 proto-google-cloud-spanner-admin-database-v1/src/main/java/com/google/spanner/admin/database/v1/CreateBackupScheduleRequest.java
create mode 100644 proto-google-cloud-spanner-admin-database-v1/src/main/java/com/google/spanner/admin/database/v1/CreateBackupScheduleRequestOrBuilder.java
create mode 100644 proto-google-cloud-spanner-admin-database-v1/src/main/java/com/google/spanner/admin/database/v1/CrontabSpec.java
create mode 100644 proto-google-cloud-spanner-admin-database-v1/src/main/java/com/google/spanner/admin/database/v1/CrontabSpecOrBuilder.java
create mode 100644 proto-google-cloud-spanner-admin-database-v1/src/main/java/com/google/spanner/admin/database/v1/DeleteBackupScheduleRequest.java
create mode 100644 proto-google-cloud-spanner-admin-database-v1/src/main/java/com/google/spanner/admin/database/v1/DeleteBackupScheduleRequestOrBuilder.java
create mode 100644 proto-google-cloud-spanner-admin-database-v1/src/main/java/com/google/spanner/admin/database/v1/FullBackupSpec.java
create mode 100644 proto-google-cloud-spanner-admin-database-v1/src/main/java/com/google/spanner/admin/database/v1/FullBackupSpecOrBuilder.java
create mode 100644 proto-google-cloud-spanner-admin-database-v1/src/main/java/com/google/spanner/admin/database/v1/GetBackupScheduleRequest.java
create mode 100644 proto-google-cloud-spanner-admin-database-v1/src/main/java/com/google/spanner/admin/database/v1/GetBackupScheduleRequestOrBuilder.java
create mode 100644 proto-google-cloud-spanner-admin-database-v1/src/main/java/com/google/spanner/admin/database/v1/ListBackupSchedulesRequest.java
create mode 100644 proto-google-cloud-spanner-admin-database-v1/src/main/java/com/google/spanner/admin/database/v1/ListBackupSchedulesRequestOrBuilder.java
create mode 100644 proto-google-cloud-spanner-admin-database-v1/src/main/java/com/google/spanner/admin/database/v1/ListBackupSchedulesResponse.java
create mode 100644 proto-google-cloud-spanner-admin-database-v1/src/main/java/com/google/spanner/admin/database/v1/ListBackupSchedulesResponseOrBuilder.java
create mode 100644 proto-google-cloud-spanner-admin-database-v1/src/main/java/com/google/spanner/admin/database/v1/UpdateBackupScheduleRequest.java
create mode 100644 proto-google-cloud-spanner-admin-database-v1/src/main/java/com/google/spanner/admin/database/v1/UpdateBackupScheduleRequestOrBuilder.java
create mode 100644 proto-google-cloud-spanner-admin-database-v1/src/main/proto/google/spanner/admin/database/v1/backup_schedule.proto
diff --git a/.repo-metadata.json b/.repo-metadata.json
index 80355fa2aff..5a0cd00cfe6 100644
--- a/.repo-metadata.json
+++ b/.repo-metadata.json
@@ -2,21 +2,20 @@
"api_shortname": "spanner",
"name_pretty": "Cloud Spanner",
"product_documentation": "https://cloud.google.com/spanner/docs/",
+ "api_description": "is a fully managed, mission-critical, relational database service that offers transactional consistency at global scale, \\nschemas, SQL (ANSI 2011 with extensions), and automatic, synchronous replication \\nfor high availability.\\n\\nBe sure to activate the Cloud Spanner API on the Developer's Console to\\nuse Cloud Spanner from your project.",
"client_documentation": "https://cloud.google.com/java/docs/reference/google-cloud-spanner/latest/history",
- "api_description": "is a fully managed, mission-critical, \nrelational database service that offers transactional consistency at global scale, \nschemas, SQL (ANSI 2011 with extensions), and automatic, synchronous replication \nfor high availability.\n\nBe sure to activate the Cloud Spanner API on the Developer's Console to\nuse Cloud Spanner from your project.",
- "issue_tracker": "https://issuetracker.google.com/issues?q=componentid:190851%2B%20status:open",
"release_level": "stable",
+ "transport": "both",
"language": "java",
- "min_java_version": 8,
"repo": "googleapis/java-spanner",
"repo_short": "java-spanner",
"distribution_name": "com.google.cloud:google-cloud-spanner",
"api_id": "spanner.googleapis.com",
- "transport": "grpc",
+ "library_type": "GAPIC_COMBO",
"requires_billing": true,
"codeowner_team": "@googleapis/api-spanner-java",
- "library_type": "GAPIC_COMBO",
"excluded_poms": "google-cloud-spanner-bom",
- "recommended_package": "com.google.cloud.spanner"
-}
-
+ "issue_tracker": "https://issuetracker.google.com/issues?q=componentid:190851%2B%20status:open",
+ "recommended_package": "com.google.cloud.spanner",
+ "min_java_version": 8
+}
\ No newline at end of file
diff --git a/README.md b/README.md
index 3663b2c6f9c..95846aead8e 100644
--- a/README.md
+++ b/README.md
@@ -50,7 +50,7 @@ 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.42.0')
+implementation platform('com.google.cloud:libraries-bom:26.43.0')
implementation 'com.google.cloud:google-cloud-spanner'
```
@@ -93,13 +93,7 @@ to add `google-cloud-spanner` as a dependency in your code.
## About Cloud Spanner
-[Cloud Spanner][product-docs] is a fully managed, mission-critical,
-relational database service that offers transactional consistency at global scale,
-schemas, SQL (ANSI 2011 with extensions), and automatic, synchronous replication
-for high availability.
-
-Be sure to activate the Cloud Spanner API on the Developer's Console to
-use Cloud Spanner from your project.
+[Cloud Spanner][product-docs] is a fully managed, mission-critical, relational database service that offers transactional consistency at global scale, \nschemas, SQL (ANSI 2011 with extensions), and automatic, synchronous replication \nfor high availability.\n\nBe sure to activate the Cloud Spanner API on the Developer's Console to\nuse Cloud Spanner from your project.
See the [Cloud Spanner client library docs][javadocs] to learn how to
use this Cloud Spanner Client Library.
@@ -627,7 +621,7 @@ To get help, follow the instructions in the [shared Troubleshooting document][tr
## Transport
-Cloud Spanner uses gRPC for the transport layer.
+Cloud Spanner uses both gRPC and HTTP/JSON for the transport layer.
## Supported Java Versions
diff --git a/generation_config.yaml b/generation_config.yaml
index 8f89fb578b3..5db47f1db7c 100644
--- a/generation_config.yaml
+++ b/generation_config.yaml
@@ -1,6 +1,6 @@
gapic_generator_version: 2.42.0
-googleapis_commitish: 6f289d775912966eb0cf04bda91e5e355c998d30
-libraries_bom_version: 26.38.0
+googleapis_commitish: 19577edb4d439db98d2fb1f6f48f2e1b29fba099
+libraries_bom_version: 26.43.0
libraries:
- api_shortname: spanner
name_pretty: Cloud Spanner
diff --git a/google-cloud-spanner-executor/src/main/resources/META-INF/native-image/com.google.cloud.spanner.executor.v1/reflect-config.json b/google-cloud-spanner-executor/src/main/resources/META-INF/native-image/com.google.cloud.spanner.executor.v1/reflect-config.json
index 1bbd31bc982..f0594591386 100644
--- a/google-cloud-spanner-executor/src/main/resources/META-INF/native-image/com.google.cloud.spanner.executor.v1/reflect-config.json
+++ b/google-cloud-spanner-executor/src/main/resources/META-INF/native-image/com.google.cloud.spanner.executor.v1/reflect-config.json
@@ -1709,6 +1709,42 @@
"allDeclaredClasses": true,
"allPublicClasses": true
},
+ {
+ "name": "com.google.spanner.admin.database.v1.BackupSchedule",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
+ {
+ "name": "com.google.spanner.admin.database.v1.BackupSchedule$Builder",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
+ {
+ "name": "com.google.spanner.admin.database.v1.BackupScheduleSpec",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
+ {
+ "name": "com.google.spanner.admin.database.v1.BackupScheduleSpec$Builder",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
{
"name": "com.google.spanner.admin.database.v1.CopyBackupEncryptionConfig",
"queryAllDeclaredConstructors": true,
@@ -1835,6 +1871,24 @@
"allDeclaredClasses": true,
"allPublicClasses": true
},
+ {
+ "name": "com.google.spanner.admin.database.v1.CreateBackupScheduleRequest",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
+ {
+ "name": "com.google.spanner.admin.database.v1.CreateBackupScheduleRequest$Builder",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
{
"name": "com.google.spanner.admin.database.v1.CreateDatabaseMetadata",
"queryAllDeclaredConstructors": true,
@@ -1871,6 +1925,24 @@
"allDeclaredClasses": true,
"allPublicClasses": true
},
+ {
+ "name": "com.google.spanner.admin.database.v1.CrontabSpec",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
+ {
+ "name": "com.google.spanner.admin.database.v1.CrontabSpec$Builder",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
{
"name": "com.google.spanner.admin.database.v1.Database",
"queryAllDeclaredConstructors": true,
@@ -1961,6 +2033,24 @@
"allDeclaredClasses": true,
"allPublicClasses": true
},
+ {
+ "name": "com.google.spanner.admin.database.v1.DeleteBackupScheduleRequest",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
+ {
+ "name": "com.google.spanner.admin.database.v1.DeleteBackupScheduleRequest$Builder",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
{
"name": "com.google.spanner.admin.database.v1.DropDatabaseRequest",
"queryAllDeclaredConstructors": true,
@@ -2024,6 +2114,24 @@
"allDeclaredClasses": true,
"allPublicClasses": true
},
+ {
+ "name": "com.google.spanner.admin.database.v1.FullBackupSpec",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
+ {
+ "name": "com.google.spanner.admin.database.v1.FullBackupSpec$Builder",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
{
"name": "com.google.spanner.admin.database.v1.GetBackupRequest",
"queryAllDeclaredConstructors": true,
@@ -2042,6 +2150,24 @@
"allDeclaredClasses": true,
"allPublicClasses": true
},
+ {
+ "name": "com.google.spanner.admin.database.v1.GetBackupScheduleRequest",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
+ {
+ "name": "com.google.spanner.admin.database.v1.GetBackupScheduleRequest$Builder",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
{
"name": "com.google.spanner.admin.database.v1.GetDatabaseDdlRequest",
"queryAllDeclaredConstructors": true,
@@ -2132,6 +2258,42 @@
"allDeclaredClasses": true,
"allPublicClasses": true
},
+ {
+ "name": "com.google.spanner.admin.database.v1.ListBackupSchedulesRequest",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
+ {
+ "name": "com.google.spanner.admin.database.v1.ListBackupSchedulesRequest$Builder",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
+ {
+ "name": "com.google.spanner.admin.database.v1.ListBackupSchedulesResponse",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
+ {
+ "name": "com.google.spanner.admin.database.v1.ListBackupSchedulesResponse$Builder",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
{
"name": "com.google.spanner.admin.database.v1.ListBackupsRequest",
"queryAllDeclaredConstructors": true,
@@ -2420,6 +2582,24 @@
"allDeclaredClasses": true,
"allPublicClasses": true
},
+ {
+ "name": "com.google.spanner.admin.database.v1.UpdateBackupScheduleRequest",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
+ {
+ "name": "com.google.spanner.admin.database.v1.UpdateBackupScheduleRequest$Builder",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
{
"name": "com.google.spanner.admin.database.v1.UpdateDatabaseDdlMetadata",
"queryAllDeclaredConstructors": true,
diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/database/v1/DatabaseAdminClient.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/database/v1/DatabaseAdminClient.java
index e518198549b..dd00f6750c7 100644
--- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/database/v1/DatabaseAdminClient.java
+++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/database/v1/DatabaseAdminClient.java
@@ -43,24 +43,31 @@
import com.google.protobuf.Timestamp;
import com.google.spanner.admin.database.v1.Backup;
import com.google.spanner.admin.database.v1.BackupName;
+import com.google.spanner.admin.database.v1.BackupSchedule;
+import com.google.spanner.admin.database.v1.BackupScheduleName;
import com.google.spanner.admin.database.v1.CopyBackupMetadata;
import com.google.spanner.admin.database.v1.CopyBackupRequest;
import com.google.spanner.admin.database.v1.CreateBackupMetadata;
import com.google.spanner.admin.database.v1.CreateBackupRequest;
+import com.google.spanner.admin.database.v1.CreateBackupScheduleRequest;
import com.google.spanner.admin.database.v1.CreateDatabaseMetadata;
import com.google.spanner.admin.database.v1.CreateDatabaseRequest;
import com.google.spanner.admin.database.v1.Database;
import com.google.spanner.admin.database.v1.DatabaseName;
import com.google.spanner.admin.database.v1.DatabaseRole;
import com.google.spanner.admin.database.v1.DeleteBackupRequest;
+import com.google.spanner.admin.database.v1.DeleteBackupScheduleRequest;
import com.google.spanner.admin.database.v1.DropDatabaseRequest;
import com.google.spanner.admin.database.v1.GetBackupRequest;
+import com.google.spanner.admin.database.v1.GetBackupScheduleRequest;
import com.google.spanner.admin.database.v1.GetDatabaseDdlRequest;
import com.google.spanner.admin.database.v1.GetDatabaseDdlResponse;
import com.google.spanner.admin.database.v1.GetDatabaseRequest;
import com.google.spanner.admin.database.v1.InstanceName;
import com.google.spanner.admin.database.v1.ListBackupOperationsRequest;
import com.google.spanner.admin.database.v1.ListBackupOperationsResponse;
+import com.google.spanner.admin.database.v1.ListBackupSchedulesRequest;
+import com.google.spanner.admin.database.v1.ListBackupSchedulesResponse;
import com.google.spanner.admin.database.v1.ListBackupsRequest;
import com.google.spanner.admin.database.v1.ListBackupsResponse;
import com.google.spanner.admin.database.v1.ListDatabaseOperationsRequest;
@@ -72,6 +79,7 @@
import com.google.spanner.admin.database.v1.RestoreDatabaseMetadata;
import com.google.spanner.admin.database.v1.RestoreDatabaseRequest;
import com.google.spanner.admin.database.v1.UpdateBackupRequest;
+import com.google.spanner.admin.database.v1.UpdateBackupScheduleRequest;
import com.google.spanner.admin.database.v1.UpdateDatabaseDdlMetadata;
import com.google.spanner.admin.database.v1.UpdateDatabaseDdlRequest;
import com.google.spanner.admin.database.v1.UpdateDatabaseMetadata;
@@ -515,6 +523,101 @@
*
*
*
+ *
+ * CreateBackupSchedule |
+ * Creates a new backup schedule. |
+ *
+ * Request object method variants only take one parameter, a request object, which must be constructed before the call.
+ *
+ * "Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
+ *
+ * createBackupSchedule(DatabaseName parent, BackupSchedule backupSchedule, String backupScheduleId)
+ * createBackupSchedule(String parent, BackupSchedule backupSchedule, String backupScheduleId)
+ *
+ * Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
+ *
+ * |
+ *
+ *
+ * GetBackupSchedule |
+ * Gets backup schedule for the input schedule name. |
+ *
+ * Request object method variants only take one parameter, a request object, which must be constructed before the call.
+ *
+ * "Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
+ *
+ * Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
+ *
+ * |
+ *
+ *
+ * UpdateBackupSchedule |
+ * Updates a backup schedule. |
+ *
+ * Request object method variants only take one parameter, a request object, which must be constructed before the call.
+ *
+ * "Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
+ *
+ * Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
+ *
+ * |
+ *
+ *
+ * DeleteBackupSchedule |
+ * Deletes a backup schedule. |
+ *
+ * Request object method variants only take one parameter, a request object, which must be constructed before the call.
+ *
+ * "Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
+ *
+ * Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
+ *
+ * |
+ *
+ *
+ * ListBackupSchedules |
+ * Lists all the backup schedules for the database. |
+ *
+ * Request object method variants only take one parameter, a request object, which must be constructed before the call.
+ *
+ * "Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
+ *
+ * Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
+ *
+ * |
+ *
*
*
* See the individual methods for example code.
@@ -4215,62 +4318,707 @@ public final ListDatabaseRolesPagedResponse listDatabaseRoles(ListDatabaseRolesR
return stub.listDatabaseRolesCallable();
}
- @Override
- public final void close() {
- stub.close();
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Creates a new backup schedule.
+ *
+ *
Sample code:
+ *
+ *
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - 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
+ * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
+ * DatabaseName parent = DatabaseName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]");
+ * BackupSchedule backupSchedule = BackupSchedule.newBuilder().build();
+ * String backupScheduleId = "backupScheduleId1704974708";
+ * BackupSchedule response =
+ * databaseAdminClient.createBackupSchedule(parent, backupSchedule, backupScheduleId);
+ * }
+ * }
+ *
+ * @param parent Required. The name of the database that this backup schedule applies to.
+ * @param backupSchedule Required. The backup schedule to create.
+ * @param backupScheduleId Required. The Id to use for the backup schedule. The
+ * `backup_schedule_id` appended to `parent` forms the full backup schedule name of the form
+ * `projects/<project>/instances/<instance>/databases/<database>/backupSchedules/<backup_schedule_id>`.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final BackupSchedule createBackupSchedule(
+ DatabaseName parent, BackupSchedule backupSchedule, String backupScheduleId) {
+ CreateBackupScheduleRequest request =
+ CreateBackupScheduleRequest.newBuilder()
+ .setParent(parent == null ? null : parent.toString())
+ .setBackupSchedule(backupSchedule)
+ .setBackupScheduleId(backupScheduleId)
+ .build();
+ return createBackupSchedule(request);
}
- @Override
- public void shutdown() {
- stub.shutdown();
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Creates a new backup schedule.
+ *
+ * Sample code:
+ *
+ *
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - 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
+ * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
+ * String parent = DatabaseName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]").toString();
+ * BackupSchedule backupSchedule = BackupSchedule.newBuilder().build();
+ * String backupScheduleId = "backupScheduleId1704974708";
+ * BackupSchedule response =
+ * databaseAdminClient.createBackupSchedule(parent, backupSchedule, backupScheduleId);
+ * }
+ * }
+ *
+ * @param parent Required. The name of the database that this backup schedule applies to.
+ * @param backupSchedule Required. The backup schedule to create.
+ * @param backupScheduleId Required. The Id to use for the backup schedule. The
+ * `backup_schedule_id` appended to `parent` forms the full backup schedule name of the form
+ * `projects/<project>/instances/<instance>/databases/<database>/backupSchedules/<backup_schedule_id>`.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final BackupSchedule createBackupSchedule(
+ String parent, BackupSchedule backupSchedule, String backupScheduleId) {
+ CreateBackupScheduleRequest request =
+ CreateBackupScheduleRequest.newBuilder()
+ .setParent(parent)
+ .setBackupSchedule(backupSchedule)
+ .setBackupScheduleId(backupScheduleId)
+ .build();
+ return createBackupSchedule(request);
}
- @Override
- public boolean isShutdown() {
- return stub.isShutdown();
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Creates a new backup schedule.
+ *
+ * Sample code:
+ *
+ *
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - 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
+ * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
+ * CreateBackupScheduleRequest request =
+ * CreateBackupScheduleRequest.newBuilder()
+ * .setParent(DatabaseName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]").toString())
+ * .setBackupScheduleId("backupScheduleId1704974708")
+ * .setBackupSchedule(BackupSchedule.newBuilder().build())
+ * .build();
+ * BackupSchedule response = databaseAdminClient.createBackupSchedule(request);
+ * }
+ * }
+ *
+ * @param request The request object containing all of the parameters for the API call.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final BackupSchedule createBackupSchedule(CreateBackupScheduleRequest request) {
+ return createBackupScheduleCallable().call(request);
}
- @Override
- public boolean isTerminated() {
- return stub.isTerminated();
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Creates a new backup schedule.
+ *
+ * Sample code:
+ *
+ *
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - 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
+ * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
+ * CreateBackupScheduleRequest request =
+ * CreateBackupScheduleRequest.newBuilder()
+ * .setParent(DatabaseName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]").toString())
+ * .setBackupScheduleId("backupScheduleId1704974708")
+ * .setBackupSchedule(BackupSchedule.newBuilder().build())
+ * .build();
+ * ApiFuture future =
+ * databaseAdminClient.createBackupScheduleCallable().futureCall(request);
+ * // Do something.
+ * BackupSchedule response = future.get();
+ * }
+ * }
+ */
+ public final UnaryCallable
+ createBackupScheduleCallable() {
+ return stub.createBackupScheduleCallable();
}
- @Override
- public void shutdownNow() {
- stub.shutdownNow();
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Gets backup schedule for the input schedule name.
+ *
+ * Sample code:
+ *
+ *
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - 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
+ * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
+ * BackupScheduleName name =
+ * BackupScheduleName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SCHEDULE]");
+ * BackupSchedule response = databaseAdminClient.getBackupSchedule(name);
+ * }
+ * }
+ *
+ * @param name Required. The name of the schedule to retrieve. Values are of the form
+ * `projects/<project>/instances/<instance>/databases/<database>/backupSchedules/<backup_schedule_id>`.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final BackupSchedule getBackupSchedule(BackupScheduleName name) {
+ GetBackupScheduleRequest request =
+ GetBackupScheduleRequest.newBuilder()
+ .setName(name == null ? null : name.toString())
+ .build();
+ return getBackupSchedule(request);
}
- @Override
- public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException {
- return stub.awaitTermination(duration, unit);
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Gets backup schedule for the input schedule name.
+ *
+ * Sample code:
+ *
+ *
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - 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
+ * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
+ * String name =
+ * BackupScheduleName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SCHEDULE]").toString();
+ * BackupSchedule response = databaseAdminClient.getBackupSchedule(name);
+ * }
+ * }
+ *
+ * @param name Required. The name of the schedule to retrieve. Values are of the form
+ * `projects/<project>/instances/<instance>/databases/<database>/backupSchedules/<backup_schedule_id>`.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final BackupSchedule getBackupSchedule(String name) {
+ GetBackupScheduleRequest request = GetBackupScheduleRequest.newBuilder().setName(name).build();
+ return getBackupSchedule(request);
}
- public static class ListDatabasesPagedResponse
- extends AbstractPagedListResponse<
- ListDatabasesRequest,
- ListDatabasesResponse,
- Database,
- ListDatabasesPage,
- ListDatabasesFixedSizeCollection> {
-
- public static ApiFuture createAsync(
- PageContext context,
- ApiFuture futureResponse) {
- ApiFuture futurePage =
- ListDatabasesPage.createEmptyPage().createPageAsync(context, futureResponse);
- return ApiFutures.transform(
- futurePage,
- input -> new ListDatabasesPagedResponse(input),
- MoreExecutors.directExecutor());
- }
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Gets backup schedule for the input schedule name.
+ *
+ * Sample code:
+ *
+ *
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - 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
+ * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
+ * GetBackupScheduleRequest request =
+ * GetBackupScheduleRequest.newBuilder()
+ * .setName(
+ * BackupScheduleName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SCHEDULE]")
+ * .toString())
+ * .build();
+ * BackupSchedule response = databaseAdminClient.getBackupSchedule(request);
+ * }
+ * }
+ *
+ * @param request The request object containing all of the parameters for the API call.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final BackupSchedule getBackupSchedule(GetBackupScheduleRequest request) {
+ return getBackupScheduleCallable().call(request);
+ }
- private ListDatabasesPagedResponse(ListDatabasesPage page) {
- super(page, ListDatabasesFixedSizeCollection.createEmptyCollection());
- }
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Gets backup schedule for the input schedule name.
+ *
+ * Sample code:
+ *
+ *
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - 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
+ * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
+ * GetBackupScheduleRequest request =
+ * GetBackupScheduleRequest.newBuilder()
+ * .setName(
+ * BackupScheduleName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SCHEDULE]")
+ * .toString())
+ * .build();
+ * ApiFuture future =
+ * databaseAdminClient.getBackupScheduleCallable().futureCall(request);
+ * // Do something.
+ * BackupSchedule response = future.get();
+ * }
+ * }
+ */
+ public final UnaryCallable getBackupScheduleCallable() {
+ return stub.getBackupScheduleCallable();
}
- public static class ListDatabasesPage
- extends AbstractPage<
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Updates a backup schedule.
+ *
+ * Sample code:
+ *
+ *
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - 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
+ * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
+ * BackupSchedule backupSchedule = BackupSchedule.newBuilder().build();
+ * FieldMask updateMask = FieldMask.newBuilder().build();
+ * BackupSchedule response =
+ * databaseAdminClient.updateBackupSchedule(backupSchedule, updateMask);
+ * }
+ * }
+ *
+ * @param backupSchedule Required. The backup schedule to update. `backup_schedule.name`, and the
+ * fields to be updated as specified by `update_mask` are required. Other fields are ignored.
+ * @param updateMask Required. A mask specifying which fields in the BackupSchedule resource
+ * should be updated. This mask is relative to the BackupSchedule resource, not to the request
+ * message. The field mask must always be specified; this prevents any future fields from
+ * being erased accidentally.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final BackupSchedule updateBackupSchedule(
+ BackupSchedule backupSchedule, FieldMask updateMask) {
+ UpdateBackupScheduleRequest request =
+ UpdateBackupScheduleRequest.newBuilder()
+ .setBackupSchedule(backupSchedule)
+ .setUpdateMask(updateMask)
+ .build();
+ return updateBackupSchedule(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Updates a backup schedule.
+ *
+ * Sample code:
+ *
+ *
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - 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
+ * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
+ * UpdateBackupScheduleRequest request =
+ * UpdateBackupScheduleRequest.newBuilder()
+ * .setBackupSchedule(BackupSchedule.newBuilder().build())
+ * .setUpdateMask(FieldMask.newBuilder().build())
+ * .build();
+ * BackupSchedule response = databaseAdminClient.updateBackupSchedule(request);
+ * }
+ * }
+ *
+ * @param request The request object containing all of the parameters for the API call.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final BackupSchedule updateBackupSchedule(UpdateBackupScheduleRequest request) {
+ return updateBackupScheduleCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Updates a backup schedule.
+ *
+ * Sample code:
+ *
+ *
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - 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
+ * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
+ * UpdateBackupScheduleRequest request =
+ * UpdateBackupScheduleRequest.newBuilder()
+ * .setBackupSchedule(BackupSchedule.newBuilder().build())
+ * .setUpdateMask(FieldMask.newBuilder().build())
+ * .build();
+ * ApiFuture future =
+ * databaseAdminClient.updateBackupScheduleCallable().futureCall(request);
+ * // Do something.
+ * BackupSchedule response = future.get();
+ * }
+ * }
+ */
+ public final UnaryCallable
+ updateBackupScheduleCallable() {
+ return stub.updateBackupScheduleCallable();
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Deletes a backup schedule.
+ *
+ * Sample code:
+ *
+ *
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - 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
+ * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
+ * BackupScheduleName name =
+ * BackupScheduleName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SCHEDULE]");
+ * databaseAdminClient.deleteBackupSchedule(name);
+ * }
+ * }
+ *
+ * @param name Required. The name of the schedule to delete. Values are of the form
+ * `projects/<project>/instances/<instance>/databases/<database>/backupSchedules/<backup_schedule_id>`.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final void deleteBackupSchedule(BackupScheduleName name) {
+ DeleteBackupScheduleRequest request =
+ DeleteBackupScheduleRequest.newBuilder()
+ .setName(name == null ? null : name.toString())
+ .build();
+ deleteBackupSchedule(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Deletes a backup schedule.
+ *
+ * Sample code:
+ *
+ *
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - 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
+ * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
+ * String name =
+ * BackupScheduleName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SCHEDULE]").toString();
+ * databaseAdminClient.deleteBackupSchedule(name);
+ * }
+ * }
+ *
+ * @param name Required. The name of the schedule to delete. Values are of the form
+ * `projects/<project>/instances/<instance>/databases/<database>/backupSchedules/<backup_schedule_id>`.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final void deleteBackupSchedule(String name) {
+ DeleteBackupScheduleRequest request =
+ DeleteBackupScheduleRequest.newBuilder().setName(name).build();
+ deleteBackupSchedule(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Deletes a backup schedule.
+ *
+ * Sample code:
+ *
+ *
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - 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
+ * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
+ * DeleteBackupScheduleRequest request =
+ * DeleteBackupScheduleRequest.newBuilder()
+ * .setName(
+ * BackupScheduleName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SCHEDULE]")
+ * .toString())
+ * .build();
+ * databaseAdminClient.deleteBackupSchedule(request);
+ * }
+ * }
+ *
+ * @param request The request object containing all of the parameters for the API call.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final void deleteBackupSchedule(DeleteBackupScheduleRequest request) {
+ deleteBackupScheduleCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Deletes a backup schedule.
+ *
+ * Sample code:
+ *
+ *
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - 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
+ * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
+ * DeleteBackupScheduleRequest request =
+ * DeleteBackupScheduleRequest.newBuilder()
+ * .setName(
+ * BackupScheduleName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SCHEDULE]")
+ * .toString())
+ * .build();
+ * ApiFuture future =
+ * databaseAdminClient.deleteBackupScheduleCallable().futureCall(request);
+ * // Do something.
+ * future.get();
+ * }
+ * }
+ */
+ public final UnaryCallable deleteBackupScheduleCallable() {
+ return stub.deleteBackupScheduleCallable();
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Lists all the backup schedules for the database.
+ *
+ * Sample code:
+ *
+ *
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - 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
+ * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
+ * DatabaseName parent = DatabaseName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]");
+ * for (BackupSchedule element : databaseAdminClient.listBackupSchedules(parent).iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ * }
+ *
+ * @param parent Required. Database is the parent resource whose backup schedules should be
+ * listed. Values are of the form
+ * projects/<project>/instances/<instance>/databases/<database>
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final ListBackupSchedulesPagedResponse listBackupSchedules(DatabaseName parent) {
+ ListBackupSchedulesRequest request =
+ ListBackupSchedulesRequest.newBuilder()
+ .setParent(parent == null ? null : parent.toString())
+ .build();
+ return listBackupSchedules(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Lists all the backup schedules for the database.
+ *
+ * Sample code:
+ *
+ *
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - 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
+ * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
+ * String parent = DatabaseName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]").toString();
+ * for (BackupSchedule element : databaseAdminClient.listBackupSchedules(parent).iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ * }
+ *
+ * @param parent Required. Database is the parent resource whose backup schedules should be
+ * listed. Values are of the form
+ * projects/<project>/instances/<instance>/databases/<database>
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final ListBackupSchedulesPagedResponse listBackupSchedules(String parent) {
+ ListBackupSchedulesRequest request =
+ ListBackupSchedulesRequest.newBuilder().setParent(parent).build();
+ return listBackupSchedules(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Lists all the backup schedules for the database.
+ *
+ * Sample code:
+ *
+ *
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - 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
+ * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
+ * ListBackupSchedulesRequest request =
+ * ListBackupSchedulesRequest.newBuilder()
+ * .setParent(DatabaseName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]").toString())
+ * .setPageSize(883849137)
+ * .setPageToken("pageToken873572522")
+ * .build();
+ * for (BackupSchedule element : databaseAdminClient.listBackupSchedules(request).iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ * }
+ *
+ * @param request The request object containing all of the parameters for the API call.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final ListBackupSchedulesPagedResponse listBackupSchedules(
+ ListBackupSchedulesRequest request) {
+ return listBackupSchedulesPagedCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Lists all the backup schedules for the database.
+ *
+ * Sample code:
+ *
+ *
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - 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
+ * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
+ * ListBackupSchedulesRequest request =
+ * ListBackupSchedulesRequest.newBuilder()
+ * .setParent(DatabaseName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]").toString())
+ * .setPageSize(883849137)
+ * .setPageToken("pageToken873572522")
+ * .build();
+ * ApiFuture future =
+ * databaseAdminClient.listBackupSchedulesPagedCallable().futureCall(request);
+ * // Do something.
+ * for (BackupSchedule element : future.get().iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ * }
+ */
+ public final UnaryCallable
+ listBackupSchedulesPagedCallable() {
+ return stub.listBackupSchedulesPagedCallable();
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Lists all the backup schedules for the database.
+ *
+ * Sample code:
+ *
+ *
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - 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
+ * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
+ * ListBackupSchedulesRequest request =
+ * ListBackupSchedulesRequest.newBuilder()
+ * .setParent(DatabaseName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]").toString())
+ * .setPageSize(883849137)
+ * .setPageToken("pageToken873572522")
+ * .build();
+ * while (true) {
+ * ListBackupSchedulesResponse response =
+ * databaseAdminClient.listBackupSchedulesCallable().call(request);
+ * for (BackupSchedule element : response.getBackupSchedulesList()) {
+ * // doThingsWith(element);
+ * }
+ * String nextPageToken = response.getNextPageToken();
+ * if (!Strings.isNullOrEmpty(nextPageToken)) {
+ * request = request.toBuilder().setPageToken(nextPageToken).build();
+ * } else {
+ * break;
+ * }
+ * }
+ * }
+ * }
+ */
+ public final UnaryCallable
+ listBackupSchedulesCallable() {
+ return stub.listBackupSchedulesCallable();
+ }
+
+ @Override
+ public final void close() {
+ stub.close();
+ }
+
+ @Override
+ public void shutdown() {
+ stub.shutdown();
+ }
+
+ @Override
+ public boolean isShutdown() {
+ return stub.isShutdown();
+ }
+
+ @Override
+ public boolean isTerminated() {
+ return stub.isTerminated();
+ }
+
+ @Override
+ public void shutdownNow() {
+ stub.shutdownNow();
+ }
+
+ @Override
+ public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException {
+ return stub.awaitTermination(duration, unit);
+ }
+
+ public static class ListDatabasesPagedResponse
+ extends AbstractPagedListResponse<
+ ListDatabasesRequest,
+ ListDatabasesResponse,
+ Database,
+ ListDatabasesPage,
+ ListDatabasesFixedSizeCollection> {
+
+ public static ApiFuture createAsync(
+ PageContext context,
+ ApiFuture futureResponse) {
+ ApiFuture futurePage =
+ ListDatabasesPage.createEmptyPage().createPageAsync(context, futureResponse);
+ return ApiFutures.transform(
+ futurePage,
+ input -> new ListDatabasesPagedResponse(input),
+ MoreExecutors.directExecutor());
+ }
+
+ private ListDatabasesPagedResponse(ListDatabasesPage page) {
+ super(page, ListDatabasesFixedSizeCollection.createEmptyCollection());
+ }
+ }
+
+ public static class ListDatabasesPage
+ extends AbstractPage<
ListDatabasesRequest, ListDatabasesResponse, Database, ListDatabasesPage> {
private ListDatabasesPage(
@@ -4637,4 +5385,88 @@ protected ListDatabaseRolesFixedSizeCollection createCollection(
return new ListDatabaseRolesFixedSizeCollection(pages, collectionSize);
}
}
+
+ public static class ListBackupSchedulesPagedResponse
+ extends AbstractPagedListResponse<
+ ListBackupSchedulesRequest,
+ ListBackupSchedulesResponse,
+ BackupSchedule,
+ ListBackupSchedulesPage,
+ ListBackupSchedulesFixedSizeCollection> {
+
+ public static ApiFuture createAsync(
+ PageContext
+ context,
+ ApiFuture futureResponse) {
+ ApiFuture futurePage =
+ ListBackupSchedulesPage.createEmptyPage().createPageAsync(context, futureResponse);
+ return ApiFutures.transform(
+ futurePage,
+ input -> new ListBackupSchedulesPagedResponse(input),
+ MoreExecutors.directExecutor());
+ }
+
+ private ListBackupSchedulesPagedResponse(ListBackupSchedulesPage page) {
+ super(page, ListBackupSchedulesFixedSizeCollection.createEmptyCollection());
+ }
+ }
+
+ public static class ListBackupSchedulesPage
+ extends AbstractPage<
+ ListBackupSchedulesRequest,
+ ListBackupSchedulesResponse,
+ BackupSchedule,
+ ListBackupSchedulesPage> {
+
+ private ListBackupSchedulesPage(
+ PageContext
+ context,
+ ListBackupSchedulesResponse response) {
+ super(context, response);
+ }
+
+ private static ListBackupSchedulesPage createEmptyPage() {
+ return new ListBackupSchedulesPage(null, null);
+ }
+
+ @Override
+ protected ListBackupSchedulesPage createPage(
+ PageContext
+ context,
+ ListBackupSchedulesResponse response) {
+ return new ListBackupSchedulesPage(context, response);
+ }
+
+ @Override
+ public ApiFuture createPageAsync(
+ PageContext
+ context,
+ ApiFuture futureResponse) {
+ return super.createPageAsync(context, futureResponse);
+ }
+ }
+
+ public static class ListBackupSchedulesFixedSizeCollection
+ extends AbstractFixedSizeCollection<
+ ListBackupSchedulesRequest,
+ ListBackupSchedulesResponse,
+ BackupSchedule,
+ ListBackupSchedulesPage,
+ ListBackupSchedulesFixedSizeCollection> {
+
+ private ListBackupSchedulesFixedSizeCollection(
+ List pages, int collectionSize) {
+ super(pages, collectionSize);
+ }
+
+ private static ListBackupSchedulesFixedSizeCollection createEmptyCollection() {
+ return new ListBackupSchedulesFixedSizeCollection(null, 0);
+ }
+
+ @Override
+ protected ListBackupSchedulesFixedSizeCollection createCollection(
+ List pages, int collectionSize) {
+ return new ListBackupSchedulesFixedSizeCollection(pages, collectionSize);
+ }
+ }
}
diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/database/v1/DatabaseAdminSettings.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/database/v1/DatabaseAdminSettings.java
index 50d6900e1ce..513f91e7100 100644
--- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/database/v1/DatabaseAdminSettings.java
+++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/database/v1/DatabaseAdminSettings.java
@@ -17,6 +17,7 @@
package com.google.cloud.spanner.admin.database.v1;
import static com.google.cloud.spanner.admin.database.v1.DatabaseAdminClient.ListBackupOperationsPagedResponse;
+import static com.google.cloud.spanner.admin.database.v1.DatabaseAdminClient.ListBackupSchedulesPagedResponse;
import static com.google.cloud.spanner.admin.database.v1.DatabaseAdminClient.ListBackupsPagedResponse;
import static com.google.cloud.spanner.admin.database.v1.DatabaseAdminClient.ListDatabaseOperationsPagedResponse;
import static com.google.cloud.spanner.admin.database.v1.DatabaseAdminClient.ListDatabaseRolesPagedResponse;
@@ -44,21 +45,27 @@
import com.google.longrunning.Operation;
import com.google.protobuf.Empty;
import com.google.spanner.admin.database.v1.Backup;
+import com.google.spanner.admin.database.v1.BackupSchedule;
import com.google.spanner.admin.database.v1.CopyBackupMetadata;
import com.google.spanner.admin.database.v1.CopyBackupRequest;
import com.google.spanner.admin.database.v1.CreateBackupMetadata;
import com.google.spanner.admin.database.v1.CreateBackupRequest;
+import com.google.spanner.admin.database.v1.CreateBackupScheduleRequest;
import com.google.spanner.admin.database.v1.CreateDatabaseMetadata;
import com.google.spanner.admin.database.v1.CreateDatabaseRequest;
import com.google.spanner.admin.database.v1.Database;
import com.google.spanner.admin.database.v1.DeleteBackupRequest;
+import com.google.spanner.admin.database.v1.DeleteBackupScheduleRequest;
import com.google.spanner.admin.database.v1.DropDatabaseRequest;
import com.google.spanner.admin.database.v1.GetBackupRequest;
+import com.google.spanner.admin.database.v1.GetBackupScheduleRequest;
import com.google.spanner.admin.database.v1.GetDatabaseDdlRequest;
import com.google.spanner.admin.database.v1.GetDatabaseDdlResponse;
import com.google.spanner.admin.database.v1.GetDatabaseRequest;
import com.google.spanner.admin.database.v1.ListBackupOperationsRequest;
import com.google.spanner.admin.database.v1.ListBackupOperationsResponse;
+import com.google.spanner.admin.database.v1.ListBackupSchedulesRequest;
+import com.google.spanner.admin.database.v1.ListBackupSchedulesResponse;
import com.google.spanner.admin.database.v1.ListBackupsRequest;
import com.google.spanner.admin.database.v1.ListBackupsResponse;
import com.google.spanner.admin.database.v1.ListDatabaseOperationsRequest;
@@ -70,6 +77,7 @@
import com.google.spanner.admin.database.v1.RestoreDatabaseMetadata;
import com.google.spanner.admin.database.v1.RestoreDatabaseRequest;
import com.google.spanner.admin.database.v1.UpdateBackupRequest;
+import com.google.spanner.admin.database.v1.UpdateBackupScheduleRequest;
import com.google.spanner.admin.database.v1.UpdateDatabaseDdlMetadata;
import com.google.spanner.admin.database.v1.UpdateDatabaseDdlRequest;
import com.google.spanner.admin.database.v1.UpdateDatabaseMetadata;
@@ -266,6 +274,35 @@ public UnaryCallSettings restoreDatabaseSetti
return ((DatabaseAdminStubSettings) getStubSettings()).listDatabaseRolesSettings();
}
+ /** Returns the object with the settings used for calls to createBackupSchedule. */
+ public UnaryCallSettings
+ createBackupScheduleSettings() {
+ return ((DatabaseAdminStubSettings) getStubSettings()).createBackupScheduleSettings();
+ }
+
+ /** Returns the object with the settings used for calls to getBackupSchedule. */
+ public UnaryCallSettings getBackupScheduleSettings() {
+ return ((DatabaseAdminStubSettings) getStubSettings()).getBackupScheduleSettings();
+ }
+
+ /** Returns the object with the settings used for calls to updateBackupSchedule. */
+ public UnaryCallSettings
+ updateBackupScheduleSettings() {
+ return ((DatabaseAdminStubSettings) getStubSettings()).updateBackupScheduleSettings();
+ }
+
+ /** Returns the object with the settings used for calls to deleteBackupSchedule. */
+ public UnaryCallSettings deleteBackupScheduleSettings() {
+ return ((DatabaseAdminStubSettings) getStubSettings()).deleteBackupScheduleSettings();
+ }
+
+ /** Returns the object with the settings used for calls to listBackupSchedules. */
+ public PagedCallSettings<
+ ListBackupSchedulesRequest, ListBackupSchedulesResponse, ListBackupSchedulesPagedResponse>
+ listBackupSchedulesSettings() {
+ return ((DatabaseAdminStubSettings) getStubSettings()).listBackupSchedulesSettings();
+ }
+
public static final DatabaseAdminSettings create(DatabaseAdminStubSettings stub)
throws IOException {
return new DatabaseAdminSettings.Builder(stub.toBuilder()).build();
@@ -531,6 +568,39 @@ public UnaryCallSettings.Builder restoreDatab
return getStubSettingsBuilder().listDatabaseRolesSettings();
}
+ /** Returns the builder for the settings used for calls to createBackupSchedule. */
+ public UnaryCallSettings.Builder
+ createBackupScheduleSettings() {
+ return getStubSettingsBuilder().createBackupScheduleSettings();
+ }
+
+ /** Returns the builder for the settings used for calls to getBackupSchedule. */
+ public UnaryCallSettings.Builder
+ getBackupScheduleSettings() {
+ return getStubSettingsBuilder().getBackupScheduleSettings();
+ }
+
+ /** Returns the builder for the settings used for calls to updateBackupSchedule. */
+ public UnaryCallSettings.Builder
+ updateBackupScheduleSettings() {
+ return getStubSettingsBuilder().updateBackupScheduleSettings();
+ }
+
+ /** Returns the builder for the settings used for calls to deleteBackupSchedule. */
+ public UnaryCallSettings.Builder
+ deleteBackupScheduleSettings() {
+ return getStubSettingsBuilder().deleteBackupScheduleSettings();
+ }
+
+ /** Returns the builder for the settings used for calls to listBackupSchedules. */
+ public PagedCallSettings.Builder<
+ ListBackupSchedulesRequest,
+ ListBackupSchedulesResponse,
+ ListBackupSchedulesPagedResponse>
+ listBackupSchedulesSettings() {
+ return getStubSettingsBuilder().listBackupSchedulesSettings();
+ }
+
@Override
public DatabaseAdminSettings build() throws IOException {
return new DatabaseAdminSettings(this);
diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/database/v1/gapic_metadata.json b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/database/v1/gapic_metadata.json
index 01fcbd4de1a..7d6c894d7b6 100644
--- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/database/v1/gapic_metadata.json
+++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/database/v1/gapic_metadata.json
@@ -16,18 +16,27 @@
"CreateBackup": {
"methods": ["createBackupAsync", "createBackupAsync", "createBackupAsync", "createBackupOperationCallable", "createBackupCallable"]
},
+ "CreateBackupSchedule": {
+ "methods": ["createBackupSchedule", "createBackupSchedule", "createBackupSchedule", "createBackupScheduleCallable"]
+ },
"CreateDatabase": {
"methods": ["createDatabaseAsync", "createDatabaseAsync", "createDatabaseAsync", "createDatabaseOperationCallable", "createDatabaseCallable"]
},
"DeleteBackup": {
"methods": ["deleteBackup", "deleteBackup", "deleteBackup", "deleteBackupCallable"]
},
+ "DeleteBackupSchedule": {
+ "methods": ["deleteBackupSchedule", "deleteBackupSchedule", "deleteBackupSchedule", "deleteBackupScheduleCallable"]
+ },
"DropDatabase": {
"methods": ["dropDatabase", "dropDatabase", "dropDatabase", "dropDatabaseCallable"]
},
"GetBackup": {
"methods": ["getBackup", "getBackup", "getBackup", "getBackupCallable"]
},
+ "GetBackupSchedule": {
+ "methods": ["getBackupSchedule", "getBackupSchedule", "getBackupSchedule", "getBackupScheduleCallable"]
+ },
"GetDatabase": {
"methods": ["getDatabase", "getDatabase", "getDatabase", "getDatabaseCallable"]
},
@@ -40,6 +49,9 @@
"ListBackupOperations": {
"methods": ["listBackupOperations", "listBackupOperations", "listBackupOperations", "listBackupOperationsPagedCallable", "listBackupOperationsCallable"]
},
+ "ListBackupSchedules": {
+ "methods": ["listBackupSchedules", "listBackupSchedules", "listBackupSchedules", "listBackupSchedulesPagedCallable", "listBackupSchedulesCallable"]
+ },
"ListBackups": {
"methods": ["listBackups", "listBackups", "listBackups", "listBackupsPagedCallable", "listBackupsCallable"]
},
@@ -64,6 +76,9 @@
"UpdateBackup": {
"methods": ["updateBackup", "updateBackup", "updateBackupCallable"]
},
+ "UpdateBackupSchedule": {
+ "methods": ["updateBackupSchedule", "updateBackupSchedule", "updateBackupScheduleCallable"]
+ },
"UpdateDatabase": {
"methods": ["updateDatabaseAsync", "updateDatabaseAsync", "updateDatabaseOperationCallable", "updateDatabaseCallable"]
},
diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/database/v1/stub/DatabaseAdminStub.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/database/v1/stub/DatabaseAdminStub.java
index 37fb433c3eb..2f53f6cf5b4 100644
--- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/database/v1/stub/DatabaseAdminStub.java
+++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/database/v1/stub/DatabaseAdminStub.java
@@ -17,6 +17,7 @@
package com.google.cloud.spanner.admin.database.v1.stub;
import static com.google.cloud.spanner.admin.database.v1.DatabaseAdminClient.ListBackupOperationsPagedResponse;
+import static com.google.cloud.spanner.admin.database.v1.DatabaseAdminClient.ListBackupSchedulesPagedResponse;
import static com.google.cloud.spanner.admin.database.v1.DatabaseAdminClient.ListBackupsPagedResponse;
import static com.google.cloud.spanner.admin.database.v1.DatabaseAdminClient.ListDatabaseOperationsPagedResponse;
import static com.google.cloud.spanner.admin.database.v1.DatabaseAdminClient.ListDatabaseRolesPagedResponse;
@@ -34,21 +35,27 @@
import com.google.longrunning.stub.OperationsStub;
import com.google.protobuf.Empty;
import com.google.spanner.admin.database.v1.Backup;
+import com.google.spanner.admin.database.v1.BackupSchedule;
import com.google.spanner.admin.database.v1.CopyBackupMetadata;
import com.google.spanner.admin.database.v1.CopyBackupRequest;
import com.google.spanner.admin.database.v1.CreateBackupMetadata;
import com.google.spanner.admin.database.v1.CreateBackupRequest;
+import com.google.spanner.admin.database.v1.CreateBackupScheduleRequest;
import com.google.spanner.admin.database.v1.CreateDatabaseMetadata;
import com.google.spanner.admin.database.v1.CreateDatabaseRequest;
import com.google.spanner.admin.database.v1.Database;
import com.google.spanner.admin.database.v1.DeleteBackupRequest;
+import com.google.spanner.admin.database.v1.DeleteBackupScheduleRequest;
import com.google.spanner.admin.database.v1.DropDatabaseRequest;
import com.google.spanner.admin.database.v1.GetBackupRequest;
+import com.google.spanner.admin.database.v1.GetBackupScheduleRequest;
import com.google.spanner.admin.database.v1.GetDatabaseDdlRequest;
import com.google.spanner.admin.database.v1.GetDatabaseDdlResponse;
import com.google.spanner.admin.database.v1.GetDatabaseRequest;
import com.google.spanner.admin.database.v1.ListBackupOperationsRequest;
import com.google.spanner.admin.database.v1.ListBackupOperationsResponse;
+import com.google.spanner.admin.database.v1.ListBackupSchedulesRequest;
+import com.google.spanner.admin.database.v1.ListBackupSchedulesResponse;
import com.google.spanner.admin.database.v1.ListBackupsRequest;
import com.google.spanner.admin.database.v1.ListBackupsResponse;
import com.google.spanner.admin.database.v1.ListDatabaseOperationsRequest;
@@ -60,6 +67,7 @@
import com.google.spanner.admin.database.v1.RestoreDatabaseMetadata;
import com.google.spanner.admin.database.v1.RestoreDatabaseRequest;
import com.google.spanner.admin.database.v1.UpdateBackupRequest;
+import com.google.spanner.admin.database.v1.UpdateBackupScheduleRequest;
import com.google.spanner.admin.database.v1.UpdateDatabaseDdlMetadata;
import com.google.spanner.admin.database.v1.UpdateDatabaseDdlRequest;
import com.google.spanner.admin.database.v1.UpdateDatabaseMetadata;
@@ -223,6 +231,32 @@ public UnaryCallable restoreDatabaseCallable(
throw new UnsupportedOperationException("Not implemented: listDatabaseRolesCallable()");
}
+ public UnaryCallable createBackupScheduleCallable() {
+ throw new UnsupportedOperationException("Not implemented: createBackupScheduleCallable()");
+ }
+
+ public UnaryCallable getBackupScheduleCallable() {
+ throw new UnsupportedOperationException("Not implemented: getBackupScheduleCallable()");
+ }
+
+ public UnaryCallable updateBackupScheduleCallable() {
+ throw new UnsupportedOperationException("Not implemented: updateBackupScheduleCallable()");
+ }
+
+ public UnaryCallable deleteBackupScheduleCallable() {
+ throw new UnsupportedOperationException("Not implemented: deleteBackupScheduleCallable()");
+ }
+
+ public UnaryCallable
+ listBackupSchedulesPagedCallable() {
+ throw new UnsupportedOperationException("Not implemented: listBackupSchedulesPagedCallable()");
+ }
+
+ public UnaryCallable
+ listBackupSchedulesCallable() {
+ throw new UnsupportedOperationException("Not implemented: listBackupSchedulesCallable()");
+ }
+
@Override
public abstract void close();
}
diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/database/v1/stub/DatabaseAdminStubSettings.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/database/v1/stub/DatabaseAdminStubSettings.java
index 4808f1553e9..7ee75687221 100644
--- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/database/v1/stub/DatabaseAdminStubSettings.java
+++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/database/v1/stub/DatabaseAdminStubSettings.java
@@ -17,6 +17,7 @@
package com.google.cloud.spanner.admin.database.v1.stub;
import static com.google.cloud.spanner.admin.database.v1.DatabaseAdminClient.ListBackupOperationsPagedResponse;
+import static com.google.cloud.spanner.admin.database.v1.DatabaseAdminClient.ListBackupSchedulesPagedResponse;
import static com.google.cloud.spanner.admin.database.v1.DatabaseAdminClient.ListBackupsPagedResponse;
import static com.google.cloud.spanner.admin.database.v1.DatabaseAdminClient.ListDatabaseOperationsPagedResponse;
import static com.google.cloud.spanner.admin.database.v1.DatabaseAdminClient.ListDatabaseRolesPagedResponse;
@@ -63,22 +64,28 @@
import com.google.longrunning.Operation;
import com.google.protobuf.Empty;
import com.google.spanner.admin.database.v1.Backup;
+import com.google.spanner.admin.database.v1.BackupSchedule;
import com.google.spanner.admin.database.v1.CopyBackupMetadata;
import com.google.spanner.admin.database.v1.CopyBackupRequest;
import com.google.spanner.admin.database.v1.CreateBackupMetadata;
import com.google.spanner.admin.database.v1.CreateBackupRequest;
+import com.google.spanner.admin.database.v1.CreateBackupScheduleRequest;
import com.google.spanner.admin.database.v1.CreateDatabaseMetadata;
import com.google.spanner.admin.database.v1.CreateDatabaseRequest;
import com.google.spanner.admin.database.v1.Database;
import com.google.spanner.admin.database.v1.DatabaseRole;
import com.google.spanner.admin.database.v1.DeleteBackupRequest;
+import com.google.spanner.admin.database.v1.DeleteBackupScheduleRequest;
import com.google.spanner.admin.database.v1.DropDatabaseRequest;
import com.google.spanner.admin.database.v1.GetBackupRequest;
+import com.google.spanner.admin.database.v1.GetBackupScheduleRequest;
import com.google.spanner.admin.database.v1.GetDatabaseDdlRequest;
import com.google.spanner.admin.database.v1.GetDatabaseDdlResponse;
import com.google.spanner.admin.database.v1.GetDatabaseRequest;
import com.google.spanner.admin.database.v1.ListBackupOperationsRequest;
import com.google.spanner.admin.database.v1.ListBackupOperationsResponse;
+import com.google.spanner.admin.database.v1.ListBackupSchedulesRequest;
+import com.google.spanner.admin.database.v1.ListBackupSchedulesResponse;
import com.google.spanner.admin.database.v1.ListBackupsRequest;
import com.google.spanner.admin.database.v1.ListBackupsResponse;
import com.google.spanner.admin.database.v1.ListDatabaseOperationsRequest;
@@ -90,6 +97,7 @@
import com.google.spanner.admin.database.v1.RestoreDatabaseMetadata;
import com.google.spanner.admin.database.v1.RestoreDatabaseRequest;
import com.google.spanner.admin.database.v1.UpdateBackupRequest;
+import com.google.spanner.admin.database.v1.UpdateBackupScheduleRequest;
import com.google.spanner.admin.database.v1.UpdateDatabaseDdlMetadata;
import com.google.spanner.admin.database.v1.UpdateDatabaseDdlRequest;
import com.google.spanner.admin.database.v1.UpdateDatabaseMetadata;
@@ -192,6 +200,16 @@ public class DatabaseAdminStubSettings extends StubSettings
listDatabaseRolesSettings;
+ private final UnaryCallSettings
+ createBackupScheduleSettings;
+ private final UnaryCallSettings
+ getBackupScheduleSettings;
+ private final UnaryCallSettings
+ updateBackupScheduleSettings;
+ private final UnaryCallSettings deleteBackupScheduleSettings;
+ private final PagedCallSettings<
+ ListBackupSchedulesRequest, ListBackupSchedulesResponse, ListBackupSchedulesPagedResponse>
+ listBackupSchedulesSettings;
private static final PagedListDescriptor
LIST_DATABASES_PAGE_STR_DESC =
@@ -387,6 +405,46 @@ public Iterable extractResources(ListDatabaseRolesResponse payload
}
};
+ private static final PagedListDescriptor<
+ ListBackupSchedulesRequest, ListBackupSchedulesResponse, BackupSchedule>
+ LIST_BACKUP_SCHEDULES_PAGE_STR_DESC =
+ new PagedListDescriptor<
+ ListBackupSchedulesRequest, ListBackupSchedulesResponse, BackupSchedule>() {
+ @Override
+ public String emptyToken() {
+ return "";
+ }
+
+ @Override
+ public ListBackupSchedulesRequest injectToken(
+ ListBackupSchedulesRequest payload, String token) {
+ return ListBackupSchedulesRequest.newBuilder(payload).setPageToken(token).build();
+ }
+
+ @Override
+ public ListBackupSchedulesRequest injectPageSize(
+ ListBackupSchedulesRequest payload, int pageSize) {
+ return ListBackupSchedulesRequest.newBuilder(payload).setPageSize(pageSize).build();
+ }
+
+ @Override
+ public Integer extractPageSize(ListBackupSchedulesRequest payload) {
+ return payload.getPageSize();
+ }
+
+ @Override
+ public String extractNextToken(ListBackupSchedulesResponse payload) {
+ return payload.getNextPageToken();
+ }
+
+ @Override
+ public Iterable extractResources(ListBackupSchedulesResponse payload) {
+ return payload.getBackupSchedulesList() == null
+ ? ImmutableList.of()
+ : payload.getBackupSchedulesList();
+ }
+ };
+
private static final PagedListResponseFactory<
ListDatabasesRequest, ListDatabasesResponse, ListDatabasesPagedResponse>
LIST_DATABASES_PAGE_STR_FACT =
@@ -489,6 +547,27 @@ public ApiFuture getFuturePagedResponse(
}
};
+ private static final PagedListResponseFactory<
+ ListBackupSchedulesRequest, ListBackupSchedulesResponse, ListBackupSchedulesPagedResponse>
+ LIST_BACKUP_SCHEDULES_PAGE_STR_FACT =
+ new PagedListResponseFactory<
+ ListBackupSchedulesRequest,
+ ListBackupSchedulesResponse,
+ ListBackupSchedulesPagedResponse>() {
+ @Override
+ public ApiFuture getFuturePagedResponse(
+ UnaryCallable callable,
+ ListBackupSchedulesRequest request,
+ ApiCallContext context,
+ ApiFuture futureResponse) {
+ PageContext
+ pageContext =
+ PageContext.create(
+ callable, LIST_BACKUP_SCHEDULES_PAGE_STR_DESC, request, context);
+ return ListBackupSchedulesPagedResponse.createAsync(pageContext, futureResponse);
+ }
+ };
+
/** Returns the object with the settings used for calls to listDatabases. */
public PagedCallSettings
listDatabasesSettings() {
@@ -638,6 +717,35 @@ public UnaryCallSettings restoreDatabaseSetti
return listDatabaseRolesSettings;
}
+ /** Returns the object with the settings used for calls to createBackupSchedule. */
+ public UnaryCallSettings
+ createBackupScheduleSettings() {
+ return createBackupScheduleSettings;
+ }
+
+ /** Returns the object with the settings used for calls to getBackupSchedule. */
+ public UnaryCallSettings getBackupScheduleSettings() {
+ return getBackupScheduleSettings;
+ }
+
+ /** Returns the object with the settings used for calls to updateBackupSchedule. */
+ public UnaryCallSettings
+ updateBackupScheduleSettings() {
+ return updateBackupScheduleSettings;
+ }
+
+ /** Returns the object with the settings used for calls to deleteBackupSchedule. */
+ public UnaryCallSettings deleteBackupScheduleSettings() {
+ return deleteBackupScheduleSettings;
+ }
+
+ /** Returns the object with the settings used for calls to listBackupSchedules. */
+ public PagedCallSettings<
+ ListBackupSchedulesRequest, ListBackupSchedulesResponse, ListBackupSchedulesPagedResponse>
+ listBackupSchedulesSettings() {
+ return listBackupSchedulesSettings;
+ }
+
public DatabaseAdminStub createStub() throws IOException {
if (getTransportChannelProvider()
.getTransportName()
@@ -775,6 +883,11 @@ protected DatabaseAdminStubSettings(Builder settingsBuilder) throws IOException
listDatabaseOperationsSettings = settingsBuilder.listDatabaseOperationsSettings().build();
listBackupOperationsSettings = settingsBuilder.listBackupOperationsSettings().build();
listDatabaseRolesSettings = settingsBuilder.listDatabaseRolesSettings().build();
+ createBackupScheduleSettings = settingsBuilder.createBackupScheduleSettings().build();
+ getBackupScheduleSettings = settingsBuilder.getBackupScheduleSettings().build();
+ updateBackupScheduleSettings = settingsBuilder.updateBackupScheduleSettings().build();
+ deleteBackupScheduleSettings = settingsBuilder.deleteBackupScheduleSettings().build();
+ listBackupSchedulesSettings = settingsBuilder.listBackupSchedulesSettings().build();
}
/** Builder for DatabaseAdminStubSettings. */
@@ -836,6 +949,19 @@ public static class Builder extends StubSettings.Builder
listDatabaseRolesSettings;
+ private final UnaryCallSettings.Builder
+ createBackupScheduleSettings;
+ private final UnaryCallSettings.Builder
+ getBackupScheduleSettings;
+ private final UnaryCallSettings.Builder
+ updateBackupScheduleSettings;
+ private final UnaryCallSettings.Builder
+ deleteBackupScheduleSettings;
+ private final PagedCallSettings.Builder<
+ ListBackupSchedulesRequest,
+ ListBackupSchedulesResponse,
+ ListBackupSchedulesPagedResponse>
+ listBackupSchedulesSettings;
private static final ImmutableMap>
RETRYABLE_CODE_DEFINITIONS;
@@ -940,6 +1066,12 @@ protected Builder(ClientContext clientContext) {
listBackupOperationsSettings =
PagedCallSettings.newBuilder(LIST_BACKUP_OPERATIONS_PAGE_STR_FACT);
listDatabaseRolesSettings = PagedCallSettings.newBuilder(LIST_DATABASE_ROLES_PAGE_STR_FACT);
+ createBackupScheduleSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
+ getBackupScheduleSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
+ updateBackupScheduleSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
+ deleteBackupScheduleSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
+ listBackupSchedulesSettings =
+ PagedCallSettings.newBuilder(LIST_BACKUP_SCHEDULES_PAGE_STR_FACT);
unaryMethodSettingsBuilders =
ImmutableList.>of(
@@ -962,7 +1094,12 @@ protected Builder(ClientContext clientContext) {
restoreDatabaseSettings,
listDatabaseOperationsSettings,
listBackupOperationsSettings,
- listDatabaseRolesSettings);
+ listDatabaseRolesSettings,
+ createBackupScheduleSettings,
+ getBackupScheduleSettings,
+ updateBackupScheduleSettings,
+ deleteBackupScheduleSettings,
+ listBackupSchedulesSettings);
initDefaults(this);
}
@@ -995,6 +1132,11 @@ protected Builder(DatabaseAdminStubSettings settings) {
listDatabaseOperationsSettings = settings.listDatabaseOperationsSettings.toBuilder();
listBackupOperationsSettings = settings.listBackupOperationsSettings.toBuilder();
listDatabaseRolesSettings = settings.listDatabaseRolesSettings.toBuilder();
+ createBackupScheduleSettings = settings.createBackupScheduleSettings.toBuilder();
+ getBackupScheduleSettings = settings.getBackupScheduleSettings.toBuilder();
+ updateBackupScheduleSettings = settings.updateBackupScheduleSettings.toBuilder();
+ deleteBackupScheduleSettings = settings.deleteBackupScheduleSettings.toBuilder();
+ listBackupSchedulesSettings = settings.listBackupSchedulesSettings.toBuilder();
unaryMethodSettingsBuilders =
ImmutableList.>of(
@@ -1017,7 +1159,12 @@ protected Builder(DatabaseAdminStubSettings settings) {
restoreDatabaseSettings,
listDatabaseOperationsSettings,
listBackupOperationsSettings,
- listDatabaseRolesSettings);
+ listDatabaseRolesSettings,
+ createBackupScheduleSettings,
+ getBackupScheduleSettings,
+ updateBackupScheduleSettings,
+ deleteBackupScheduleSettings,
+ listBackupSchedulesSettings);
}
private static Builder createDefault() {
@@ -1145,6 +1292,31 @@ private static Builder initDefaults(Builder builder) {
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params"));
+ builder
+ .createBackupScheduleSettings()
+ .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes"))
+ .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params"));
+
+ builder
+ .getBackupScheduleSettings()
+ .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes"))
+ .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params"));
+
+ builder
+ .updateBackupScheduleSettings()
+ .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes"))
+ .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params"));
+
+ builder
+ .deleteBackupScheduleSettings()
+ .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes"))
+ .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params"));
+
+ builder
+ .listBackupSchedulesSettings()
+ .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes"))
+ .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params"));
+
builder
.createDatabaseOperationSettings()
.setInitialCallSettings(
@@ -1460,6 +1632,39 @@ public UnaryCallSettings.Builder restoreDatab
return listDatabaseRolesSettings;
}
+ /** Returns the builder for the settings used for calls to createBackupSchedule. */
+ public UnaryCallSettings.Builder
+ createBackupScheduleSettings() {
+ return createBackupScheduleSettings;
+ }
+
+ /** Returns the builder for the settings used for calls to getBackupSchedule. */
+ public UnaryCallSettings.Builder
+ getBackupScheduleSettings() {
+ return getBackupScheduleSettings;
+ }
+
+ /** Returns the builder for the settings used for calls to updateBackupSchedule. */
+ public UnaryCallSettings.Builder
+ updateBackupScheduleSettings() {
+ return updateBackupScheduleSettings;
+ }
+
+ /** Returns the builder for the settings used for calls to deleteBackupSchedule. */
+ public UnaryCallSettings.Builder
+ deleteBackupScheduleSettings() {
+ return deleteBackupScheduleSettings;
+ }
+
+ /** Returns the builder for the settings used for calls to listBackupSchedules. */
+ public PagedCallSettings.Builder<
+ ListBackupSchedulesRequest,
+ ListBackupSchedulesResponse,
+ ListBackupSchedulesPagedResponse>
+ listBackupSchedulesSettings() {
+ return listBackupSchedulesSettings;
+ }
+
@Override
public DatabaseAdminStubSettings build() throws IOException {
return new DatabaseAdminStubSettings(this);
diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/database/v1/stub/GrpcDatabaseAdminStub.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/database/v1/stub/GrpcDatabaseAdminStub.java
index 875ff8443fc..8207ebcbce5 100644
--- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/database/v1/stub/GrpcDatabaseAdminStub.java
+++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/database/v1/stub/GrpcDatabaseAdminStub.java
@@ -17,6 +17,7 @@
package com.google.cloud.spanner.admin.database.v1.stub;
import static com.google.cloud.spanner.admin.database.v1.DatabaseAdminClient.ListBackupOperationsPagedResponse;
+import static com.google.cloud.spanner.admin.database.v1.DatabaseAdminClient.ListBackupSchedulesPagedResponse;
import static com.google.cloud.spanner.admin.database.v1.DatabaseAdminClient.ListBackupsPagedResponse;
import static com.google.cloud.spanner.admin.database.v1.DatabaseAdminClient.ListDatabaseOperationsPagedResponse;
import static com.google.cloud.spanner.admin.database.v1.DatabaseAdminClient.ListDatabaseRolesPagedResponse;
@@ -39,21 +40,27 @@
import com.google.longrunning.stub.GrpcOperationsStub;
import com.google.protobuf.Empty;
import com.google.spanner.admin.database.v1.Backup;
+import com.google.spanner.admin.database.v1.BackupSchedule;
import com.google.spanner.admin.database.v1.CopyBackupMetadata;
import com.google.spanner.admin.database.v1.CopyBackupRequest;
import com.google.spanner.admin.database.v1.CreateBackupMetadata;
import com.google.spanner.admin.database.v1.CreateBackupRequest;
+import com.google.spanner.admin.database.v1.CreateBackupScheduleRequest;
import com.google.spanner.admin.database.v1.CreateDatabaseMetadata;
import com.google.spanner.admin.database.v1.CreateDatabaseRequest;
import com.google.spanner.admin.database.v1.Database;
import com.google.spanner.admin.database.v1.DeleteBackupRequest;
+import com.google.spanner.admin.database.v1.DeleteBackupScheduleRequest;
import com.google.spanner.admin.database.v1.DropDatabaseRequest;
import com.google.spanner.admin.database.v1.GetBackupRequest;
+import com.google.spanner.admin.database.v1.GetBackupScheduleRequest;
import com.google.spanner.admin.database.v1.GetDatabaseDdlRequest;
import com.google.spanner.admin.database.v1.GetDatabaseDdlResponse;
import com.google.spanner.admin.database.v1.GetDatabaseRequest;
import com.google.spanner.admin.database.v1.ListBackupOperationsRequest;
import com.google.spanner.admin.database.v1.ListBackupOperationsResponse;
+import com.google.spanner.admin.database.v1.ListBackupSchedulesRequest;
+import com.google.spanner.admin.database.v1.ListBackupSchedulesResponse;
import com.google.spanner.admin.database.v1.ListBackupsRequest;
import com.google.spanner.admin.database.v1.ListBackupsResponse;
import com.google.spanner.admin.database.v1.ListDatabaseOperationsRequest;
@@ -65,6 +72,7 @@
import com.google.spanner.admin.database.v1.RestoreDatabaseMetadata;
import com.google.spanner.admin.database.v1.RestoreDatabaseRequest;
import com.google.spanner.admin.database.v1.UpdateBackupRequest;
+import com.google.spanner.admin.database.v1.UpdateBackupScheduleRequest;
import com.google.spanner.admin.database.v1.UpdateDatabaseDdlMetadata;
import com.google.spanner.admin.database.v1.UpdateDatabaseDdlRequest;
import com.google.spanner.admin.database.v1.UpdateDatabaseMetadata;
@@ -277,6 +285,61 @@ public class GrpcDatabaseAdminStub extends DatabaseAdminStub {
ProtoUtils.marshaller(ListDatabaseRolesResponse.getDefaultInstance()))
.build();
+ private static final MethodDescriptor
+ createBackupScheduleMethodDescriptor =
+ MethodDescriptor.newBuilder()
+ .setType(MethodDescriptor.MethodType.UNARY)
+ .setFullMethodName(
+ "google.spanner.admin.database.v1.DatabaseAdmin/CreateBackupSchedule")
+ .setRequestMarshaller(
+ ProtoUtils.marshaller(CreateBackupScheduleRequest.getDefaultInstance()))
+ .setResponseMarshaller(ProtoUtils.marshaller(BackupSchedule.getDefaultInstance()))
+ .build();
+
+ private static final MethodDescriptor
+ getBackupScheduleMethodDescriptor =
+ MethodDescriptor.newBuilder()
+ .setType(MethodDescriptor.MethodType.UNARY)
+ .setFullMethodName("google.spanner.admin.database.v1.DatabaseAdmin/GetBackupSchedule")
+ .setRequestMarshaller(
+ ProtoUtils.marshaller(GetBackupScheduleRequest.getDefaultInstance()))
+ .setResponseMarshaller(ProtoUtils.marshaller(BackupSchedule.getDefaultInstance()))
+ .build();
+
+ private static final MethodDescriptor
+ updateBackupScheduleMethodDescriptor =
+ MethodDescriptor.newBuilder()
+ .setType(MethodDescriptor.MethodType.UNARY)
+ .setFullMethodName(
+ "google.spanner.admin.database.v1.DatabaseAdmin/UpdateBackupSchedule")
+ .setRequestMarshaller(
+ ProtoUtils.marshaller(UpdateBackupScheduleRequest.getDefaultInstance()))
+ .setResponseMarshaller(ProtoUtils.marshaller(BackupSchedule.getDefaultInstance()))
+ .build();
+
+ private static final MethodDescriptor
+ deleteBackupScheduleMethodDescriptor =
+ MethodDescriptor.newBuilder()
+ .setType(MethodDescriptor.MethodType.UNARY)
+ .setFullMethodName(
+ "google.spanner.admin.database.v1.DatabaseAdmin/DeleteBackupSchedule")
+ .setRequestMarshaller(
+ ProtoUtils.marshaller(DeleteBackupScheduleRequest.getDefaultInstance()))
+ .setResponseMarshaller(ProtoUtils.marshaller(Empty.getDefaultInstance()))
+ .build();
+
+ private static final MethodDescriptor
+ listBackupSchedulesMethodDescriptor =
+ MethodDescriptor.newBuilder()
+ .setType(MethodDescriptor.MethodType.UNARY)
+ .setFullMethodName(
+ "google.spanner.admin.database.v1.DatabaseAdmin/ListBackupSchedules")
+ .setRequestMarshaller(
+ ProtoUtils.marshaller(ListBackupSchedulesRequest.getDefaultInstance()))
+ .setResponseMarshaller(
+ ProtoUtils.marshaller(ListBackupSchedulesResponse.getDefaultInstance()))
+ .build();
+
private final UnaryCallable listDatabasesCallable;
private final UnaryCallable
listDatabasesPagedCallable;
@@ -323,6 +386,16 @@ public class GrpcDatabaseAdminStub extends DatabaseAdminStub {
listDatabaseRolesCallable;
private final UnaryCallable
listDatabaseRolesPagedCallable;
+ private final UnaryCallable
+ createBackupScheduleCallable;
+ private final UnaryCallable getBackupScheduleCallable;
+ private final UnaryCallable
+ updateBackupScheduleCallable;
+ private final UnaryCallable deleteBackupScheduleCallable;
+ private final UnaryCallable
+ listBackupSchedulesCallable;
+ private final UnaryCallable
+ listBackupSchedulesPagedCallable;
private final BackgroundResource backgroundResources;
private final GrpcOperationsStub operationsStub;
@@ -572,6 +645,61 @@ protected GrpcDatabaseAdminStub(
return builder.build();
})
.build();
+ GrpcCallSettings
+ createBackupScheduleTransportSettings =
+ GrpcCallSettings.newBuilder()
+ .setMethodDescriptor(createBackupScheduleMethodDescriptor)
+ .setParamsExtractor(
+ request -> {
+ RequestParamsBuilder builder = RequestParamsBuilder.create();
+ builder.add("parent", String.valueOf(request.getParent()));
+ return builder.build();
+ })
+ .build();
+ GrpcCallSettings getBackupScheduleTransportSettings =
+ GrpcCallSettings.newBuilder()
+ .setMethodDescriptor(getBackupScheduleMethodDescriptor)
+ .setParamsExtractor(
+ request -> {
+ RequestParamsBuilder builder = RequestParamsBuilder.create();
+ builder.add("name", String.valueOf(request.getName()));
+ return builder.build();
+ })
+ .build();
+ GrpcCallSettings
+ updateBackupScheduleTransportSettings =
+ GrpcCallSettings.newBuilder()
+ .setMethodDescriptor(updateBackupScheduleMethodDescriptor)
+ .setParamsExtractor(
+ request -> {
+ RequestParamsBuilder builder = RequestParamsBuilder.create();
+ builder.add(
+ "backup_schedule.name",
+ String.valueOf(request.getBackupSchedule().getName()));
+ return builder.build();
+ })
+ .build();
+ GrpcCallSettings deleteBackupScheduleTransportSettings =
+ GrpcCallSettings.newBuilder()
+ .setMethodDescriptor(deleteBackupScheduleMethodDescriptor)
+ .setParamsExtractor(
+ request -> {
+ RequestParamsBuilder builder = RequestParamsBuilder.create();
+ builder.add("name", String.valueOf(request.getName()));
+ return builder.build();
+ })
+ .build();
+ GrpcCallSettings
+ listBackupSchedulesTransportSettings =
+ GrpcCallSettings.newBuilder()
+ .setMethodDescriptor(listBackupSchedulesMethodDescriptor)
+ .setParamsExtractor(
+ request -> {
+ RequestParamsBuilder builder = RequestParamsBuilder.create();
+ builder.add("parent", String.valueOf(request.getParent()));
+ return builder.build();
+ })
+ .build();
this.listDatabasesCallable =
callableFactory.createUnaryCallable(
@@ -700,6 +828,36 @@ protected GrpcDatabaseAdminStub(
listDatabaseRolesTransportSettings,
settings.listDatabaseRolesSettings(),
clientContext);
+ this.createBackupScheduleCallable =
+ callableFactory.createUnaryCallable(
+ createBackupScheduleTransportSettings,
+ settings.createBackupScheduleSettings(),
+ clientContext);
+ this.getBackupScheduleCallable =
+ callableFactory.createUnaryCallable(
+ getBackupScheduleTransportSettings,
+ settings.getBackupScheduleSettings(),
+ clientContext);
+ this.updateBackupScheduleCallable =
+ callableFactory.createUnaryCallable(
+ updateBackupScheduleTransportSettings,
+ settings.updateBackupScheduleSettings(),
+ clientContext);
+ this.deleteBackupScheduleCallable =
+ callableFactory.createUnaryCallable(
+ deleteBackupScheduleTransportSettings,
+ settings.deleteBackupScheduleSettings(),
+ clientContext);
+ this.listBackupSchedulesCallable =
+ callableFactory.createUnaryCallable(
+ listBackupSchedulesTransportSettings,
+ settings.listBackupSchedulesSettings(),
+ clientContext);
+ this.listBackupSchedulesPagedCallable =
+ callableFactory.createPagedCallable(
+ listBackupSchedulesTransportSettings,
+ settings.listBackupSchedulesSettings(),
+ clientContext);
this.backgroundResources =
new BackgroundResourceAggregation(clientContext.getBackgroundResources());
@@ -878,6 +1036,38 @@ public UnaryCallable restoreDatabaseCallable(
return listDatabaseRolesPagedCallable;
}
+ @Override
+ public UnaryCallable createBackupScheduleCallable() {
+ return createBackupScheduleCallable;
+ }
+
+ @Override
+ public UnaryCallable getBackupScheduleCallable() {
+ return getBackupScheduleCallable;
+ }
+
+ @Override
+ public UnaryCallable updateBackupScheduleCallable() {
+ return updateBackupScheduleCallable;
+ }
+
+ @Override
+ public UnaryCallable deleteBackupScheduleCallable() {
+ return deleteBackupScheduleCallable;
+ }
+
+ @Override
+ public UnaryCallable
+ listBackupSchedulesCallable() {
+ return listBackupSchedulesCallable;
+ }
+
+ @Override
+ public UnaryCallable
+ listBackupSchedulesPagedCallable() {
+ return listBackupSchedulesPagedCallable;
+ }
+
@Override
public final void close() {
try {
diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/database/v1/stub/HttpJsonDatabaseAdminStub.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/database/v1/stub/HttpJsonDatabaseAdminStub.java
index 1eaa5055133..fbe9f02b1f8 100644
--- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/database/v1/stub/HttpJsonDatabaseAdminStub.java
+++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/database/v1/stub/HttpJsonDatabaseAdminStub.java
@@ -17,6 +17,7 @@
package com.google.cloud.spanner.admin.database.v1.stub;
import static com.google.cloud.spanner.admin.database.v1.DatabaseAdminClient.ListBackupOperationsPagedResponse;
+import static com.google.cloud.spanner.admin.database.v1.DatabaseAdminClient.ListBackupSchedulesPagedResponse;
import static com.google.cloud.spanner.admin.database.v1.DatabaseAdminClient.ListBackupsPagedResponse;
import static com.google.cloud.spanner.admin.database.v1.DatabaseAdminClient.ListDatabaseOperationsPagedResponse;
import static com.google.cloud.spanner.admin.database.v1.DatabaseAdminClient.ListDatabaseRolesPagedResponse;
@@ -48,21 +49,27 @@
import com.google.protobuf.Empty;
import com.google.protobuf.TypeRegistry;
import com.google.spanner.admin.database.v1.Backup;
+import com.google.spanner.admin.database.v1.BackupSchedule;
import com.google.spanner.admin.database.v1.CopyBackupMetadata;
import com.google.spanner.admin.database.v1.CopyBackupRequest;
import com.google.spanner.admin.database.v1.CreateBackupMetadata;
import com.google.spanner.admin.database.v1.CreateBackupRequest;
+import com.google.spanner.admin.database.v1.CreateBackupScheduleRequest;
import com.google.spanner.admin.database.v1.CreateDatabaseMetadata;
import com.google.spanner.admin.database.v1.CreateDatabaseRequest;
import com.google.spanner.admin.database.v1.Database;
import com.google.spanner.admin.database.v1.DeleteBackupRequest;
+import com.google.spanner.admin.database.v1.DeleteBackupScheduleRequest;
import com.google.spanner.admin.database.v1.DropDatabaseRequest;
import com.google.spanner.admin.database.v1.GetBackupRequest;
+import com.google.spanner.admin.database.v1.GetBackupScheduleRequest;
import com.google.spanner.admin.database.v1.GetDatabaseDdlRequest;
import com.google.spanner.admin.database.v1.GetDatabaseDdlResponse;
import com.google.spanner.admin.database.v1.GetDatabaseRequest;
import com.google.spanner.admin.database.v1.ListBackupOperationsRequest;
import com.google.spanner.admin.database.v1.ListBackupOperationsResponse;
+import com.google.spanner.admin.database.v1.ListBackupSchedulesRequest;
+import com.google.spanner.admin.database.v1.ListBackupSchedulesResponse;
import com.google.spanner.admin.database.v1.ListBackupsRequest;
import com.google.spanner.admin.database.v1.ListBackupsResponse;
import com.google.spanner.admin.database.v1.ListDatabaseOperationsRequest;
@@ -74,6 +81,7 @@
import com.google.spanner.admin.database.v1.RestoreDatabaseMetadata;
import com.google.spanner.admin.database.v1.RestoreDatabaseRequest;
import com.google.spanner.admin.database.v1.UpdateBackupRequest;
+import com.google.spanner.admin.database.v1.UpdateBackupScheduleRequest;
import com.google.spanner.admin.database.v1.UpdateDatabaseDdlMetadata;
import com.google.spanner.admin.database.v1.UpdateDatabaseDdlRequest;
import com.google.spanner.admin.database.v1.UpdateDatabaseMetadata;
@@ -385,7 +393,8 @@ public class HttpJsonDatabaseAdminStub extends DatabaseAdminStub {
return fields;
})
.setAdditionalPaths(
- "/v1/{resource=projects/*/instances/*/backups/*}:setIamPolicy")
+ "/v1/{resource=projects/*/instances/*/backups/*}:setIamPolicy",
+ "/v1/{resource=projects/*/instances/*/databases/*/backupSchedules/*}:setIamPolicy")
.setQueryParamsExtractor(
request -> {
Map> fields = new HashMap<>();
@@ -424,7 +433,8 @@ public class HttpJsonDatabaseAdminStub extends DatabaseAdminStub {
return fields;
})
.setAdditionalPaths(
- "/v1/{resource=projects/*/instances/*/backups/*}:getIamPolicy")
+ "/v1/{resource=projects/*/instances/*/backups/*}:getIamPolicy",
+ "/v1/{resource=projects/*/instances/*/databases/*/backupSchedules/*}:getIamPolicy")
.setQueryParamsExtractor(
request -> {
Map> fields = new HashMap<>();
@@ -465,6 +475,7 @@ public class HttpJsonDatabaseAdminStub extends DatabaseAdminStub {
})
.setAdditionalPaths(
"/v1/{resource=projects/*/instances/*/backups/*}:testIamPermissions",
+ "/v1/{resource=projects/*/instances/*/databases/*/backupSchedules/*}:testIamPermissions",
"/v1/{resource=projects/*/instances/*/databases/*/databaseRoles/*}:testIamPermissions")
.setQueryParamsExtractor(
request -> {
@@ -868,6 +879,194 @@ public class HttpJsonDatabaseAdminStub extends DatabaseAdminStub {
.build())
.build();
+ private static final ApiMethodDescriptor
+ createBackupScheduleMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName(
+ "google.spanner.admin.database.v1.DatabaseAdmin/CreateBackupSchedule")
+ .setHttpMethod("POST")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1/{parent=projects/*/instances/*/databases/*}/backupSchedules",
+ request -> {
+ Map fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putPathParam(fields, "parent", request.getParent());
+ return fields;
+ })
+ .setQueryParamsExtractor(
+ request -> {
+ Map> fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putQueryParam(
+ fields, "backupScheduleId", request.getBackupScheduleId());
+ serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int");
+ return fields;
+ })
+ .setRequestBodyExtractor(
+ request ->
+ ProtoRestSerializer.create()
+ .toBody("backupSchedule", request.getBackupSchedule(), true))
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(BackupSchedule.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .build();
+
+ private static final ApiMethodDescriptor
+ getBackupScheduleMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName("google.spanner.admin.database.v1.DatabaseAdmin/GetBackupSchedule")
+ .setHttpMethod("GET")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1/{name=projects/*/instances/*/databases/*/backupSchedules/*}",
+ request -> {
+ Map fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putPathParam(fields, "name", request.getName());
+ return fields;
+ })
+ .setQueryParamsExtractor(
+ request -> {
+ Map> fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int");
+ return fields;
+ })
+ .setRequestBodyExtractor(request -> null)
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(BackupSchedule.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .build();
+
+ private static final ApiMethodDescriptor
+ updateBackupScheduleMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName(
+ "google.spanner.admin.database.v1.DatabaseAdmin/UpdateBackupSchedule")
+ .setHttpMethod("PATCH")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1/{backupSchedule.name=projects/*/instances/*/databases/*/backupSchedules/*}",
+ request -> {
+ Map fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putPathParam(
+ fields,
+ "backupSchedule.name",
+ request.getBackupSchedule().getName());
+ return fields;
+ })
+ .setQueryParamsExtractor(
+ request -> {
+ Map> fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putQueryParam(fields, "updateMask", request.getUpdateMask());
+ serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int");
+ return fields;
+ })
+ .setRequestBodyExtractor(
+ request ->
+ ProtoRestSerializer.create()
+ .toBody("backupSchedule", request.getBackupSchedule(), true))
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(BackupSchedule.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .build();
+
+ private static final ApiMethodDescriptor
+ deleteBackupScheduleMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName(
+ "google.spanner.admin.database.v1.DatabaseAdmin/DeleteBackupSchedule")
+ .setHttpMethod("DELETE")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1/{name=projects/*/instances/*/databases/*/backupSchedules/*}",
+ request -> {
+ Map fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putPathParam(fields, "name", request.getName());
+ return fields;
+ })
+ .setQueryParamsExtractor(
+ request -> {
+ Map> fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int");
+ return fields;
+ })
+ .setRequestBodyExtractor(request -> null)
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(Empty.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .build();
+
+ private static final ApiMethodDescriptor
+ listBackupSchedulesMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName(
+ "google.spanner.admin.database.v1.DatabaseAdmin/ListBackupSchedules")
+ .setHttpMethod("GET")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1/{parent=projects/*/instances/*/databases/*}/backupSchedules",
+ request -> {
+ Map fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putPathParam(fields, "parent", request.getParent());
+ return fields;
+ })
+ .setQueryParamsExtractor(
+ request -> {
+ Map> fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putQueryParam(fields, "pageSize", request.getPageSize());
+ serializer.putQueryParam(fields, "pageToken", request.getPageToken());
+ serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int");
+ return fields;
+ })
+ .setRequestBodyExtractor(request -> null)
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(ListBackupSchedulesResponse.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .build();
+
private final UnaryCallable listDatabasesCallable;
private final UnaryCallable
listDatabasesPagedCallable;
@@ -914,6 +1113,16 @@ public class HttpJsonDatabaseAdminStub extends DatabaseAdminStub {
listDatabaseRolesCallable;
private final UnaryCallable
listDatabaseRolesPagedCallable;
+ private final UnaryCallable
+ createBackupScheduleCallable;
+ private final UnaryCallable getBackupScheduleCallable;
+ private final UnaryCallable
+ updateBackupScheduleCallable;
+ private final UnaryCallable deleteBackupScheduleCallable;
+ private final UnaryCallable
+ listBackupSchedulesCallable;
+ private final UnaryCallable
+ listBackupSchedulesPagedCallable;
private final BackgroundResource backgroundResources;
private final HttpJsonOperationsStub httpJsonOperationsStub;
@@ -1265,6 +1474,68 @@ protected HttpJsonDatabaseAdminStub(
return builder.build();
})
.build();
+ HttpJsonCallSettings
+ createBackupScheduleTransportSettings =
+ HttpJsonCallSettings.newBuilder()
+ .setMethodDescriptor(createBackupScheduleMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .setParamsExtractor(
+ request -> {
+ RequestParamsBuilder builder = RequestParamsBuilder.create();
+ builder.add("parent", String.valueOf(request.getParent()));
+ return builder.build();
+ })
+ .build();
+ HttpJsonCallSettings
+ getBackupScheduleTransportSettings =
+ HttpJsonCallSettings.newBuilder()
+ .setMethodDescriptor(getBackupScheduleMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .setParamsExtractor(
+ request -> {
+ RequestParamsBuilder builder = RequestParamsBuilder.create();
+ builder.add("name", String.valueOf(request.getName()));
+ return builder.build();
+ })
+ .build();
+ HttpJsonCallSettings
+ updateBackupScheduleTransportSettings =
+ HttpJsonCallSettings.newBuilder()
+ .setMethodDescriptor(updateBackupScheduleMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .setParamsExtractor(
+ request -> {
+ RequestParamsBuilder builder = RequestParamsBuilder.create();
+ builder.add(
+ "backup_schedule.name",
+ String.valueOf(request.getBackupSchedule().getName()));
+ return builder.build();
+ })
+ .build();
+ HttpJsonCallSettings deleteBackupScheduleTransportSettings =
+ HttpJsonCallSettings.newBuilder()
+ .setMethodDescriptor(deleteBackupScheduleMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .setParamsExtractor(
+ request -> {
+ RequestParamsBuilder builder = RequestParamsBuilder.create();
+ builder.add("name", String.valueOf(request.getName()));
+ return builder.build();
+ })
+ .build();
+ HttpJsonCallSettings
+ listBackupSchedulesTransportSettings =
+ HttpJsonCallSettings
+ .newBuilder()
+ .setMethodDescriptor(listBackupSchedulesMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .setParamsExtractor(
+ request -> {
+ RequestParamsBuilder builder = RequestParamsBuilder.create();
+ builder.add("parent", String.valueOf(request.getParent()));
+ return builder.build();
+ })
+ .build();
this.listDatabasesCallable =
callableFactory.createUnaryCallable(
@@ -1393,6 +1664,36 @@ protected HttpJsonDatabaseAdminStub(
listDatabaseRolesTransportSettings,
settings.listDatabaseRolesSettings(),
clientContext);
+ this.createBackupScheduleCallable =
+ callableFactory.createUnaryCallable(
+ createBackupScheduleTransportSettings,
+ settings.createBackupScheduleSettings(),
+ clientContext);
+ this.getBackupScheduleCallable =
+ callableFactory.createUnaryCallable(
+ getBackupScheduleTransportSettings,
+ settings.getBackupScheduleSettings(),
+ clientContext);
+ this.updateBackupScheduleCallable =
+ callableFactory.createUnaryCallable(
+ updateBackupScheduleTransportSettings,
+ settings.updateBackupScheduleSettings(),
+ clientContext);
+ this.deleteBackupScheduleCallable =
+ callableFactory.createUnaryCallable(
+ deleteBackupScheduleTransportSettings,
+ settings.deleteBackupScheduleSettings(),
+ clientContext);
+ this.listBackupSchedulesCallable =
+ callableFactory.createUnaryCallable(
+ listBackupSchedulesTransportSettings,
+ settings.listBackupSchedulesSettings(),
+ clientContext);
+ this.listBackupSchedulesPagedCallable =
+ callableFactory.createPagedCallable(
+ listBackupSchedulesTransportSettings,
+ settings.listBackupSchedulesSettings(),
+ clientContext);
this.backgroundResources =
new BackgroundResourceAggregation(clientContext.getBackgroundResources());
@@ -1421,6 +1722,11 @@ public static List getMethodDescriptors() {
methodDescriptors.add(listDatabaseOperationsMethodDescriptor);
methodDescriptors.add(listBackupOperationsMethodDescriptor);
methodDescriptors.add(listDatabaseRolesMethodDescriptor);
+ methodDescriptors.add(createBackupScheduleMethodDescriptor);
+ methodDescriptors.add(getBackupScheduleMethodDescriptor);
+ methodDescriptors.add(updateBackupScheduleMethodDescriptor);
+ methodDescriptors.add(deleteBackupScheduleMethodDescriptor);
+ methodDescriptors.add(listBackupSchedulesMethodDescriptor);
return methodDescriptors;
}
@@ -1597,6 +1903,38 @@ public UnaryCallable restoreDatabaseCallable(
return listDatabaseRolesPagedCallable;
}
+ @Override
+ public UnaryCallable createBackupScheduleCallable() {
+ return createBackupScheduleCallable;
+ }
+
+ @Override
+ public UnaryCallable getBackupScheduleCallable() {
+ return getBackupScheduleCallable;
+ }
+
+ @Override
+ public UnaryCallable updateBackupScheduleCallable() {
+ return updateBackupScheduleCallable;
+ }
+
+ @Override
+ public UnaryCallable deleteBackupScheduleCallable() {
+ return deleteBackupScheduleCallable;
+ }
+
+ @Override
+ public UnaryCallable
+ listBackupSchedulesCallable() {
+ return listBackupSchedulesCallable;
+ }
+
+ @Override
+ public UnaryCallable
+ listBackupSchedulesPagedCallable() {
+ return listBackupSchedulesPagedCallable;
+ }
+
@Override
public final void close() {
try {
diff --git a/google-cloud-spanner/src/main/resources/META-INF/native-image/com.google.cloud.spanner.admin.database.v1/reflect-config.json b/google-cloud-spanner/src/main/resources/META-INF/native-image/com.google.cloud.spanner.admin.database.v1/reflect-config.json
index 9518d8b2191..51848a41299 100644
--- a/google-cloud-spanner/src/main/resources/META-INF/native-image/com.google.cloud.spanner.admin.database.v1/reflect-config.json
+++ b/google-cloud-spanner/src/main/resources/META-INF/native-image/com.google.cloud.spanner.admin.database.v1/reflect-config.json
@@ -1646,6 +1646,42 @@
"allDeclaredClasses": true,
"allPublicClasses": true
},
+ {
+ "name": "com.google.spanner.admin.database.v1.BackupSchedule",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
+ {
+ "name": "com.google.spanner.admin.database.v1.BackupSchedule$Builder",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
+ {
+ "name": "com.google.spanner.admin.database.v1.BackupScheduleSpec",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
+ {
+ "name": "com.google.spanner.admin.database.v1.BackupScheduleSpec$Builder",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
{
"name": "com.google.spanner.admin.database.v1.CopyBackupEncryptionConfig",
"queryAllDeclaredConstructors": true,
@@ -1772,6 +1808,24 @@
"allDeclaredClasses": true,
"allPublicClasses": true
},
+ {
+ "name": "com.google.spanner.admin.database.v1.CreateBackupScheduleRequest",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
+ {
+ "name": "com.google.spanner.admin.database.v1.CreateBackupScheduleRequest$Builder",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
{
"name": "com.google.spanner.admin.database.v1.CreateDatabaseMetadata",
"queryAllDeclaredConstructors": true,
@@ -1808,6 +1862,24 @@
"allDeclaredClasses": true,
"allPublicClasses": true
},
+ {
+ "name": "com.google.spanner.admin.database.v1.CrontabSpec",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
+ {
+ "name": "com.google.spanner.admin.database.v1.CrontabSpec$Builder",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
{
"name": "com.google.spanner.admin.database.v1.Database",
"queryAllDeclaredConstructors": true,
@@ -1898,6 +1970,24 @@
"allDeclaredClasses": true,
"allPublicClasses": true
},
+ {
+ "name": "com.google.spanner.admin.database.v1.DeleteBackupScheduleRequest",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
+ {
+ "name": "com.google.spanner.admin.database.v1.DeleteBackupScheduleRequest$Builder",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
{
"name": "com.google.spanner.admin.database.v1.DropDatabaseRequest",
"queryAllDeclaredConstructors": true,
@@ -1961,6 +2051,24 @@
"allDeclaredClasses": true,
"allPublicClasses": true
},
+ {
+ "name": "com.google.spanner.admin.database.v1.FullBackupSpec",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
+ {
+ "name": "com.google.spanner.admin.database.v1.FullBackupSpec$Builder",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
{
"name": "com.google.spanner.admin.database.v1.GetBackupRequest",
"queryAllDeclaredConstructors": true,
@@ -1979,6 +2087,24 @@
"allDeclaredClasses": true,
"allPublicClasses": true
},
+ {
+ "name": "com.google.spanner.admin.database.v1.GetBackupScheduleRequest",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
+ {
+ "name": "com.google.spanner.admin.database.v1.GetBackupScheduleRequest$Builder",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
{
"name": "com.google.spanner.admin.database.v1.GetDatabaseDdlRequest",
"queryAllDeclaredConstructors": true,
@@ -2069,6 +2195,42 @@
"allDeclaredClasses": true,
"allPublicClasses": true
},
+ {
+ "name": "com.google.spanner.admin.database.v1.ListBackupSchedulesRequest",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
+ {
+ "name": "com.google.spanner.admin.database.v1.ListBackupSchedulesRequest$Builder",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
+ {
+ "name": "com.google.spanner.admin.database.v1.ListBackupSchedulesResponse",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
+ {
+ "name": "com.google.spanner.admin.database.v1.ListBackupSchedulesResponse$Builder",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
{
"name": "com.google.spanner.admin.database.v1.ListBackupsRequest",
"queryAllDeclaredConstructors": true,
@@ -2357,6 +2519,24 @@
"allDeclaredClasses": true,
"allPublicClasses": true
},
+ {
+ "name": "com.google.spanner.admin.database.v1.UpdateBackupScheduleRequest",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
+ {
+ "name": "com.google.spanner.admin.database.v1.UpdateBackupScheduleRequest$Builder",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
{
"name": "com.google.spanner.admin.database.v1.UpdateDatabaseDdlMetadata",
"queryAllDeclaredConstructors": true,
diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/admin/database/v1/DatabaseAdminClientHttpJsonTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/admin/database/v1/DatabaseAdminClientHttpJsonTest.java
index 368868a2dce..5e0d53da4ce 100644
--- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/admin/database/v1/DatabaseAdminClientHttpJsonTest.java
+++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/admin/database/v1/DatabaseAdminClientHttpJsonTest.java
@@ -17,6 +17,7 @@
package com.google.cloud.spanner.admin.database.v1;
import static com.google.cloud.spanner.admin.database.v1.DatabaseAdminClient.ListBackupOperationsPagedResponse;
+import static com.google.cloud.spanner.admin.database.v1.DatabaseAdminClient.ListBackupSchedulesPagedResponse;
import static com.google.cloud.spanner.admin.database.v1.DatabaseAdminClient.ListBackupsPagedResponse;
import static com.google.cloud.spanner.admin.database.v1.DatabaseAdminClient.ListDatabaseOperationsPagedResponse;
import static com.google.cloud.spanner.admin.database.v1.DatabaseAdminClient.ListDatabaseRolesPagedResponse;
@@ -41,11 +42,16 @@
import com.google.longrunning.Operation;
import com.google.protobuf.Any;
import com.google.protobuf.ByteString;
+import com.google.protobuf.Duration;
import com.google.protobuf.Empty;
import com.google.protobuf.FieldMask;
import com.google.protobuf.Timestamp;
import com.google.spanner.admin.database.v1.Backup;
import com.google.spanner.admin.database.v1.BackupName;
+import com.google.spanner.admin.database.v1.BackupSchedule;
+import com.google.spanner.admin.database.v1.BackupScheduleName;
+import com.google.spanner.admin.database.v1.BackupScheduleSpec;
+import com.google.spanner.admin.database.v1.CreateBackupEncryptionConfig;
import com.google.spanner.admin.database.v1.Database;
import com.google.spanner.admin.database.v1.DatabaseDialect;
import com.google.spanner.admin.database.v1.DatabaseName;
@@ -55,6 +61,7 @@
import com.google.spanner.admin.database.v1.GetDatabaseDdlResponse;
import com.google.spanner.admin.database.v1.InstanceName;
import com.google.spanner.admin.database.v1.ListBackupOperationsResponse;
+import com.google.spanner.admin.database.v1.ListBackupSchedulesResponse;
import com.google.spanner.admin.database.v1.ListBackupsResponse;
import com.google.spanner.admin.database.v1.ListDatabaseOperationsResponse;
import com.google.spanner.admin.database.v1.ListDatabaseRolesResponse;
@@ -1085,6 +1092,7 @@ public void createBackupTest() throws Exception {
.setDatabaseDialect(DatabaseDialect.forNumber(0))
.addAllReferencingBackups(new ArrayList())
.setMaxExpireTime(Timestamp.newBuilder().build())
+ .addAllBackupSchedules(new ArrayList())
.build();
Operation resultOperation =
Operation.newBuilder()
@@ -1149,6 +1157,7 @@ public void createBackupTest2() throws Exception {
.setDatabaseDialect(DatabaseDialect.forNumber(0))
.addAllReferencingBackups(new ArrayList())
.setMaxExpireTime(Timestamp.newBuilder().build())
+ .addAllBackupSchedules(new ArrayList())
.build();
Operation resultOperation =
Operation.newBuilder()
@@ -1213,6 +1222,7 @@ public void copyBackupTest() throws Exception {
.setDatabaseDialect(DatabaseDialect.forNumber(0))
.addAllReferencingBackups(new ArrayList())
.setMaxExpireTime(Timestamp.newBuilder().build())
+ .addAllBackupSchedules(new ArrayList())
.build();
Operation resultOperation =
Operation.newBuilder()
@@ -1280,6 +1290,7 @@ public void copyBackupTest2() throws Exception {
.setDatabaseDialect(DatabaseDialect.forNumber(0))
.addAllReferencingBackups(new ArrayList())
.setMaxExpireTime(Timestamp.newBuilder().build())
+ .addAllBackupSchedules(new ArrayList())
.build();
Operation resultOperation =
Operation.newBuilder()
@@ -1347,6 +1358,7 @@ public void copyBackupTest3() throws Exception {
.setDatabaseDialect(DatabaseDialect.forNumber(0))
.addAllReferencingBackups(new ArrayList())
.setMaxExpireTime(Timestamp.newBuilder().build())
+ .addAllBackupSchedules(new ArrayList())
.build();
Operation resultOperation =
Operation.newBuilder()
@@ -1414,6 +1426,7 @@ public void copyBackupTest4() throws Exception {
.setDatabaseDialect(DatabaseDialect.forNumber(0))
.addAllReferencingBackups(new ArrayList())
.setMaxExpireTime(Timestamp.newBuilder().build())
+ .addAllBackupSchedules(new ArrayList())
.build();
Operation resultOperation =
Operation.newBuilder()
@@ -1481,6 +1494,7 @@ public void getBackupTest() throws Exception {
.setDatabaseDialect(DatabaseDialect.forNumber(0))
.addAllReferencingBackups(new ArrayList())
.setMaxExpireTime(Timestamp.newBuilder().build())
+ .addAllBackupSchedules(new ArrayList())
.build();
mockService.addResponse(expectedResponse);
@@ -1536,6 +1550,7 @@ public void getBackupTest2() throws Exception {
.setDatabaseDialect(DatabaseDialect.forNumber(0))
.addAllReferencingBackups(new ArrayList())
.setMaxExpireTime(Timestamp.newBuilder().build())
+ .addAllBackupSchedules(new ArrayList())
.build();
mockService.addResponse(expectedResponse);
@@ -1591,6 +1606,7 @@ public void updateBackupTest() throws Exception {
.setDatabaseDialect(DatabaseDialect.forNumber(0))
.addAllReferencingBackups(new ArrayList())
.setMaxExpireTime(Timestamp.newBuilder().build())
+ .addAllBackupSchedules(new ArrayList())
.build();
mockService.addResponse(expectedResponse);
@@ -1608,6 +1624,7 @@ public void updateBackupTest() throws Exception {
.setDatabaseDialect(DatabaseDialect.forNumber(0))
.addAllReferencingBackups(new ArrayList())
.setMaxExpireTime(Timestamp.newBuilder().build())
+ .addAllBackupSchedules(new ArrayList())
.build();
FieldMask updateMask = FieldMask.newBuilder().build();
@@ -1651,6 +1668,7 @@ public void updateBackupExceptionTest() throws Exception {
.setDatabaseDialect(DatabaseDialect.forNumber(0))
.addAllReferencingBackups(new ArrayList())
.setMaxExpireTime(Timestamp.newBuilder().build())
+ .addAllBackupSchedules(new ArrayList())
.build();
FieldMask updateMask = FieldMask.newBuilder().build();
client.updateBackup(backup, updateMask);
@@ -2391,4 +2409,472 @@ public void listDatabaseRolesExceptionTest2() throws Exception {
// Expected exception.
}
}
+
+ @Test
+ public void createBackupScheduleTest() throws Exception {
+ BackupSchedule expectedResponse =
+ BackupSchedule.newBuilder()
+ .setName(
+ BackupScheduleName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SCHEDULE]")
+ .toString())
+ .setSpec(BackupScheduleSpec.newBuilder().build())
+ .setRetentionDuration(Duration.newBuilder().build())
+ .setEncryptionConfig(CreateBackupEncryptionConfig.newBuilder().build())
+ .setUpdateTime(Timestamp.newBuilder().build())
+ .build();
+ mockService.addResponse(expectedResponse);
+
+ DatabaseName parent = DatabaseName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]");
+ BackupSchedule backupSchedule = BackupSchedule.newBuilder().build();
+ String backupScheduleId = "backupScheduleId1704974708";
+
+ BackupSchedule actualResponse =
+ client.createBackupSchedule(parent, backupSchedule, backupScheduleId);
+ Assert.assertEquals(expectedResponse, actualResponse);
+
+ List actualRequests = mockService.getRequestPaths();
+ Assert.assertEquals(1, actualRequests.size());
+
+ String apiClientHeaderKey =
+ mockService
+ .getRequestHeaders()
+ .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey())
+ .iterator()
+ .next();
+ Assert.assertTrue(
+ GaxHttpJsonProperties.getDefaultApiClientHeaderPattern()
+ .matcher(apiClientHeaderKey)
+ .matches());
+ }
+
+ @Test
+ public void createBackupScheduleExceptionTest() throws Exception {
+ ApiException exception =
+ ApiExceptionFactory.createException(
+ new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false);
+ mockService.addException(exception);
+
+ try {
+ DatabaseName parent = DatabaseName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]");
+ BackupSchedule backupSchedule = BackupSchedule.newBuilder().build();
+ String backupScheduleId = "backupScheduleId1704974708";
+ client.createBackupSchedule(parent, backupSchedule, backupScheduleId);
+ Assert.fail("No exception raised");
+ } catch (InvalidArgumentException e) {
+ // Expected exception.
+ }
+ }
+
+ @Test
+ public void createBackupScheduleTest2() throws Exception {
+ BackupSchedule expectedResponse =
+ BackupSchedule.newBuilder()
+ .setName(
+ BackupScheduleName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SCHEDULE]")
+ .toString())
+ .setSpec(BackupScheduleSpec.newBuilder().build())
+ .setRetentionDuration(Duration.newBuilder().build())
+ .setEncryptionConfig(CreateBackupEncryptionConfig.newBuilder().build())
+ .setUpdateTime(Timestamp.newBuilder().build())
+ .build();
+ mockService.addResponse(expectedResponse);
+
+ String parent = "projects/project-9347/instances/instance-9347/databases/database-9347";
+ BackupSchedule backupSchedule = BackupSchedule.newBuilder().build();
+ String backupScheduleId = "backupScheduleId1704974708";
+
+ BackupSchedule actualResponse =
+ client.createBackupSchedule(parent, backupSchedule, backupScheduleId);
+ Assert.assertEquals(expectedResponse, actualResponse);
+
+ List actualRequests = mockService.getRequestPaths();
+ Assert.assertEquals(1, actualRequests.size());
+
+ String apiClientHeaderKey =
+ mockService
+ .getRequestHeaders()
+ .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey())
+ .iterator()
+ .next();
+ Assert.assertTrue(
+ GaxHttpJsonProperties.getDefaultApiClientHeaderPattern()
+ .matcher(apiClientHeaderKey)
+ .matches());
+ }
+
+ @Test
+ public void createBackupScheduleExceptionTest2() throws Exception {
+ ApiException exception =
+ ApiExceptionFactory.createException(
+ new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false);
+ mockService.addException(exception);
+
+ try {
+ String parent = "projects/project-9347/instances/instance-9347/databases/database-9347";
+ BackupSchedule backupSchedule = BackupSchedule.newBuilder().build();
+ String backupScheduleId = "backupScheduleId1704974708";
+ client.createBackupSchedule(parent, backupSchedule, backupScheduleId);
+ Assert.fail("No exception raised");
+ } catch (InvalidArgumentException e) {
+ // Expected exception.
+ }
+ }
+
+ @Test
+ public void getBackupScheduleTest() throws Exception {
+ BackupSchedule expectedResponse =
+ BackupSchedule.newBuilder()
+ .setName(
+ BackupScheduleName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SCHEDULE]")
+ .toString())
+ .setSpec(BackupScheduleSpec.newBuilder().build())
+ .setRetentionDuration(Duration.newBuilder().build())
+ .setEncryptionConfig(CreateBackupEncryptionConfig.newBuilder().build())
+ .setUpdateTime(Timestamp.newBuilder().build())
+ .build();
+ mockService.addResponse(expectedResponse);
+
+ BackupScheduleName name =
+ BackupScheduleName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SCHEDULE]");
+
+ BackupSchedule actualResponse = client.getBackupSchedule(name);
+ Assert.assertEquals(expectedResponse, actualResponse);
+
+ List actualRequests = mockService.getRequestPaths();
+ Assert.assertEquals(1, actualRequests.size());
+
+ String apiClientHeaderKey =
+ mockService
+ .getRequestHeaders()
+ .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey())
+ .iterator()
+ .next();
+ Assert.assertTrue(
+ GaxHttpJsonProperties.getDefaultApiClientHeaderPattern()
+ .matcher(apiClientHeaderKey)
+ .matches());
+ }
+
+ @Test
+ public void getBackupScheduleExceptionTest() throws Exception {
+ ApiException exception =
+ ApiExceptionFactory.createException(
+ new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false);
+ mockService.addException(exception);
+
+ try {
+ BackupScheduleName name =
+ BackupScheduleName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SCHEDULE]");
+ client.getBackupSchedule(name);
+ Assert.fail("No exception raised");
+ } catch (InvalidArgumentException e) {
+ // Expected exception.
+ }
+ }
+
+ @Test
+ public void getBackupScheduleTest2() throws Exception {
+ BackupSchedule expectedResponse =
+ BackupSchedule.newBuilder()
+ .setName(
+ BackupScheduleName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SCHEDULE]")
+ .toString())
+ .setSpec(BackupScheduleSpec.newBuilder().build())
+ .setRetentionDuration(Duration.newBuilder().build())
+ .setEncryptionConfig(CreateBackupEncryptionConfig.newBuilder().build())
+ .setUpdateTime(Timestamp.newBuilder().build())
+ .build();
+ mockService.addResponse(expectedResponse);
+
+ String name =
+ "projects/project-8764/instances/instance-8764/databases/database-8764/backupSchedules/backupSchedule-8764";
+
+ BackupSchedule actualResponse = client.getBackupSchedule(name);
+ Assert.assertEquals(expectedResponse, actualResponse);
+
+ List actualRequests = mockService.getRequestPaths();
+ Assert.assertEquals(1, actualRequests.size());
+
+ String apiClientHeaderKey =
+ mockService
+ .getRequestHeaders()
+ .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey())
+ .iterator()
+ .next();
+ Assert.assertTrue(
+ GaxHttpJsonProperties.getDefaultApiClientHeaderPattern()
+ .matcher(apiClientHeaderKey)
+ .matches());
+ }
+
+ @Test
+ public void getBackupScheduleExceptionTest2() throws Exception {
+ ApiException exception =
+ ApiExceptionFactory.createException(
+ new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false);
+ mockService.addException(exception);
+
+ try {
+ String name =
+ "projects/project-8764/instances/instance-8764/databases/database-8764/backupSchedules/backupSchedule-8764";
+ client.getBackupSchedule(name);
+ Assert.fail("No exception raised");
+ } catch (InvalidArgumentException e) {
+ // Expected exception.
+ }
+ }
+
+ @Test
+ public void updateBackupScheduleTest() throws Exception {
+ BackupSchedule expectedResponse =
+ BackupSchedule.newBuilder()
+ .setName(
+ BackupScheduleName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SCHEDULE]")
+ .toString())
+ .setSpec(BackupScheduleSpec.newBuilder().build())
+ .setRetentionDuration(Duration.newBuilder().build())
+ .setEncryptionConfig(CreateBackupEncryptionConfig.newBuilder().build())
+ .setUpdateTime(Timestamp.newBuilder().build())
+ .build();
+ mockService.addResponse(expectedResponse);
+
+ BackupSchedule backupSchedule =
+ BackupSchedule.newBuilder()
+ .setName(
+ BackupScheduleName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SCHEDULE]")
+ .toString())
+ .setSpec(BackupScheduleSpec.newBuilder().build())
+ .setRetentionDuration(Duration.newBuilder().build())
+ .setEncryptionConfig(CreateBackupEncryptionConfig.newBuilder().build())
+ .setUpdateTime(Timestamp.newBuilder().build())
+ .build();
+ FieldMask updateMask = FieldMask.newBuilder().build();
+
+ BackupSchedule actualResponse = client.updateBackupSchedule(backupSchedule, updateMask);
+ Assert.assertEquals(expectedResponse, actualResponse);
+
+ List actualRequests = mockService.getRequestPaths();
+ Assert.assertEquals(1, actualRequests.size());
+
+ String apiClientHeaderKey =
+ mockService
+ .getRequestHeaders()
+ .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey())
+ .iterator()
+ .next();
+ Assert.assertTrue(
+ GaxHttpJsonProperties.getDefaultApiClientHeaderPattern()
+ .matcher(apiClientHeaderKey)
+ .matches());
+ }
+
+ @Test
+ public void updateBackupScheduleExceptionTest() throws Exception {
+ ApiException exception =
+ ApiExceptionFactory.createException(
+ new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false);
+ mockService.addException(exception);
+
+ try {
+ BackupSchedule backupSchedule =
+ BackupSchedule.newBuilder()
+ .setName(
+ BackupScheduleName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SCHEDULE]")
+ .toString())
+ .setSpec(BackupScheduleSpec.newBuilder().build())
+ .setRetentionDuration(Duration.newBuilder().build())
+ .setEncryptionConfig(CreateBackupEncryptionConfig.newBuilder().build())
+ .setUpdateTime(Timestamp.newBuilder().build())
+ .build();
+ FieldMask updateMask = FieldMask.newBuilder().build();
+ client.updateBackupSchedule(backupSchedule, updateMask);
+ Assert.fail("No exception raised");
+ } catch (InvalidArgumentException e) {
+ // Expected exception.
+ }
+ }
+
+ @Test
+ public void deleteBackupScheduleTest() throws Exception {
+ Empty expectedResponse = Empty.newBuilder().build();
+ mockService.addResponse(expectedResponse);
+
+ BackupScheduleName name =
+ BackupScheduleName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SCHEDULE]");
+
+ client.deleteBackupSchedule(name);
+
+ List actualRequests = mockService.getRequestPaths();
+ Assert.assertEquals(1, actualRequests.size());
+
+ String apiClientHeaderKey =
+ mockService
+ .getRequestHeaders()
+ .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey())
+ .iterator()
+ .next();
+ Assert.assertTrue(
+ GaxHttpJsonProperties.getDefaultApiClientHeaderPattern()
+ .matcher(apiClientHeaderKey)
+ .matches());
+ }
+
+ @Test
+ public void deleteBackupScheduleExceptionTest() throws Exception {
+ ApiException exception =
+ ApiExceptionFactory.createException(
+ new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false);
+ mockService.addException(exception);
+
+ try {
+ BackupScheduleName name =
+ BackupScheduleName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SCHEDULE]");
+ client.deleteBackupSchedule(name);
+ Assert.fail("No exception raised");
+ } catch (InvalidArgumentException e) {
+ // Expected exception.
+ }
+ }
+
+ @Test
+ public void deleteBackupScheduleTest2() throws Exception {
+ Empty expectedResponse = Empty.newBuilder().build();
+ mockService.addResponse(expectedResponse);
+
+ String name =
+ "projects/project-8764/instances/instance-8764/databases/database-8764/backupSchedules/backupSchedule-8764";
+
+ client.deleteBackupSchedule(name);
+
+ List actualRequests = mockService.getRequestPaths();
+ Assert.assertEquals(1, actualRequests.size());
+
+ String apiClientHeaderKey =
+ mockService
+ .getRequestHeaders()
+ .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey())
+ .iterator()
+ .next();
+ Assert.assertTrue(
+ GaxHttpJsonProperties.getDefaultApiClientHeaderPattern()
+ .matcher(apiClientHeaderKey)
+ .matches());
+ }
+
+ @Test
+ public void deleteBackupScheduleExceptionTest2() throws Exception {
+ ApiException exception =
+ ApiExceptionFactory.createException(
+ new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false);
+ mockService.addException(exception);
+
+ try {
+ String name =
+ "projects/project-8764/instances/instance-8764/databases/database-8764/backupSchedules/backupSchedule-8764";
+ client.deleteBackupSchedule(name);
+ Assert.fail("No exception raised");
+ } catch (InvalidArgumentException e) {
+ // Expected exception.
+ }
+ }
+
+ @Test
+ public void listBackupSchedulesTest() throws Exception {
+ BackupSchedule responsesElement = BackupSchedule.newBuilder().build();
+ ListBackupSchedulesResponse expectedResponse =
+ ListBackupSchedulesResponse.newBuilder()
+ .setNextPageToken("")
+ .addAllBackupSchedules(Arrays.asList(responsesElement))
+ .build();
+ mockService.addResponse(expectedResponse);
+
+ DatabaseName parent = DatabaseName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]");
+
+ ListBackupSchedulesPagedResponse pagedListResponse = client.listBackupSchedules(parent);
+
+ List resources = Lists.newArrayList(pagedListResponse.iterateAll());
+
+ Assert.assertEquals(1, resources.size());
+ Assert.assertEquals(expectedResponse.getBackupSchedulesList().get(0), resources.get(0));
+
+ List actualRequests = mockService.getRequestPaths();
+ Assert.assertEquals(1, actualRequests.size());
+
+ String apiClientHeaderKey =
+ mockService
+ .getRequestHeaders()
+ .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey())
+ .iterator()
+ .next();
+ Assert.assertTrue(
+ GaxHttpJsonProperties.getDefaultApiClientHeaderPattern()
+ .matcher(apiClientHeaderKey)
+ .matches());
+ }
+
+ @Test
+ public void listBackupSchedulesExceptionTest() throws Exception {
+ ApiException exception =
+ ApiExceptionFactory.createException(
+ new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false);
+ mockService.addException(exception);
+
+ try {
+ DatabaseName parent = DatabaseName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]");
+ client.listBackupSchedules(parent);
+ Assert.fail("No exception raised");
+ } catch (InvalidArgumentException e) {
+ // Expected exception.
+ }
+ }
+
+ @Test
+ public void listBackupSchedulesTest2() throws Exception {
+ BackupSchedule responsesElement = BackupSchedule.newBuilder().build();
+ ListBackupSchedulesResponse expectedResponse =
+ ListBackupSchedulesResponse.newBuilder()
+ .setNextPageToken("")
+ .addAllBackupSchedules(Arrays.asList(responsesElement))
+ .build();
+ mockService.addResponse(expectedResponse);
+
+ String parent = "projects/project-9347/instances/instance-9347/databases/database-9347";
+
+ ListBackupSchedulesPagedResponse pagedListResponse = client.listBackupSchedules(parent);
+
+ List resources = Lists.newArrayList(pagedListResponse.iterateAll());
+
+ Assert.assertEquals(1, resources.size());
+ Assert.assertEquals(expectedResponse.getBackupSchedulesList().get(0), resources.get(0));
+
+ List actualRequests = mockService.getRequestPaths();
+ Assert.assertEquals(1, actualRequests.size());
+
+ String apiClientHeaderKey =
+ mockService
+ .getRequestHeaders()
+ .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey())
+ .iterator()
+ .next();
+ Assert.assertTrue(
+ GaxHttpJsonProperties.getDefaultApiClientHeaderPattern()
+ .matcher(apiClientHeaderKey)
+ .matches());
+ }
+
+ @Test
+ public void listBackupSchedulesExceptionTest2() throws Exception {
+ ApiException exception =
+ ApiExceptionFactory.createException(
+ new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false);
+ mockService.addException(exception);
+
+ try {
+ String parent = "projects/project-9347/instances/instance-9347/databases/database-9347";
+ client.listBackupSchedules(parent);
+ Assert.fail("No exception raised");
+ } catch (InvalidArgumentException e) {
+ // Expected exception.
+ }
+ }
}
diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/admin/database/v1/DatabaseAdminClientTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/admin/database/v1/DatabaseAdminClientTest.java
index 3766ca90a8f..469c0f53a1c 100644
--- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/admin/database/v1/DatabaseAdminClientTest.java
+++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/admin/database/v1/DatabaseAdminClientTest.java
@@ -17,6 +17,7 @@
package com.google.cloud.spanner.admin.database.v1;
import static com.google.cloud.spanner.admin.database.v1.DatabaseAdminClient.ListBackupOperationsPagedResponse;
+import static com.google.cloud.spanner.admin.database.v1.DatabaseAdminClient.ListBackupSchedulesPagedResponse;
import static com.google.cloud.spanner.admin.database.v1.DatabaseAdminClient.ListBackupsPagedResponse;
import static com.google.cloud.spanner.admin.database.v1.DatabaseAdminClient.ListDatabaseOperationsPagedResponse;
import static com.google.cloud.spanner.admin.database.v1.DatabaseAdminClient.ListDatabaseRolesPagedResponse;
@@ -43,29 +44,39 @@
import com.google.protobuf.AbstractMessage;
import com.google.protobuf.Any;
import com.google.protobuf.ByteString;
+import com.google.protobuf.Duration;
import com.google.protobuf.Empty;
import com.google.protobuf.FieldMask;
import com.google.protobuf.Timestamp;
import com.google.spanner.admin.database.v1.Backup;
import com.google.spanner.admin.database.v1.BackupName;
+import com.google.spanner.admin.database.v1.BackupSchedule;
+import com.google.spanner.admin.database.v1.BackupScheduleName;
+import com.google.spanner.admin.database.v1.BackupScheduleSpec;
import com.google.spanner.admin.database.v1.CopyBackupRequest;
+import com.google.spanner.admin.database.v1.CreateBackupEncryptionConfig;
import com.google.spanner.admin.database.v1.CreateBackupRequest;
+import com.google.spanner.admin.database.v1.CreateBackupScheduleRequest;
import com.google.spanner.admin.database.v1.CreateDatabaseRequest;
import com.google.spanner.admin.database.v1.Database;
import com.google.spanner.admin.database.v1.DatabaseDialect;
import com.google.spanner.admin.database.v1.DatabaseName;
import com.google.spanner.admin.database.v1.DatabaseRole;
import com.google.spanner.admin.database.v1.DeleteBackupRequest;
+import com.google.spanner.admin.database.v1.DeleteBackupScheduleRequest;
import com.google.spanner.admin.database.v1.DropDatabaseRequest;
import com.google.spanner.admin.database.v1.EncryptionConfig;
import com.google.spanner.admin.database.v1.EncryptionInfo;
import com.google.spanner.admin.database.v1.GetBackupRequest;
+import com.google.spanner.admin.database.v1.GetBackupScheduleRequest;
import com.google.spanner.admin.database.v1.GetDatabaseDdlRequest;
import com.google.spanner.admin.database.v1.GetDatabaseDdlResponse;
import com.google.spanner.admin.database.v1.GetDatabaseRequest;
import com.google.spanner.admin.database.v1.InstanceName;
import com.google.spanner.admin.database.v1.ListBackupOperationsRequest;
import com.google.spanner.admin.database.v1.ListBackupOperationsResponse;
+import com.google.spanner.admin.database.v1.ListBackupSchedulesRequest;
+import com.google.spanner.admin.database.v1.ListBackupSchedulesResponse;
import com.google.spanner.admin.database.v1.ListBackupsRequest;
import com.google.spanner.admin.database.v1.ListBackupsResponse;
import com.google.spanner.admin.database.v1.ListDatabaseOperationsRequest;
@@ -77,6 +88,7 @@
import com.google.spanner.admin.database.v1.RestoreDatabaseRequest;
import com.google.spanner.admin.database.v1.RestoreInfo;
import com.google.spanner.admin.database.v1.UpdateBackupRequest;
+import com.google.spanner.admin.database.v1.UpdateBackupScheduleRequest;
import com.google.spanner.admin.database.v1.UpdateDatabaseDdlRequest;
import com.google.spanner.admin.database.v1.UpdateDatabaseRequest;
import io.grpc.StatusRuntimeException;
@@ -993,6 +1005,7 @@ public void createBackupTest() throws Exception {
.setDatabaseDialect(DatabaseDialect.forNumber(0))
.addAllReferencingBackups(new ArrayList())
.setMaxExpireTime(Timestamp.newBuilder().build())
+ .addAllBackupSchedules(new ArrayList())
.build();
Operation resultOperation =
Operation.newBuilder()
@@ -1056,6 +1069,7 @@ public void createBackupTest2() throws Exception {
.setDatabaseDialect(DatabaseDialect.forNumber(0))
.addAllReferencingBackups(new ArrayList())
.setMaxExpireTime(Timestamp.newBuilder().build())
+ .addAllBackupSchedules(new ArrayList())
.build();
Operation resultOperation =
Operation.newBuilder()
@@ -1119,6 +1133,7 @@ public void copyBackupTest() throws Exception {
.setDatabaseDialect(DatabaseDialect.forNumber(0))
.addAllReferencingBackups(new ArrayList())
.setMaxExpireTime(Timestamp.newBuilder().build())
+ .addAllBackupSchedules(new ArrayList())
.build();
Operation resultOperation =
Operation.newBuilder()
@@ -1186,6 +1201,7 @@ public void copyBackupTest2() throws Exception {
.setDatabaseDialect(DatabaseDialect.forNumber(0))
.addAllReferencingBackups(new ArrayList())
.setMaxExpireTime(Timestamp.newBuilder().build())
+ .addAllBackupSchedules(new ArrayList())
.build();
Operation resultOperation =
Operation.newBuilder()
@@ -1253,6 +1269,7 @@ public void copyBackupTest3() throws Exception {
.setDatabaseDialect(DatabaseDialect.forNumber(0))
.addAllReferencingBackups(new ArrayList())
.setMaxExpireTime(Timestamp.newBuilder().build())
+ .addAllBackupSchedules(new ArrayList())
.build();
Operation resultOperation =
Operation.newBuilder()
@@ -1320,6 +1337,7 @@ public void copyBackupTest4() throws Exception {
.setDatabaseDialect(DatabaseDialect.forNumber(0))
.addAllReferencingBackups(new ArrayList())
.setMaxExpireTime(Timestamp.newBuilder().build())
+ .addAllBackupSchedules(new ArrayList())
.build();
Operation resultOperation =
Operation.newBuilder()
@@ -1387,6 +1405,7 @@ public void getBackupTest() throws Exception {
.setDatabaseDialect(DatabaseDialect.forNumber(0))
.addAllReferencingBackups(new ArrayList())
.setMaxExpireTime(Timestamp.newBuilder().build())
+ .addAllBackupSchedules(new ArrayList())
.build();
mockDatabaseAdmin.addResponse(expectedResponse);
@@ -1436,6 +1455,7 @@ public void getBackupTest2() throws Exception {
.setDatabaseDialect(DatabaseDialect.forNumber(0))
.addAllReferencingBackups(new ArrayList())
.setMaxExpireTime(Timestamp.newBuilder().build())
+ .addAllBackupSchedules(new ArrayList())
.build();
mockDatabaseAdmin.addResponse(expectedResponse);
@@ -1485,6 +1505,7 @@ public void updateBackupTest() throws Exception {
.setDatabaseDialect(DatabaseDialect.forNumber(0))
.addAllReferencingBackups(new ArrayList())
.setMaxExpireTime(Timestamp.newBuilder().build())
+ .addAllBackupSchedules(new ArrayList())
.build();
mockDatabaseAdmin.addResponse(expectedResponse);
@@ -2192,4 +2213,406 @@ public void listDatabaseRolesExceptionTest2() throws Exception {
// Expected exception.
}
}
+
+ @Test
+ public void createBackupScheduleTest() throws Exception {
+ BackupSchedule expectedResponse =
+ BackupSchedule.newBuilder()
+ .setName(
+ BackupScheduleName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SCHEDULE]")
+ .toString())
+ .setSpec(BackupScheduleSpec.newBuilder().build())
+ .setRetentionDuration(Duration.newBuilder().build())
+ .setEncryptionConfig(CreateBackupEncryptionConfig.newBuilder().build())
+ .setUpdateTime(Timestamp.newBuilder().build())
+ .build();
+ mockDatabaseAdmin.addResponse(expectedResponse);
+
+ DatabaseName parent = DatabaseName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]");
+ BackupSchedule backupSchedule = BackupSchedule.newBuilder().build();
+ String backupScheduleId = "backupScheduleId1704974708";
+
+ BackupSchedule actualResponse =
+ client.createBackupSchedule(parent, backupSchedule, backupScheduleId);
+ Assert.assertEquals(expectedResponse, actualResponse);
+
+ List actualRequests = mockDatabaseAdmin.getRequests();
+ Assert.assertEquals(1, actualRequests.size());
+ CreateBackupScheduleRequest actualRequest =
+ ((CreateBackupScheduleRequest) actualRequests.get(0));
+
+ Assert.assertEquals(parent.toString(), actualRequest.getParent());
+ Assert.assertEquals(backupSchedule, actualRequest.getBackupSchedule());
+ Assert.assertEquals(backupScheduleId, actualRequest.getBackupScheduleId());
+ Assert.assertTrue(
+ channelProvider.isHeaderSent(
+ ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
+ GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
+ }
+
+ @Test
+ public void createBackupScheduleExceptionTest() throws Exception {
+ StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
+ mockDatabaseAdmin.addException(exception);
+
+ try {
+ DatabaseName parent = DatabaseName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]");
+ BackupSchedule backupSchedule = BackupSchedule.newBuilder().build();
+ String backupScheduleId = "backupScheduleId1704974708";
+ client.createBackupSchedule(parent, backupSchedule, backupScheduleId);
+ Assert.fail("No exception raised");
+ } catch (InvalidArgumentException e) {
+ // Expected exception.
+ }
+ }
+
+ @Test
+ public void createBackupScheduleTest2() throws Exception {
+ BackupSchedule expectedResponse =
+ BackupSchedule.newBuilder()
+ .setName(
+ BackupScheduleName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SCHEDULE]")
+ .toString())
+ .setSpec(BackupScheduleSpec.newBuilder().build())
+ .setRetentionDuration(Duration.newBuilder().build())
+ .setEncryptionConfig(CreateBackupEncryptionConfig.newBuilder().build())
+ .setUpdateTime(Timestamp.newBuilder().build())
+ .build();
+ mockDatabaseAdmin.addResponse(expectedResponse);
+
+ String parent = "parent-995424086";
+ BackupSchedule backupSchedule = BackupSchedule.newBuilder().build();
+ String backupScheduleId = "backupScheduleId1704974708";
+
+ BackupSchedule actualResponse =
+ client.createBackupSchedule(parent, backupSchedule, backupScheduleId);
+ Assert.assertEquals(expectedResponse, actualResponse);
+
+ List actualRequests = mockDatabaseAdmin.getRequests();
+ Assert.assertEquals(1, actualRequests.size());
+ CreateBackupScheduleRequest actualRequest =
+ ((CreateBackupScheduleRequest) actualRequests.get(0));
+
+ Assert.assertEquals(parent, actualRequest.getParent());
+ Assert.assertEquals(backupSchedule, actualRequest.getBackupSchedule());
+ Assert.assertEquals(backupScheduleId, actualRequest.getBackupScheduleId());
+ Assert.assertTrue(
+ channelProvider.isHeaderSent(
+ ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
+ GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
+ }
+
+ @Test
+ public void createBackupScheduleExceptionTest2() throws Exception {
+ StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
+ mockDatabaseAdmin.addException(exception);
+
+ try {
+ String parent = "parent-995424086";
+ BackupSchedule backupSchedule = BackupSchedule.newBuilder().build();
+ String backupScheduleId = "backupScheduleId1704974708";
+ client.createBackupSchedule(parent, backupSchedule, backupScheduleId);
+ Assert.fail("No exception raised");
+ } catch (InvalidArgumentException e) {
+ // Expected exception.
+ }
+ }
+
+ @Test
+ public void getBackupScheduleTest() throws Exception {
+ BackupSchedule expectedResponse =
+ BackupSchedule.newBuilder()
+ .setName(
+ BackupScheduleName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SCHEDULE]")
+ .toString())
+ .setSpec(BackupScheduleSpec.newBuilder().build())
+ .setRetentionDuration(Duration.newBuilder().build())
+ .setEncryptionConfig(CreateBackupEncryptionConfig.newBuilder().build())
+ .setUpdateTime(Timestamp.newBuilder().build())
+ .build();
+ mockDatabaseAdmin.addResponse(expectedResponse);
+
+ BackupScheduleName name =
+ BackupScheduleName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SCHEDULE]");
+
+ BackupSchedule actualResponse = client.getBackupSchedule(name);
+ Assert.assertEquals(expectedResponse, actualResponse);
+
+ List actualRequests = mockDatabaseAdmin.getRequests();
+ Assert.assertEquals(1, actualRequests.size());
+ GetBackupScheduleRequest actualRequest = ((GetBackupScheduleRequest) actualRequests.get(0));
+
+ Assert.assertEquals(name.toString(), actualRequest.getName());
+ Assert.assertTrue(
+ channelProvider.isHeaderSent(
+ ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
+ GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
+ }
+
+ @Test
+ public void getBackupScheduleExceptionTest() throws Exception {
+ StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
+ mockDatabaseAdmin.addException(exception);
+
+ try {
+ BackupScheduleName name =
+ BackupScheduleName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SCHEDULE]");
+ client.getBackupSchedule(name);
+ Assert.fail("No exception raised");
+ } catch (InvalidArgumentException e) {
+ // Expected exception.
+ }
+ }
+
+ @Test
+ public void getBackupScheduleTest2() throws Exception {
+ BackupSchedule expectedResponse =
+ BackupSchedule.newBuilder()
+ .setName(
+ BackupScheduleName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SCHEDULE]")
+ .toString())
+ .setSpec(BackupScheduleSpec.newBuilder().build())
+ .setRetentionDuration(Duration.newBuilder().build())
+ .setEncryptionConfig(CreateBackupEncryptionConfig.newBuilder().build())
+ .setUpdateTime(Timestamp.newBuilder().build())
+ .build();
+ mockDatabaseAdmin.addResponse(expectedResponse);
+
+ String name = "name3373707";
+
+ BackupSchedule actualResponse = client.getBackupSchedule(name);
+ Assert.assertEquals(expectedResponse, actualResponse);
+
+ List actualRequests = mockDatabaseAdmin.getRequests();
+ Assert.assertEquals(1, actualRequests.size());
+ GetBackupScheduleRequest actualRequest = ((GetBackupScheduleRequest) actualRequests.get(0));
+
+ Assert.assertEquals(name, actualRequest.getName());
+ Assert.assertTrue(
+ channelProvider.isHeaderSent(
+ ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
+ GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
+ }
+
+ @Test
+ public void getBackupScheduleExceptionTest2() throws Exception {
+ StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
+ mockDatabaseAdmin.addException(exception);
+
+ try {
+ String name = "name3373707";
+ client.getBackupSchedule(name);
+ Assert.fail("No exception raised");
+ } catch (InvalidArgumentException e) {
+ // Expected exception.
+ }
+ }
+
+ @Test
+ public void updateBackupScheduleTest() throws Exception {
+ BackupSchedule expectedResponse =
+ BackupSchedule.newBuilder()
+ .setName(
+ BackupScheduleName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SCHEDULE]")
+ .toString())
+ .setSpec(BackupScheduleSpec.newBuilder().build())
+ .setRetentionDuration(Duration.newBuilder().build())
+ .setEncryptionConfig(CreateBackupEncryptionConfig.newBuilder().build())
+ .setUpdateTime(Timestamp.newBuilder().build())
+ .build();
+ mockDatabaseAdmin.addResponse(expectedResponse);
+
+ BackupSchedule backupSchedule = BackupSchedule.newBuilder().build();
+ FieldMask updateMask = FieldMask.newBuilder().build();
+
+ BackupSchedule actualResponse = client.updateBackupSchedule(backupSchedule, updateMask);
+ Assert.assertEquals(expectedResponse, actualResponse);
+
+ List actualRequests = mockDatabaseAdmin.getRequests();
+ Assert.assertEquals(1, actualRequests.size());
+ UpdateBackupScheduleRequest actualRequest =
+ ((UpdateBackupScheduleRequest) actualRequests.get(0));
+
+ Assert.assertEquals(backupSchedule, actualRequest.getBackupSchedule());
+ Assert.assertEquals(updateMask, actualRequest.getUpdateMask());
+ Assert.assertTrue(
+ channelProvider.isHeaderSent(
+ ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
+ GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
+ }
+
+ @Test
+ public void updateBackupScheduleExceptionTest() throws Exception {
+ StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
+ mockDatabaseAdmin.addException(exception);
+
+ try {
+ BackupSchedule backupSchedule = BackupSchedule.newBuilder().build();
+ FieldMask updateMask = FieldMask.newBuilder().build();
+ client.updateBackupSchedule(backupSchedule, updateMask);
+ Assert.fail("No exception raised");
+ } catch (InvalidArgumentException e) {
+ // Expected exception.
+ }
+ }
+
+ @Test
+ public void deleteBackupScheduleTest() throws Exception {
+ Empty expectedResponse = Empty.newBuilder().build();
+ mockDatabaseAdmin.addResponse(expectedResponse);
+
+ BackupScheduleName name =
+ BackupScheduleName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SCHEDULE]");
+
+ client.deleteBackupSchedule(name);
+
+ List actualRequests = mockDatabaseAdmin.getRequests();
+ Assert.assertEquals(1, actualRequests.size());
+ DeleteBackupScheduleRequest actualRequest =
+ ((DeleteBackupScheduleRequest) actualRequests.get(0));
+
+ Assert.assertEquals(name.toString(), actualRequest.getName());
+ Assert.assertTrue(
+ channelProvider.isHeaderSent(
+ ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
+ GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
+ }
+
+ @Test
+ public void deleteBackupScheduleExceptionTest() throws Exception {
+ StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
+ mockDatabaseAdmin.addException(exception);
+
+ try {
+ BackupScheduleName name =
+ BackupScheduleName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SCHEDULE]");
+ client.deleteBackupSchedule(name);
+ Assert.fail("No exception raised");
+ } catch (InvalidArgumentException e) {
+ // Expected exception.
+ }
+ }
+
+ @Test
+ public void deleteBackupScheduleTest2() throws Exception {
+ Empty expectedResponse = Empty.newBuilder().build();
+ mockDatabaseAdmin.addResponse(expectedResponse);
+
+ String name = "name3373707";
+
+ client.deleteBackupSchedule(name);
+
+ List actualRequests = mockDatabaseAdmin.getRequests();
+ Assert.assertEquals(1, actualRequests.size());
+ DeleteBackupScheduleRequest actualRequest =
+ ((DeleteBackupScheduleRequest) actualRequests.get(0));
+
+ Assert.assertEquals(name, actualRequest.getName());
+ Assert.assertTrue(
+ channelProvider.isHeaderSent(
+ ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
+ GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
+ }
+
+ @Test
+ public void deleteBackupScheduleExceptionTest2() throws Exception {
+ StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
+ mockDatabaseAdmin.addException(exception);
+
+ try {
+ String name = "name3373707";
+ client.deleteBackupSchedule(name);
+ Assert.fail("No exception raised");
+ } catch (InvalidArgumentException e) {
+ // Expected exception.
+ }
+ }
+
+ @Test
+ public void listBackupSchedulesTest() throws Exception {
+ BackupSchedule responsesElement = BackupSchedule.newBuilder().build();
+ ListBackupSchedulesResponse expectedResponse =
+ ListBackupSchedulesResponse.newBuilder()
+ .setNextPageToken("")
+ .addAllBackupSchedules(Arrays.asList(responsesElement))
+ .build();
+ mockDatabaseAdmin.addResponse(expectedResponse);
+
+ DatabaseName parent = DatabaseName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]");
+
+ ListBackupSchedulesPagedResponse pagedListResponse = client.listBackupSchedules(parent);
+
+ List resources = Lists.newArrayList(pagedListResponse.iterateAll());
+
+ Assert.assertEquals(1, resources.size());
+ Assert.assertEquals(expectedResponse.getBackupSchedulesList().get(0), resources.get(0));
+
+ List actualRequests = mockDatabaseAdmin.getRequests();
+ Assert.assertEquals(1, actualRequests.size());
+ ListBackupSchedulesRequest actualRequest = ((ListBackupSchedulesRequest) actualRequests.get(0));
+
+ Assert.assertEquals(parent.toString(), actualRequest.getParent());
+ Assert.assertTrue(
+ channelProvider.isHeaderSent(
+ ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
+ GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
+ }
+
+ @Test
+ public void listBackupSchedulesExceptionTest() throws Exception {
+ StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
+ mockDatabaseAdmin.addException(exception);
+
+ try {
+ DatabaseName parent = DatabaseName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]");
+ client.listBackupSchedules(parent);
+ Assert.fail("No exception raised");
+ } catch (InvalidArgumentException e) {
+ // Expected exception.
+ }
+ }
+
+ @Test
+ public void listBackupSchedulesTest2() throws Exception {
+ BackupSchedule responsesElement = BackupSchedule.newBuilder().build();
+ ListBackupSchedulesResponse expectedResponse =
+ ListBackupSchedulesResponse.newBuilder()
+ .setNextPageToken("")
+ .addAllBackupSchedules(Arrays.asList(responsesElement))
+ .build();
+ mockDatabaseAdmin.addResponse(expectedResponse);
+
+ String parent = "parent-995424086";
+
+ ListBackupSchedulesPagedResponse pagedListResponse = client.listBackupSchedules(parent);
+
+ List resources = Lists.newArrayList(pagedListResponse.iterateAll());
+
+ Assert.assertEquals(1, resources.size());
+ Assert.assertEquals(expectedResponse.getBackupSchedulesList().get(0), resources.get(0));
+
+ List actualRequests = mockDatabaseAdmin.getRequests();
+ Assert.assertEquals(1, actualRequests.size());
+ ListBackupSchedulesRequest actualRequest = ((ListBackupSchedulesRequest) actualRequests.get(0));
+
+ Assert.assertEquals(parent, actualRequest.getParent());
+ Assert.assertTrue(
+ channelProvider.isHeaderSent(
+ ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
+ GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
+ }
+
+ @Test
+ public void listBackupSchedulesExceptionTest2() throws Exception {
+ StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
+ mockDatabaseAdmin.addException(exception);
+
+ try {
+ String parent = "parent-995424086";
+ client.listBackupSchedules(parent);
+ Assert.fail("No exception raised");
+ } catch (InvalidArgumentException e) {
+ // Expected exception.
+ }
+ }
}
diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/admin/database/v1/MockDatabaseAdminImpl.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/admin/database/v1/MockDatabaseAdminImpl.java
index f77ad2edbc8..9e273ed1550 100644
--- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/admin/database/v1/MockDatabaseAdminImpl.java
+++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/admin/database/v1/MockDatabaseAdminImpl.java
@@ -26,19 +26,25 @@
import com.google.protobuf.AbstractMessage;
import com.google.protobuf.Empty;
import com.google.spanner.admin.database.v1.Backup;
+import com.google.spanner.admin.database.v1.BackupSchedule;
import com.google.spanner.admin.database.v1.CopyBackupRequest;
import com.google.spanner.admin.database.v1.CreateBackupRequest;
+import com.google.spanner.admin.database.v1.CreateBackupScheduleRequest;
import com.google.spanner.admin.database.v1.CreateDatabaseRequest;
import com.google.spanner.admin.database.v1.Database;
import com.google.spanner.admin.database.v1.DatabaseAdminGrpc.DatabaseAdminImplBase;
import com.google.spanner.admin.database.v1.DeleteBackupRequest;
+import com.google.spanner.admin.database.v1.DeleteBackupScheduleRequest;
import com.google.spanner.admin.database.v1.DropDatabaseRequest;
import com.google.spanner.admin.database.v1.GetBackupRequest;
+import com.google.spanner.admin.database.v1.GetBackupScheduleRequest;
import com.google.spanner.admin.database.v1.GetDatabaseDdlRequest;
import com.google.spanner.admin.database.v1.GetDatabaseDdlResponse;
import com.google.spanner.admin.database.v1.GetDatabaseRequest;
import com.google.spanner.admin.database.v1.ListBackupOperationsRequest;
import com.google.spanner.admin.database.v1.ListBackupOperationsResponse;
+import com.google.spanner.admin.database.v1.ListBackupSchedulesRequest;
+import com.google.spanner.admin.database.v1.ListBackupSchedulesResponse;
import com.google.spanner.admin.database.v1.ListBackupsRequest;
import com.google.spanner.admin.database.v1.ListBackupsResponse;
import com.google.spanner.admin.database.v1.ListDatabaseOperationsRequest;
@@ -49,6 +55,7 @@
import com.google.spanner.admin.database.v1.ListDatabasesResponse;
import com.google.spanner.admin.database.v1.RestoreDatabaseRequest;
import com.google.spanner.admin.database.v1.UpdateBackupRequest;
+import com.google.spanner.admin.database.v1.UpdateBackupScheduleRequest;
import com.google.spanner.admin.database.v1.UpdateDatabaseDdlRequest;
import com.google.spanner.admin.database.v1.UpdateDatabaseRequest;
import io.grpc.stub.StreamObserver;
@@ -505,4 +512,110 @@ public void listDatabaseRoles(
Exception.class.getName())));
}
}
+
+ @Override
+ public void createBackupSchedule(
+ CreateBackupScheduleRequest request, StreamObserver responseObserver) {
+ Object response = responses.poll();
+ if (response instanceof BackupSchedule) {
+ requests.add(request);
+ responseObserver.onNext(((BackupSchedule) response));
+ responseObserver.onCompleted();
+ } else if (response instanceof Exception) {
+ responseObserver.onError(((Exception) response));
+ } else {
+ responseObserver.onError(
+ new IllegalArgumentException(
+ String.format(
+ "Unrecognized response type %s for method CreateBackupSchedule, expected %s or %s",
+ response == null ? "null" : response.getClass().getName(),
+ BackupSchedule.class.getName(),
+ Exception.class.getName())));
+ }
+ }
+
+ @Override
+ public void getBackupSchedule(
+ GetBackupScheduleRequest request, StreamObserver responseObserver) {
+ Object response = responses.poll();
+ if (response instanceof BackupSchedule) {
+ requests.add(request);
+ responseObserver.onNext(((BackupSchedule) response));
+ responseObserver.onCompleted();
+ } else if (response instanceof Exception) {
+ responseObserver.onError(((Exception) response));
+ } else {
+ responseObserver.onError(
+ new IllegalArgumentException(
+ String.format(
+ "Unrecognized response type %s for method GetBackupSchedule, expected %s or %s",
+ response == null ? "null" : response.getClass().getName(),
+ BackupSchedule.class.getName(),
+ Exception.class.getName())));
+ }
+ }
+
+ @Override
+ public void updateBackupSchedule(
+ UpdateBackupScheduleRequest request, StreamObserver responseObserver) {
+ Object response = responses.poll();
+ if (response instanceof BackupSchedule) {
+ requests.add(request);
+ responseObserver.onNext(((BackupSchedule) response));
+ responseObserver.onCompleted();
+ } else if (response instanceof Exception) {
+ responseObserver.onError(((Exception) response));
+ } else {
+ responseObserver.onError(
+ new IllegalArgumentException(
+ String.format(
+ "Unrecognized response type %s for method UpdateBackupSchedule, expected %s or %s",
+ response == null ? "null" : response.getClass().getName(),
+ BackupSchedule.class.getName(),
+ Exception.class.getName())));
+ }
+ }
+
+ @Override
+ public void deleteBackupSchedule(
+ DeleteBackupScheduleRequest request, StreamObserver responseObserver) {
+ Object response = responses.poll();
+ if (response instanceof Empty) {
+ requests.add(request);
+ responseObserver.onNext(((Empty) response));
+ responseObserver.onCompleted();
+ } else if (response instanceof Exception) {
+ responseObserver.onError(((Exception) response));
+ } else {
+ responseObserver.onError(
+ new IllegalArgumentException(
+ String.format(
+ "Unrecognized response type %s for method DeleteBackupSchedule, expected %s or %s",
+ response == null ? "null" : response.getClass().getName(),
+ Empty.class.getName(),
+ Exception.class.getName())));
+ }
+ }
+
+ @Override
+ public void listBackupSchedules(
+ ListBackupSchedulesRequest request,
+ StreamObserver responseObserver) {
+ Object response = responses.poll();
+ if (response instanceof ListBackupSchedulesResponse) {
+ requests.add(request);
+ responseObserver.onNext(((ListBackupSchedulesResponse) response));
+ responseObserver.onCompleted();
+ } else if (response instanceof Exception) {
+ responseObserver.onError(((Exception) response));
+ } else {
+ responseObserver.onError(
+ new IllegalArgumentException(
+ String.format(
+ "Unrecognized response type %s for method ListBackupSchedules, expected %s or %s",
+ response == null ? "null" : response.getClass().getName(),
+ ListBackupSchedulesResponse.class.getName(),
+ Exception.class.getName())));
+ }
+ }
}
diff --git a/grpc-google-cloud-spanner-admin-database-v1/src/main/java/com/google/spanner/admin/database/v1/DatabaseAdminGrpc.java b/grpc-google-cloud-spanner-admin-database-v1/src/main/java/com/google/spanner/admin/database/v1/DatabaseAdminGrpc.java
index 2314cd8965b..01592c14be9 100644
--- a/grpc-google-cloud-spanner-admin-database-v1/src/main/java/com/google/spanner/admin/database/v1/DatabaseAdminGrpc.java
+++ b/grpc-google-cloud-spanner-admin-database-v1/src/main/java/com/google/spanner/admin/database/v1/DatabaseAdminGrpc.java
@@ -943,6 +943,248 @@ private DatabaseAdminGrpc() {}
return getListDatabaseRolesMethod;
}
+ private static volatile io.grpc.MethodDescriptor<
+ com.google.spanner.admin.database.v1.CreateBackupScheduleRequest,
+ com.google.spanner.admin.database.v1.BackupSchedule>
+ getCreateBackupScheduleMethod;
+
+ @io.grpc.stub.annotations.RpcMethod(
+ fullMethodName = SERVICE_NAME + '/' + "CreateBackupSchedule",
+ requestType = com.google.spanner.admin.database.v1.CreateBackupScheduleRequest.class,
+ responseType = com.google.spanner.admin.database.v1.BackupSchedule.class,
+ methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
+ public static io.grpc.MethodDescriptor<
+ com.google.spanner.admin.database.v1.CreateBackupScheduleRequest,
+ com.google.spanner.admin.database.v1.BackupSchedule>
+ getCreateBackupScheduleMethod() {
+ io.grpc.MethodDescriptor<
+ com.google.spanner.admin.database.v1.CreateBackupScheduleRequest,
+ com.google.spanner.admin.database.v1.BackupSchedule>
+ getCreateBackupScheduleMethod;
+ if ((getCreateBackupScheduleMethod = DatabaseAdminGrpc.getCreateBackupScheduleMethod) == null) {
+ synchronized (DatabaseAdminGrpc.class) {
+ if ((getCreateBackupScheduleMethod = DatabaseAdminGrpc.getCreateBackupScheduleMethod)
+ == null) {
+ DatabaseAdminGrpc.getCreateBackupScheduleMethod =
+ getCreateBackupScheduleMethod =
+ io.grpc.MethodDescriptor
+ .
+ newBuilder()
+ .setType(io.grpc.MethodDescriptor.MethodType.UNARY)
+ .setFullMethodName(
+ generateFullMethodName(SERVICE_NAME, "CreateBackupSchedule"))
+ .setSampledToLocalTracing(true)
+ .setRequestMarshaller(
+ io.grpc.protobuf.ProtoUtils.marshaller(
+ com.google.spanner.admin.database.v1.CreateBackupScheduleRequest
+ .getDefaultInstance()))
+ .setResponseMarshaller(
+ io.grpc.protobuf.ProtoUtils.marshaller(
+ com.google.spanner.admin.database.v1.BackupSchedule
+ .getDefaultInstance()))
+ .setSchemaDescriptor(
+ new DatabaseAdminMethodDescriptorSupplier("CreateBackupSchedule"))
+ .build();
+ }
+ }
+ }
+ return getCreateBackupScheduleMethod;
+ }
+
+ private static volatile io.grpc.MethodDescriptor<
+ com.google.spanner.admin.database.v1.GetBackupScheduleRequest,
+ com.google.spanner.admin.database.v1.BackupSchedule>
+ getGetBackupScheduleMethod;
+
+ @io.grpc.stub.annotations.RpcMethod(
+ fullMethodName = SERVICE_NAME + '/' + "GetBackupSchedule",
+ requestType = com.google.spanner.admin.database.v1.GetBackupScheduleRequest.class,
+ responseType = com.google.spanner.admin.database.v1.BackupSchedule.class,
+ methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
+ public static io.grpc.MethodDescriptor<
+ com.google.spanner.admin.database.v1.GetBackupScheduleRequest,
+ com.google.spanner.admin.database.v1.BackupSchedule>
+ getGetBackupScheduleMethod() {
+ io.grpc.MethodDescriptor<
+ com.google.spanner.admin.database.v1.GetBackupScheduleRequest,
+ com.google.spanner.admin.database.v1.BackupSchedule>
+ getGetBackupScheduleMethod;
+ if ((getGetBackupScheduleMethod = DatabaseAdminGrpc.getGetBackupScheduleMethod) == null) {
+ synchronized (DatabaseAdminGrpc.class) {
+ if ((getGetBackupScheduleMethod = DatabaseAdminGrpc.getGetBackupScheduleMethod) == null) {
+ DatabaseAdminGrpc.getGetBackupScheduleMethod =
+ getGetBackupScheduleMethod =
+ io.grpc.MethodDescriptor
+ .
+ newBuilder()
+ .setType(io.grpc.MethodDescriptor.MethodType.UNARY)
+ .setFullMethodName(generateFullMethodName(SERVICE_NAME, "GetBackupSchedule"))
+ .setSampledToLocalTracing(true)
+ .setRequestMarshaller(
+ io.grpc.protobuf.ProtoUtils.marshaller(
+ com.google.spanner.admin.database.v1.GetBackupScheduleRequest
+ .getDefaultInstance()))
+ .setResponseMarshaller(
+ io.grpc.protobuf.ProtoUtils.marshaller(
+ com.google.spanner.admin.database.v1.BackupSchedule
+ .getDefaultInstance()))
+ .setSchemaDescriptor(
+ new DatabaseAdminMethodDescriptorSupplier("GetBackupSchedule"))
+ .build();
+ }
+ }
+ }
+ return getGetBackupScheduleMethod;
+ }
+
+ private static volatile io.grpc.MethodDescriptor<
+ com.google.spanner.admin.database.v1.UpdateBackupScheduleRequest,
+ com.google.spanner.admin.database.v1.BackupSchedule>
+ getUpdateBackupScheduleMethod;
+
+ @io.grpc.stub.annotations.RpcMethod(
+ fullMethodName = SERVICE_NAME + '/' + "UpdateBackupSchedule",
+ requestType = com.google.spanner.admin.database.v1.UpdateBackupScheduleRequest.class,
+ responseType = com.google.spanner.admin.database.v1.BackupSchedule.class,
+ methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
+ public static io.grpc.MethodDescriptor<
+ com.google.spanner.admin.database.v1.UpdateBackupScheduleRequest,
+ com.google.spanner.admin.database.v1.BackupSchedule>
+ getUpdateBackupScheduleMethod() {
+ io.grpc.MethodDescriptor<
+ com.google.spanner.admin.database.v1.UpdateBackupScheduleRequest,
+ com.google.spanner.admin.database.v1.BackupSchedule>
+ getUpdateBackupScheduleMethod;
+ if ((getUpdateBackupScheduleMethod = DatabaseAdminGrpc.getUpdateBackupScheduleMethod) == null) {
+ synchronized (DatabaseAdminGrpc.class) {
+ if ((getUpdateBackupScheduleMethod = DatabaseAdminGrpc.getUpdateBackupScheduleMethod)
+ == null) {
+ DatabaseAdminGrpc.getUpdateBackupScheduleMethod =
+ getUpdateBackupScheduleMethod =
+ io.grpc.MethodDescriptor
+ .
+ newBuilder()
+ .setType(io.grpc.MethodDescriptor.MethodType.UNARY)
+ .setFullMethodName(
+ generateFullMethodName(SERVICE_NAME, "UpdateBackupSchedule"))
+ .setSampledToLocalTracing(true)
+ .setRequestMarshaller(
+ io.grpc.protobuf.ProtoUtils.marshaller(
+ com.google.spanner.admin.database.v1.UpdateBackupScheduleRequest
+ .getDefaultInstance()))
+ .setResponseMarshaller(
+ io.grpc.protobuf.ProtoUtils.marshaller(
+ com.google.spanner.admin.database.v1.BackupSchedule
+ .getDefaultInstance()))
+ .setSchemaDescriptor(
+ new DatabaseAdminMethodDescriptorSupplier("UpdateBackupSchedule"))
+ .build();
+ }
+ }
+ }
+ return getUpdateBackupScheduleMethod;
+ }
+
+ private static volatile io.grpc.MethodDescriptor<
+ com.google.spanner.admin.database.v1.DeleteBackupScheduleRequest,
+ com.google.protobuf.Empty>
+ getDeleteBackupScheduleMethod;
+
+ @io.grpc.stub.annotations.RpcMethod(
+ fullMethodName = SERVICE_NAME + '/' + "DeleteBackupSchedule",
+ requestType = com.google.spanner.admin.database.v1.DeleteBackupScheduleRequest.class,
+ responseType = com.google.protobuf.Empty.class,
+ methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
+ public static io.grpc.MethodDescriptor<
+ com.google.spanner.admin.database.v1.DeleteBackupScheduleRequest,
+ com.google.protobuf.Empty>
+ getDeleteBackupScheduleMethod() {
+ io.grpc.MethodDescriptor<
+ com.google.spanner.admin.database.v1.DeleteBackupScheduleRequest,
+ com.google.protobuf.Empty>
+ getDeleteBackupScheduleMethod;
+ if ((getDeleteBackupScheduleMethod = DatabaseAdminGrpc.getDeleteBackupScheduleMethod) == null) {
+ synchronized (DatabaseAdminGrpc.class) {
+ if ((getDeleteBackupScheduleMethod = DatabaseAdminGrpc.getDeleteBackupScheduleMethod)
+ == null) {
+ DatabaseAdminGrpc.getDeleteBackupScheduleMethod =
+ getDeleteBackupScheduleMethod =
+ io.grpc.MethodDescriptor
+ .
+ newBuilder()
+ .setType(io.grpc.MethodDescriptor.MethodType.UNARY)
+ .setFullMethodName(
+ generateFullMethodName(SERVICE_NAME, "DeleteBackupSchedule"))
+ .setSampledToLocalTracing(true)
+ .setRequestMarshaller(
+ io.grpc.protobuf.ProtoUtils.marshaller(
+ com.google.spanner.admin.database.v1.DeleteBackupScheduleRequest
+ .getDefaultInstance()))
+ .setResponseMarshaller(
+ io.grpc.protobuf.ProtoUtils.marshaller(
+ com.google.protobuf.Empty.getDefaultInstance()))
+ .setSchemaDescriptor(
+ new DatabaseAdminMethodDescriptorSupplier("DeleteBackupSchedule"))
+ .build();
+ }
+ }
+ }
+ return getDeleteBackupScheduleMethod;
+ }
+
+ private static volatile io.grpc.MethodDescriptor<
+ com.google.spanner.admin.database.v1.ListBackupSchedulesRequest,
+ com.google.spanner.admin.database.v1.ListBackupSchedulesResponse>
+ getListBackupSchedulesMethod;
+
+ @io.grpc.stub.annotations.RpcMethod(
+ fullMethodName = SERVICE_NAME + '/' + "ListBackupSchedules",
+ requestType = com.google.spanner.admin.database.v1.ListBackupSchedulesRequest.class,
+ responseType = com.google.spanner.admin.database.v1.ListBackupSchedulesResponse.class,
+ methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
+ public static io.grpc.MethodDescriptor<
+ com.google.spanner.admin.database.v1.ListBackupSchedulesRequest,
+ com.google.spanner.admin.database.v1.ListBackupSchedulesResponse>
+ getListBackupSchedulesMethod() {
+ io.grpc.MethodDescriptor<
+ com.google.spanner.admin.database.v1.ListBackupSchedulesRequest,
+ com.google.spanner.admin.database.v1.ListBackupSchedulesResponse>
+ getListBackupSchedulesMethod;
+ if ((getListBackupSchedulesMethod = DatabaseAdminGrpc.getListBackupSchedulesMethod) == null) {
+ synchronized (DatabaseAdminGrpc.class) {
+ if ((getListBackupSchedulesMethod = DatabaseAdminGrpc.getListBackupSchedulesMethod)
+ == null) {
+ DatabaseAdminGrpc.getListBackupSchedulesMethod =
+ getListBackupSchedulesMethod =
+ io.grpc.MethodDescriptor
+ .
+ newBuilder()
+ .setType(io.grpc.MethodDescriptor.MethodType.UNARY)
+ .setFullMethodName(
+ generateFullMethodName(SERVICE_NAME, "ListBackupSchedules"))
+ .setSampledToLocalTracing(true)
+ .setRequestMarshaller(
+ io.grpc.protobuf.ProtoUtils.marshaller(
+ com.google.spanner.admin.database.v1.ListBackupSchedulesRequest
+ .getDefaultInstance()))
+ .setResponseMarshaller(
+ io.grpc.protobuf.ProtoUtils.marshaller(
+ com.google.spanner.admin.database.v1.ListBackupSchedulesResponse
+ .getDefaultInstance()))
+ .setSchemaDescriptor(
+ new DatabaseAdminMethodDescriptorSupplier("ListBackupSchedules"))
+ .build();
+ }
+ }
+ }
+ return getListBackupSchedulesMethod;
+ }
+
/** Creates a new async stub that supports all call types for the service */
public static DatabaseAdminStub newStub(io.grpc.Channel channel) {
io.grpc.stub.AbstractStub.StubFactory factory =
@@ -1414,6 +1656,81 @@ default void listDatabaseRoles(
io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(
getListDatabaseRolesMethod(), responseObserver);
}
+
+ /**
+ *
+ *
+ *