diff --git a/.gitignore b/.gitignore index 14050d4e4..d4f03a0df 100644 --- a/.gitignore +++ b/.gitignore @@ -12,4 +12,3 @@ system-test/*key.json .DS_Store package-lock.json __pycache__ -.vscode \ No newline at end of file diff --git a/protos/google/spanner/admin/database/v1/backup.proto b/protos/google/spanner/admin/database/v1/backup.proto index bb8ef4d55..f684a4c60 100644 --- a/protos/google/spanner/admin/database/v1/backup.proto +++ b/protos/google/spanner/admin/database/v1/backup.proto @@ -156,6 +156,18 @@ message Backup { // less than `Backup.max_expire_time`. google.protobuf.Timestamp max_expire_time = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. List of backup schedule URIs that are associated with + // creating this backup. This is only applicable for scheduled backups, and + // is empty for on-demand backups. + // + // To optimize for storage, whenever possible, multiple schedules are + // collapsed together to create one backup. In such cases, this field captures + // the list of all backup schedule URIs that are associated with creating + // this backup. If collapsing is not done, then this field captures the + // single backup schedule URI associated with creating this backup. + repeated string backup_schedules = 14 + [(google.api.field_behavior) = OUTPUT_ONLY]; } // The request for @@ -688,3 +700,8 @@ message CopyBackupEncryptionConfig { } ]; } + +// The specification for full backups. +// A full backup stores the entire contents of the database at a given +// version time. +message FullBackupSpec {} diff --git a/protos/google/spanner/admin/database/v1/backup_schedule.proto b/protos/google/spanner/admin/database/v1/backup_schedule.proto new file mode 100644 index 000000000..9ef4587f8 --- /dev/null +++ b/protos/google/spanner/admin/database/v1/backup_schedule.proto @@ -0,0 +1,227 @@ +// Copyright 2024 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.spanner.admin.database.v1; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; +import "google/spanner/admin/database/v1/backup.proto"; + +option csharp_namespace = "Google.Cloud.Spanner.Admin.Database.V1"; +option go_package = "cloud.google.com/go/spanner/admin/database/apiv1/databasepb;databasepb"; +option java_multiple_files = true; +option java_outer_classname = "BackupScheduleProto"; +option java_package = "com.google.spanner.admin.database.v1"; +option php_namespace = "Google\\Cloud\\Spanner\\Admin\\Database\\V1"; +option ruby_package = "Google::Cloud::Spanner::Admin::Database::V1"; + +// Defines specifications of the backup schedule. +message BackupScheduleSpec { + // Required. + oneof schedule_spec { + // Cron style schedule specification. + CrontabSpec cron_spec = 1; + } +} + +// BackupSchedule expresses the automated backup creation specification for a +// Spanner database. +// Next ID: 10 +message BackupSchedule { + option (google.api.resource) = { + type: "spanner.googleapis.com/BackupSchedule" + pattern: "projects/{project}/instances/{instance}/databases/{database}/backupSchedules/{schedule}" + plural: "backupSchedules" + singular: "backupSchedule" + }; + + // Identifier. Output only for the + // [CreateBackupSchedule][DatabaseAdmin.CreateBackupSchededule] operation. + // Required for the + // [UpdateBackupSchedule][google.spanner.admin.database.v1.DatabaseAdmin.UpdateBackupSchedule] + // operation. A globally unique identifier for the backup schedule which + // cannot be changed. Values are of the form + // `projects//instances//databases//backupSchedules/[a-z][a-z0-9_\-]*[a-z0-9]` + // The final segment of the name must be between 2 and 60 characters in + // length. + string name = 1 [(google.api.field_behavior) = IDENTIFIER]; + + // Optional. The schedule specification based on which the backup creations + // are triggered. + BackupScheduleSpec spec = 6 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The retention duration of a backup that must be at least 6 hours + // and at most 366 days. The backup is eligible to be automatically deleted + // once the retention period has elapsed. + google.protobuf.Duration retention_duration = 3 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The encryption configuration that will be used to encrypt the + // backup. If this field is not specified, the backup will use the same + // encryption configuration as the database. + CreateBackupEncryptionConfig encryption_config = 4 + [(google.api.field_behavior) = OPTIONAL]; + + // Required. Backup type spec determines the type of backup that is created by + // the backup schedule. Currently, only full backups are supported. + oneof backup_type_spec { + // The schedule creates only full backups. + FullBackupSpec full_backup_spec = 7; + } + + // Output only. The timestamp at which the schedule was last updated. + // If the schedule has never been updated, this field contains the timestamp + // when the schedule was first created. + google.protobuf.Timestamp update_time = 9 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// CrontabSpec can be used to specify the version time and frequency at +// which the backup should be created. +message CrontabSpec { + // Required. Textual representation of the crontab. User can customize the + // backup frequency and the backup version time using the cron + // expression. The version time must be in UTC timzeone. + // + // The backup will contain an externally consistent copy of the + // database at the version time. Allowed frequencies are 12 hour, 1 day, + // 1 week and 1 month. Examples of valid cron specifications: + // * `0 2/12 * * * ` : every 12 hours at (2, 14) hours past midnight in UTC. + // * `0 2,14 * * * ` : every 12 hours at (2,14) hours past midnight in UTC. + // * `0 2 * * * ` : once a day at 2 past midnight in UTC. + // * `0 2 * * 0 ` : once a week every Sunday at 2 past midnight in UTC. + // * `0 2 8 * * ` : once a month on 8th day at 2 past midnight in UTC. + string text = 1 [(google.api.field_behavior) = REQUIRED]; + + // Output only. The time zone of the times in `CrontabSpec.text`. Currently + // only UTC is supported. + string time_zone = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Schedule backups will contain an externally consistent copy + // of the database at the version time specified in + // `schedule_spec.cron_spec`. However, Spanner may not initiate the creation + // of the scheduled backups at that version time. Spanner will initiate + // the creation of scheduled backups within the time window bounded by the + // version_time specified in `schedule_spec.cron_spec` and version_time + + // `creation_window`. + google.protobuf.Duration creation_window = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// The request for +// [CreateBackupSchedule][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackupSchedule]. +message CreateBackupScheduleRequest { + // Required. The name of the database that this backup schedule applies to. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "spanner.googleapis.com/Database" + } + ]; + + // 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//instances//databases//backupSchedules/`. + string backup_schedule_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The backup schedule to create. + BackupSchedule backup_schedule = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// The request for +// [GetBackupSchedule][google.spanner.admin.database.v1.DatabaseAdmin.GetBackupSchedule]. +message GetBackupScheduleRequest { + // Required. The name of the schedule to retrieve. + // Values are of the form + // `projects//instances//databases//backupSchedules/`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "spanner.googleapis.com/BackupSchedule" + } + ]; +} + +// The request for +// [DeleteBackupSchedule][google.spanner.admin.database.v1.DatabaseAdmin.DeleteBackupSchedule]. +message DeleteBackupScheduleRequest { + // Required. The name of the schedule to delete. + // Values are of the form + // `projects//instances//databases//backupSchedules/`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "spanner.googleapis.com/BackupSchedule" + } + ]; +} + +// The request for +// [ListBackupSchedules][google.spanner.admin.database.v1.DatabaseAdmin.ListBackupSchedules]. +message ListBackupSchedulesRequest { + // Required. Database is the parent resource whose backup schedules should be + // listed. Values are of the form + // projects//instances//databases/ + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "spanner.googleapis.com/Database" + } + ]; + + // Optional. Number of backup schedules to be returned in the response. If 0 + // or less, defaults to the server's maximum allowed page size. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. If non-empty, `page_token` should contain a + // [next_page_token][google.spanner.admin.database.v1.ListBackupSchedulesResponse.next_page_token] + // from a previous + // [ListBackupSchedulesResponse][google.spanner.admin.database.v1.ListBackupSchedulesResponse] + // to the same `parent`. + string page_token = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// The response for +// [ListBackupSchedules][google.spanner.admin.database.v1.DatabaseAdmin.ListBackupSchedules]. +message ListBackupSchedulesResponse { + // The list of backup schedules for a database. + repeated BackupSchedule backup_schedules = 1; + + // `next_page_token` can be sent in a subsequent + // [ListBackupSchedules][google.spanner.admin.database.v1.DatabaseAdmin.ListBackupSchedules] + // call to fetch more of the schedules. + string next_page_token = 2; +} + +// The request for +// [UpdateBackupScheduleRequest][google.spanner.admin.database.v1.DatabaseAdmin.UpdateBackupSchedule]. +message UpdateBackupScheduleRequest { + // 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. + BackupSchedule backup_schedule = 1 [(google.api.field_behavior) = REQUIRED]; + + // 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. + google.protobuf.FieldMask update_mask = 2 + [(google.api.field_behavior) = REQUIRED]; +} diff --git a/protos/google/spanner/admin/database/v1/spanner_database_admin.proto b/protos/google/spanner/admin/database/v1/spanner_database_admin.proto index 0d4e26170..5df142403 100644 --- a/protos/google/spanner/admin/database/v1/spanner_database_admin.proto +++ b/protos/google/spanner/admin/database/v1/spanner_database_admin.proto @@ -27,6 +27,7 @@ import "google/protobuf/empty.proto"; import "google/protobuf/field_mask.proto"; import "google/protobuf/timestamp.proto"; import "google/spanner/admin/database/v1/backup.proto"; +import "google/spanner/admin/database/v1/backup_schedule.proto"; import "google/spanner/admin/database/v1/common.proto"; option csharp_namespace = "Google.Cloud.Spanner.Admin.Database.V1"; @@ -199,6 +200,10 @@ service DatabaseAdmin { post: "/v1/{resource=projects/*/instances/*/backups/*}:setIamPolicy" body: "*" } + additional_bindings { + post: "/v1/{resource=projects/*/instances/*/databases/*/backupSchedules/*}:setIamPolicy" + body: "*" + } }; option (google.api.method_signature) = "resource,policy"; } @@ -220,6 +225,10 @@ service DatabaseAdmin { post: "/v1/{resource=projects/*/instances/*/backups/*}:getIamPolicy" body: "*" } + additional_bindings { + post: "/v1/{resource=projects/*/instances/*/databases/*/backupSchedules/*}:getIamPolicy" + body: "*" + } }; option (google.api.method_signature) = "resource"; } @@ -243,6 +252,10 @@ service DatabaseAdmin { post: "/v1/{resource=projects/*/instances/*/backups/*}:testIamPermissions" body: "*" } + additional_bindings { + post: "/v1/{resource=projects/*/instances/*/databases/*/backupSchedules/*}:testIamPermissions" + body: "*" + } additional_bindings { post: "/v1/{resource=projects/*/instances/*/databases/*/databaseRoles/*}:testIamPermissions" body: "*" @@ -411,6 +424,53 @@ service DatabaseAdmin { }; option (google.api.method_signature) = "parent"; } + + // Creates a new backup schedule. + rpc CreateBackupSchedule(CreateBackupScheduleRequest) + returns (BackupSchedule) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/instances/*/databases/*}/backupSchedules" + body: "backup_schedule" + }; + option (google.api.method_signature) = + "parent,backup_schedule,backup_schedule_id"; + } + + // Gets backup schedule for the input schedule name. + rpc GetBackupSchedule(GetBackupScheduleRequest) returns (BackupSchedule) { + option (google.api.http) = { + get: "/v1/{name=projects/*/instances/*/databases/*/backupSchedules/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Updates a backup schedule. + rpc UpdateBackupSchedule(UpdateBackupScheduleRequest) + returns (BackupSchedule) { + option (google.api.http) = { + patch: "/v1/{backup_schedule.name=projects/*/instances/*/databases/*/backupSchedules/*}" + body: "backup_schedule" + }; + option (google.api.method_signature) = "backup_schedule,update_mask"; + } + + // Deletes a backup schedule. + rpc DeleteBackupSchedule(DeleteBackupScheduleRequest) + returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/instances/*/databases/*/backupSchedules/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Lists all the backup schedules for the database. + rpc ListBackupSchedules(ListBackupSchedulesRequest) + returns (ListBackupSchedulesResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/instances/*/databases/*}/backupSchedules" + }; + option (google.api.method_signature) = "parent"; + } } // Information about the database restore. diff --git a/protos/google/spanner/executor/v1/cloud_executor.proto b/protos/google/spanner/executor/v1/cloud_executor.proto index 73474a650..05d662a5a 100644 --- a/protos/google/spanner/executor/v1/cloud_executor.proto +++ b/protos/google/spanner/executor/v1/cloud_executor.proto @@ -132,6 +132,9 @@ message SpannerAction { // Action to execute change stream query. ExecuteChangeStreamQuery execute_change_stream_query = 50; + + // Query cancellation action for testing the cancellation of a query. + QueryCancellationAction query_cancellation = 51; } } @@ -1048,6 +1051,16 @@ message GetOperationAction { string operation = 1; } +// Query cancellation action defines the long running query and the cancel query +// format depening on the Cloud database dialect. +message QueryCancellationAction { + // Long running query. + string long_running_sql = 1; + + // Format of the cancel query for the cloud database dialect. + string cancel_query = 2; +} + // Action that cancels an operation. message CancelOperationAction { // The name of the operation resource to be cancelled. diff --git a/protos/google/spanner/v1/spanner.proto b/protos/google/spanner/v1/spanner.proto index 25c67f155..301139210 100644 --- a/protos/google/spanner/v1/spanner.proto +++ b/protos/google/spanner/v1/spanner.proto @@ -1043,6 +1043,71 @@ message PartitionResponse { // The request for [Read][google.spanner.v1.Spanner.Read] and // [StreamingRead][google.spanner.v1.Spanner.StreamingRead]. message ReadRequest { + // An option to control the order in which rows are returned from a read. + enum OrderBy { + // Default value. + // + // ORDER_BY_UNSPECIFIED is equivalent to ORDER_BY_PRIMARY_KEY. + ORDER_BY_UNSPECIFIED = 0; + + // Read rows are returned in primary key order. + // + // In the event that this option is used in conjunction with the + // `partition_token` field, the API will return an `INVALID_ARGUMENT` error. + ORDER_BY_PRIMARY_KEY = 1; + + // Read rows are returned in any order. + ORDER_BY_NO_ORDER = 2; + } + + // A lock hint mechanism for reads done within a transaction. + enum LockHint { + // Default value. + // + // LOCK_HINT_UNSPECIFIED is equivalent to LOCK_HINT_SHARED. + LOCK_HINT_UNSPECIFIED = 0; + + // Acquire shared locks. + // + // By default when you perform a read as part of a read-write transaction, + // Spanner acquires shared read locks, which allows other reads to still + // access the data until your transaction is ready to commit. When your + // transaction is committing and writes are being applied, the transaction + // attempts to upgrade to an exclusive lock for any data you are writing. + // For more information about locks, see [Lock + // modes](https://cloud.google.com/spanner/docs/introspection/lock-statistics#explain-lock-modes). + LOCK_HINT_SHARED = 1; + + // Acquire exclusive locks. + // + // Requesting exclusive locks is beneficial if you observe high write + // contention, which means you notice that multiple transactions are + // concurrently trying to read and write to the same data, resulting in a + // large number of aborts. This problem occurs when two transactions + // initially acquire shared locks and then both try to upgrade to exclusive + // locks at the same time. In this situation both transactions are waiting + // for the other to give up their lock, resulting in a deadlocked situation. + // Spanner is able to detect this occurring and force one of the + // transactions to abort. However, this is a slow and expensive operation + // and results in lower performance. In this case it makes sense to acquire + // exclusive locks at the start of the transaction because then when + // multiple transactions try to act on the same data, they automatically get + // serialized. Each transaction waits its turn to acquire the lock and + // avoids getting into deadlock situations. + // + // Because the exclusive lock hint is just a hint, it should not be + // considered equivalent to a mutex. In other words, you should not use + // Spanner exclusive locks as a mutual exclusion mechanism for the execution + // of code outside of Spanner. + // + // **Note:** Request exclusive locks judiciously because they block others + // from reading that data for the entire transaction, rather than just when + // the writes are being performed. Unless you observe high write contention, + // you should use the default of shared read locks so you don't prematurely + // block other clients from reading the data that you're writing to. + LOCK_HINT_EXCLUSIVE = 2; + } + // Required. The session in which the read should be performed. string session = 1 [ (google.api.field_behavior) = REQUIRED, @@ -1117,6 +1182,19 @@ message ReadRequest { // If the field is set to `true` but the request does not set // `partition_token`, the API returns an `INVALID_ARGUMENT` error. bool data_boost_enabled = 15; + + // Optional. Order for the returned rows. + // + // By default, Spanner will return result rows in primary key order except for + // PartitionRead requests. For applications that do not require rows to be + // returned in primary key (`ORDER_BY_PRIMARY_KEY`) order, setting + // `ORDER_BY_NO_ORDER` option allows Spanner to optimize row retrieval, + // resulting in lower latencies in certain cases (e.g. bulk point lookups). + OrderBy order_by = 16 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Lock Hint for the request, it can only be used with read-write + // transactions. + LockHint lock_hint = 17 [(google.api.field_behavior) = OPTIONAL]; } // The request for diff --git a/protos/protos.d.ts b/protos/protos.d.ts index 0003e5dd4..faebebfe6 100644 --- a/protos/protos.d.ts +++ b/protos/protos.d.ts @@ -6569,6 +6569,9 @@ export namespace google { /** Backup maxExpireTime */ maxExpireTime?: (google.protobuf.ITimestamp|null); + + /** Backup backupSchedules */ + backupSchedules?: (string[]|null); } /** Represents a Backup. */ @@ -6619,6 +6622,9 @@ export namespace google { /** Backup maxExpireTime. */ public maxExpireTime?: (google.protobuf.ITimestamp|null); + /** Backup backupSchedules. */ + public backupSchedules: string[]; + /** * Creates a new Backup instance using the specified properties. * @param [properties] Properties to set @@ -8261,6 +8267,97 @@ export namespace google { } } + /** Properties of a FullBackupSpec. */ + interface IFullBackupSpec { + } + + /** Represents a FullBackupSpec. */ + class FullBackupSpec implements IFullBackupSpec { + + /** + * Constructs a new FullBackupSpec. + * @param [properties] Properties to set + */ + constructor(properties?: google.spanner.admin.database.v1.IFullBackupSpec); + + /** + * Creates a new FullBackupSpec instance using the specified properties. + * @param [properties] Properties to set + * @returns FullBackupSpec instance + */ + public static create(properties?: google.spanner.admin.database.v1.IFullBackupSpec): google.spanner.admin.database.v1.FullBackupSpec; + + /** + * Encodes the specified FullBackupSpec message. Does not implicitly {@link google.spanner.admin.database.v1.FullBackupSpec.verify|verify} messages. + * @param message FullBackupSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.spanner.admin.database.v1.IFullBackupSpec, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FullBackupSpec message, length delimited. Does not implicitly {@link google.spanner.admin.database.v1.FullBackupSpec.verify|verify} messages. + * @param message FullBackupSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.spanner.admin.database.v1.IFullBackupSpec, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FullBackupSpec message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FullBackupSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.spanner.admin.database.v1.FullBackupSpec; + + /** + * Decodes a FullBackupSpec message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FullBackupSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.spanner.admin.database.v1.FullBackupSpec; + + /** + * Verifies a FullBackupSpec message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FullBackupSpec message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FullBackupSpec + */ + public static fromObject(object: { [k: string]: any }): google.spanner.admin.database.v1.FullBackupSpec; + + /** + * Creates a plain object from a FullBackupSpec message. Also converts values to other types if specified. + * @param message FullBackupSpec + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.spanner.admin.database.v1.FullBackupSpec, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FullBackupSpec to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FullBackupSpec + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + /** Properties of an OperationProgress. */ interface IOperationProgress { @@ -8305,300 +8402,1257 @@ export namespace google { * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.spanner.admin.database.v1.IOperationProgress, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.spanner.admin.database.v1.IOperationProgress, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified OperationProgress message, length delimited. Does not implicitly {@link google.spanner.admin.database.v1.OperationProgress.verify|verify} messages. + * @param message OperationProgress message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.spanner.admin.database.v1.IOperationProgress, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an OperationProgress message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns OperationProgress + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.spanner.admin.database.v1.OperationProgress; + + /** + * Decodes an OperationProgress message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns OperationProgress + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.spanner.admin.database.v1.OperationProgress; + + /** + * Verifies an OperationProgress message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an OperationProgress message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns OperationProgress + */ + public static fromObject(object: { [k: string]: any }): google.spanner.admin.database.v1.OperationProgress; + + /** + * Creates a plain object from an OperationProgress message. Also converts values to other types if specified. + * @param message OperationProgress + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.spanner.admin.database.v1.OperationProgress, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this OperationProgress to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for OperationProgress + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an EncryptionConfig. */ + interface IEncryptionConfig { + + /** EncryptionConfig kmsKeyName */ + kmsKeyName?: (string|null); + + /** EncryptionConfig kmsKeyNames */ + kmsKeyNames?: (string[]|null); + } + + /** Represents an EncryptionConfig. */ + class EncryptionConfig implements IEncryptionConfig { + + /** + * Constructs a new EncryptionConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.spanner.admin.database.v1.IEncryptionConfig); + + /** EncryptionConfig kmsKeyName. */ + public kmsKeyName: string; + + /** EncryptionConfig kmsKeyNames. */ + public kmsKeyNames: string[]; + + /** + * Creates a new EncryptionConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns EncryptionConfig instance + */ + public static create(properties?: google.spanner.admin.database.v1.IEncryptionConfig): google.spanner.admin.database.v1.EncryptionConfig; + + /** + * Encodes the specified EncryptionConfig message. Does not implicitly {@link google.spanner.admin.database.v1.EncryptionConfig.verify|verify} messages. + * @param message EncryptionConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.spanner.admin.database.v1.IEncryptionConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EncryptionConfig message, length delimited. Does not implicitly {@link google.spanner.admin.database.v1.EncryptionConfig.verify|verify} messages. + * @param message EncryptionConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.spanner.admin.database.v1.IEncryptionConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an EncryptionConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns EncryptionConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.spanner.admin.database.v1.EncryptionConfig; + + /** + * Decodes an EncryptionConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns EncryptionConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.spanner.admin.database.v1.EncryptionConfig; + + /** + * Verifies an EncryptionConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an EncryptionConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns EncryptionConfig + */ + public static fromObject(object: { [k: string]: any }): google.spanner.admin.database.v1.EncryptionConfig; + + /** + * Creates a plain object from an EncryptionConfig message. Also converts values to other types if specified. + * @param message EncryptionConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.spanner.admin.database.v1.EncryptionConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EncryptionConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for EncryptionConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an EncryptionInfo. */ + interface IEncryptionInfo { + + /** EncryptionInfo encryptionType */ + encryptionType?: (google.spanner.admin.database.v1.EncryptionInfo.Type|keyof typeof google.spanner.admin.database.v1.EncryptionInfo.Type|null); + + /** EncryptionInfo encryptionStatus */ + encryptionStatus?: (google.rpc.IStatus|null); + + /** EncryptionInfo kmsKeyVersion */ + kmsKeyVersion?: (string|null); + } + + /** Represents an EncryptionInfo. */ + class EncryptionInfo implements IEncryptionInfo { + + /** + * Constructs a new EncryptionInfo. + * @param [properties] Properties to set + */ + constructor(properties?: google.spanner.admin.database.v1.IEncryptionInfo); + + /** EncryptionInfo encryptionType. */ + public encryptionType: (google.spanner.admin.database.v1.EncryptionInfo.Type|keyof typeof google.spanner.admin.database.v1.EncryptionInfo.Type); + + /** EncryptionInfo encryptionStatus. */ + public encryptionStatus?: (google.rpc.IStatus|null); + + /** EncryptionInfo kmsKeyVersion. */ + public kmsKeyVersion: string; + + /** + * Creates a new EncryptionInfo instance using the specified properties. + * @param [properties] Properties to set + * @returns EncryptionInfo instance + */ + public static create(properties?: google.spanner.admin.database.v1.IEncryptionInfo): google.spanner.admin.database.v1.EncryptionInfo; + + /** + * Encodes the specified EncryptionInfo message. Does not implicitly {@link google.spanner.admin.database.v1.EncryptionInfo.verify|verify} messages. + * @param message EncryptionInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.spanner.admin.database.v1.IEncryptionInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EncryptionInfo message, length delimited. Does not implicitly {@link google.spanner.admin.database.v1.EncryptionInfo.verify|verify} messages. + * @param message EncryptionInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.spanner.admin.database.v1.IEncryptionInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an EncryptionInfo message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns EncryptionInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.spanner.admin.database.v1.EncryptionInfo; + + /** + * Decodes an EncryptionInfo message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns EncryptionInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.spanner.admin.database.v1.EncryptionInfo; + + /** + * Verifies an EncryptionInfo message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an EncryptionInfo message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns EncryptionInfo + */ + public static fromObject(object: { [k: string]: any }): google.spanner.admin.database.v1.EncryptionInfo; + + /** + * Creates a plain object from an EncryptionInfo message. Also converts values to other types if specified. + * @param message EncryptionInfo + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.spanner.admin.database.v1.EncryptionInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EncryptionInfo to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for EncryptionInfo + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace EncryptionInfo { + + /** Type enum. */ + enum Type { + TYPE_UNSPECIFIED = 0, + GOOGLE_DEFAULT_ENCRYPTION = 1, + CUSTOMER_MANAGED_ENCRYPTION = 2 + } + } + + /** DatabaseDialect enum. */ + enum DatabaseDialect { + DATABASE_DIALECT_UNSPECIFIED = 0, + GOOGLE_STANDARD_SQL = 1, + POSTGRESQL = 2 + } + + /** Properties of a BackupScheduleSpec. */ + interface IBackupScheduleSpec { + + /** BackupScheduleSpec cronSpec */ + cronSpec?: (google.spanner.admin.database.v1.ICrontabSpec|null); + } + + /** Represents a BackupScheduleSpec. */ + class BackupScheduleSpec implements IBackupScheduleSpec { + + /** + * Constructs a new BackupScheduleSpec. + * @param [properties] Properties to set + */ + constructor(properties?: google.spanner.admin.database.v1.IBackupScheduleSpec); + + /** BackupScheduleSpec cronSpec. */ + public cronSpec?: (google.spanner.admin.database.v1.ICrontabSpec|null); + + /** BackupScheduleSpec scheduleSpec. */ + public scheduleSpec?: "cronSpec"; + + /** + * Creates a new BackupScheduleSpec instance using the specified properties. + * @param [properties] Properties to set + * @returns BackupScheduleSpec instance + */ + public static create(properties?: google.spanner.admin.database.v1.IBackupScheduleSpec): google.spanner.admin.database.v1.BackupScheduleSpec; + + /** + * Encodes the specified BackupScheduleSpec message. Does not implicitly {@link google.spanner.admin.database.v1.BackupScheduleSpec.verify|verify} messages. + * @param message BackupScheduleSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.spanner.admin.database.v1.IBackupScheduleSpec, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BackupScheduleSpec message, length delimited. Does not implicitly {@link google.spanner.admin.database.v1.BackupScheduleSpec.verify|verify} messages. + * @param message BackupScheduleSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.spanner.admin.database.v1.IBackupScheduleSpec, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BackupScheduleSpec message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BackupScheduleSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.spanner.admin.database.v1.BackupScheduleSpec; + + /** + * Decodes a BackupScheduleSpec message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BackupScheduleSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.spanner.admin.database.v1.BackupScheduleSpec; + + /** + * Verifies a BackupScheduleSpec message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BackupScheduleSpec message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BackupScheduleSpec + */ + public static fromObject(object: { [k: string]: any }): google.spanner.admin.database.v1.BackupScheduleSpec; + + /** + * Creates a plain object from a BackupScheduleSpec message. Also converts values to other types if specified. + * @param message BackupScheduleSpec + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.spanner.admin.database.v1.BackupScheduleSpec, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BackupScheduleSpec to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BackupScheduleSpec + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a BackupSchedule. */ + interface IBackupSchedule { + + /** BackupSchedule name */ + name?: (string|null); + + /** BackupSchedule spec */ + spec?: (google.spanner.admin.database.v1.IBackupScheduleSpec|null); + + /** BackupSchedule retentionDuration */ + retentionDuration?: (google.protobuf.IDuration|null); + + /** BackupSchedule encryptionConfig */ + encryptionConfig?: (google.spanner.admin.database.v1.ICreateBackupEncryptionConfig|null); + + /** BackupSchedule fullBackupSpec */ + fullBackupSpec?: (google.spanner.admin.database.v1.IFullBackupSpec|null); + + /** BackupSchedule updateTime */ + updateTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents a BackupSchedule. */ + class BackupSchedule implements IBackupSchedule { + + /** + * Constructs a new BackupSchedule. + * @param [properties] Properties to set + */ + constructor(properties?: google.spanner.admin.database.v1.IBackupSchedule); + + /** BackupSchedule name. */ + public name: string; + + /** BackupSchedule spec. */ + public spec?: (google.spanner.admin.database.v1.IBackupScheduleSpec|null); + + /** BackupSchedule retentionDuration. */ + public retentionDuration?: (google.protobuf.IDuration|null); + + /** BackupSchedule encryptionConfig. */ + public encryptionConfig?: (google.spanner.admin.database.v1.ICreateBackupEncryptionConfig|null); + + /** BackupSchedule fullBackupSpec. */ + public fullBackupSpec?: (google.spanner.admin.database.v1.IFullBackupSpec|null); + + /** BackupSchedule updateTime. */ + public updateTime?: (google.protobuf.ITimestamp|null); + + /** BackupSchedule backupTypeSpec. */ + public backupTypeSpec?: "fullBackupSpec"; + + /** + * Creates a new BackupSchedule instance using the specified properties. + * @param [properties] Properties to set + * @returns BackupSchedule instance + */ + public static create(properties?: google.spanner.admin.database.v1.IBackupSchedule): google.spanner.admin.database.v1.BackupSchedule; + + /** + * Encodes the specified BackupSchedule message. Does not implicitly {@link google.spanner.admin.database.v1.BackupSchedule.verify|verify} messages. + * @param message BackupSchedule message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.spanner.admin.database.v1.IBackupSchedule, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BackupSchedule message, length delimited. Does not implicitly {@link google.spanner.admin.database.v1.BackupSchedule.verify|verify} messages. + * @param message BackupSchedule message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.spanner.admin.database.v1.IBackupSchedule, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BackupSchedule message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BackupSchedule + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.spanner.admin.database.v1.BackupSchedule; + + /** + * Decodes a BackupSchedule message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BackupSchedule + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.spanner.admin.database.v1.BackupSchedule; + + /** + * Verifies a BackupSchedule message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BackupSchedule message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BackupSchedule + */ + public static fromObject(object: { [k: string]: any }): google.spanner.admin.database.v1.BackupSchedule; + + /** + * Creates a plain object from a BackupSchedule message. Also converts values to other types if specified. + * @param message BackupSchedule + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.spanner.admin.database.v1.BackupSchedule, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BackupSchedule to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BackupSchedule + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a CrontabSpec. */ + interface ICrontabSpec { + + /** CrontabSpec text */ + text?: (string|null); + + /** CrontabSpec timeZone */ + timeZone?: (string|null); + + /** CrontabSpec creationWindow */ + creationWindow?: (google.protobuf.IDuration|null); + } + + /** Represents a CrontabSpec. */ + class CrontabSpec implements ICrontabSpec { + + /** + * Constructs a new CrontabSpec. + * @param [properties] Properties to set + */ + constructor(properties?: google.spanner.admin.database.v1.ICrontabSpec); + + /** CrontabSpec text. */ + public text: string; + + /** CrontabSpec timeZone. */ + public timeZone: string; + + /** CrontabSpec creationWindow. */ + public creationWindow?: (google.protobuf.IDuration|null); + + /** + * Creates a new CrontabSpec instance using the specified properties. + * @param [properties] Properties to set + * @returns CrontabSpec instance + */ + public static create(properties?: google.spanner.admin.database.v1.ICrontabSpec): google.spanner.admin.database.v1.CrontabSpec; + + /** + * Encodes the specified CrontabSpec message. Does not implicitly {@link google.spanner.admin.database.v1.CrontabSpec.verify|verify} messages. + * @param message CrontabSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.spanner.admin.database.v1.ICrontabSpec, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CrontabSpec message, length delimited. Does not implicitly {@link google.spanner.admin.database.v1.CrontabSpec.verify|verify} messages. + * @param message CrontabSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.spanner.admin.database.v1.ICrontabSpec, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CrontabSpec message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CrontabSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.spanner.admin.database.v1.CrontabSpec; + + /** + * Decodes a CrontabSpec message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CrontabSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.spanner.admin.database.v1.CrontabSpec; + + /** + * Verifies a CrontabSpec message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CrontabSpec message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CrontabSpec + */ + public static fromObject(object: { [k: string]: any }): google.spanner.admin.database.v1.CrontabSpec; + + /** + * Creates a plain object from a CrontabSpec message. Also converts values to other types if specified. + * @param message CrontabSpec + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.spanner.admin.database.v1.CrontabSpec, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CrontabSpec to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CrontabSpec + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a CreateBackupScheduleRequest. */ + interface ICreateBackupScheduleRequest { + + /** CreateBackupScheduleRequest parent */ + parent?: (string|null); + + /** CreateBackupScheduleRequest backupScheduleId */ + backupScheduleId?: (string|null); + + /** CreateBackupScheduleRequest backupSchedule */ + backupSchedule?: (google.spanner.admin.database.v1.IBackupSchedule|null); + } + + /** Represents a CreateBackupScheduleRequest. */ + class CreateBackupScheduleRequest implements ICreateBackupScheduleRequest { + + /** + * Constructs a new CreateBackupScheduleRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.spanner.admin.database.v1.ICreateBackupScheduleRequest); + + /** CreateBackupScheduleRequest parent. */ + public parent: string; + + /** CreateBackupScheduleRequest backupScheduleId. */ + public backupScheduleId: string; + + /** CreateBackupScheduleRequest backupSchedule. */ + public backupSchedule?: (google.spanner.admin.database.v1.IBackupSchedule|null); + + /** + * Creates a new CreateBackupScheduleRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateBackupScheduleRequest instance + */ + public static create(properties?: google.spanner.admin.database.v1.ICreateBackupScheduleRequest): google.spanner.admin.database.v1.CreateBackupScheduleRequest; + + /** + * Encodes the specified CreateBackupScheduleRequest message. Does not implicitly {@link google.spanner.admin.database.v1.CreateBackupScheduleRequest.verify|verify} messages. + * @param message CreateBackupScheduleRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.spanner.admin.database.v1.ICreateBackupScheduleRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateBackupScheduleRequest message, length delimited. Does not implicitly {@link google.spanner.admin.database.v1.CreateBackupScheduleRequest.verify|verify} messages. + * @param message CreateBackupScheduleRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.spanner.admin.database.v1.ICreateBackupScheduleRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateBackupScheduleRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateBackupScheduleRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.spanner.admin.database.v1.CreateBackupScheduleRequest; + + /** + * Decodes a CreateBackupScheduleRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateBackupScheduleRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.spanner.admin.database.v1.CreateBackupScheduleRequest; + + /** + * Verifies a CreateBackupScheduleRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CreateBackupScheduleRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateBackupScheduleRequest + */ + public static fromObject(object: { [k: string]: any }): google.spanner.admin.database.v1.CreateBackupScheduleRequest; + + /** + * Creates a plain object from a CreateBackupScheduleRequest message. Also converts values to other types if specified. + * @param message CreateBackupScheduleRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.spanner.admin.database.v1.CreateBackupScheduleRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateBackupScheduleRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CreateBackupScheduleRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a GetBackupScheduleRequest. */ + interface IGetBackupScheduleRequest { + + /** GetBackupScheduleRequest name */ + name?: (string|null); + } + + /** Represents a GetBackupScheduleRequest. */ + class GetBackupScheduleRequest implements IGetBackupScheduleRequest { + + /** + * Constructs a new GetBackupScheduleRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.spanner.admin.database.v1.IGetBackupScheduleRequest); + + /** GetBackupScheduleRequest name. */ + public name: string; + + /** + * Creates a new GetBackupScheduleRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetBackupScheduleRequest instance + */ + public static create(properties?: google.spanner.admin.database.v1.IGetBackupScheduleRequest): google.spanner.admin.database.v1.GetBackupScheduleRequest; + + /** + * Encodes the specified GetBackupScheduleRequest message. Does not implicitly {@link google.spanner.admin.database.v1.GetBackupScheduleRequest.verify|verify} messages. + * @param message GetBackupScheduleRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.spanner.admin.database.v1.IGetBackupScheduleRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetBackupScheduleRequest message, length delimited. Does not implicitly {@link google.spanner.admin.database.v1.GetBackupScheduleRequest.verify|verify} messages. + * @param message GetBackupScheduleRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.spanner.admin.database.v1.IGetBackupScheduleRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetBackupScheduleRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetBackupScheduleRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.spanner.admin.database.v1.GetBackupScheduleRequest; + + /** + * Decodes a GetBackupScheduleRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetBackupScheduleRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.spanner.admin.database.v1.GetBackupScheduleRequest; + + /** + * Verifies a GetBackupScheduleRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetBackupScheduleRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetBackupScheduleRequest + */ + public static fromObject(object: { [k: string]: any }): google.spanner.admin.database.v1.GetBackupScheduleRequest; + + /** + * Creates a plain object from a GetBackupScheduleRequest message. Also converts values to other types if specified. + * @param message GetBackupScheduleRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.spanner.admin.database.v1.GetBackupScheduleRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetBackupScheduleRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetBackupScheduleRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DeleteBackupScheduleRequest. */ + interface IDeleteBackupScheduleRequest { + + /** DeleteBackupScheduleRequest name */ + name?: (string|null); + } + + /** Represents a DeleteBackupScheduleRequest. */ + class DeleteBackupScheduleRequest implements IDeleteBackupScheduleRequest { + + /** + * Constructs a new DeleteBackupScheduleRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.spanner.admin.database.v1.IDeleteBackupScheduleRequest); + + /** DeleteBackupScheduleRequest name. */ + public name: string; + + /** + * Creates a new DeleteBackupScheduleRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteBackupScheduleRequest instance + */ + public static create(properties?: google.spanner.admin.database.v1.IDeleteBackupScheduleRequest): google.spanner.admin.database.v1.DeleteBackupScheduleRequest; + + /** + * Encodes the specified DeleteBackupScheduleRequest message. Does not implicitly {@link google.spanner.admin.database.v1.DeleteBackupScheduleRequest.verify|verify} messages. + * @param message DeleteBackupScheduleRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.spanner.admin.database.v1.IDeleteBackupScheduleRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteBackupScheduleRequest message, length delimited. Does not implicitly {@link google.spanner.admin.database.v1.DeleteBackupScheduleRequest.verify|verify} messages. + * @param message DeleteBackupScheduleRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.spanner.admin.database.v1.IDeleteBackupScheduleRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteBackupScheduleRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteBackupScheduleRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.spanner.admin.database.v1.DeleteBackupScheduleRequest; + + /** + * Decodes a DeleteBackupScheduleRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteBackupScheduleRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.spanner.admin.database.v1.DeleteBackupScheduleRequest; + + /** + * Verifies a DeleteBackupScheduleRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DeleteBackupScheduleRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteBackupScheduleRequest + */ + public static fromObject(object: { [k: string]: any }): google.spanner.admin.database.v1.DeleteBackupScheduleRequest; + + /** + * Creates a plain object from a DeleteBackupScheduleRequest message. Also converts values to other types if specified. + * @param message DeleteBackupScheduleRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.spanner.admin.database.v1.DeleteBackupScheduleRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteBackupScheduleRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DeleteBackupScheduleRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListBackupSchedulesRequest. */ + interface IListBackupSchedulesRequest { + + /** ListBackupSchedulesRequest parent */ + parent?: (string|null); + + /** ListBackupSchedulesRequest pageSize */ + pageSize?: (number|null); + + /** ListBackupSchedulesRequest pageToken */ + pageToken?: (string|null); + } + + /** Represents a ListBackupSchedulesRequest. */ + class ListBackupSchedulesRequest implements IListBackupSchedulesRequest { + + /** + * Constructs a new ListBackupSchedulesRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.spanner.admin.database.v1.IListBackupSchedulesRequest); + + /** ListBackupSchedulesRequest parent. */ + public parent: string; + + /** ListBackupSchedulesRequest pageSize. */ + public pageSize: number; + + /** ListBackupSchedulesRequest pageToken. */ + public pageToken: string; + + /** + * Creates a new ListBackupSchedulesRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListBackupSchedulesRequest instance + */ + public static create(properties?: google.spanner.admin.database.v1.IListBackupSchedulesRequest): google.spanner.admin.database.v1.ListBackupSchedulesRequest; + + /** + * Encodes the specified ListBackupSchedulesRequest message. Does not implicitly {@link google.spanner.admin.database.v1.ListBackupSchedulesRequest.verify|verify} messages. + * @param message ListBackupSchedulesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.spanner.admin.database.v1.IListBackupSchedulesRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified OperationProgress message, length delimited. Does not implicitly {@link google.spanner.admin.database.v1.OperationProgress.verify|verify} messages. - * @param message OperationProgress message or plain object to encode + * Encodes the specified ListBackupSchedulesRequest message, length delimited. Does not implicitly {@link google.spanner.admin.database.v1.ListBackupSchedulesRequest.verify|verify} messages. + * @param message ListBackupSchedulesRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.spanner.admin.database.v1.IOperationProgress, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.spanner.admin.database.v1.IListBackupSchedulesRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an OperationProgress message from the specified reader or buffer. + * Decodes a ListBackupSchedulesRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns OperationProgress + * @returns ListBackupSchedulesRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.spanner.admin.database.v1.OperationProgress; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.spanner.admin.database.v1.ListBackupSchedulesRequest; /** - * Decodes an OperationProgress message from the specified reader or buffer, length delimited. + * Decodes a ListBackupSchedulesRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns OperationProgress + * @returns ListBackupSchedulesRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.spanner.admin.database.v1.OperationProgress; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.spanner.admin.database.v1.ListBackupSchedulesRequest; /** - * Verifies an OperationProgress message. + * Verifies a ListBackupSchedulesRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates an OperationProgress message from a plain object. Also converts values to their respective internal types. + * Creates a ListBackupSchedulesRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns OperationProgress + * @returns ListBackupSchedulesRequest */ - public static fromObject(object: { [k: string]: any }): google.spanner.admin.database.v1.OperationProgress; + public static fromObject(object: { [k: string]: any }): google.spanner.admin.database.v1.ListBackupSchedulesRequest; /** - * Creates a plain object from an OperationProgress message. Also converts values to other types if specified. - * @param message OperationProgress + * Creates a plain object from a ListBackupSchedulesRequest message. Also converts values to other types if specified. + * @param message ListBackupSchedulesRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.spanner.admin.database.v1.OperationProgress, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.spanner.admin.database.v1.ListBackupSchedulesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this OperationProgress to JSON. + * Converts this ListBackupSchedulesRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; /** - * Gets the default type url for OperationProgress + * Gets the default type url for ListBackupSchedulesRequest * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns The default type url */ public static getTypeUrl(typeUrlPrefix?: string): string; } - /** Properties of an EncryptionConfig. */ - interface IEncryptionConfig { + /** Properties of a ListBackupSchedulesResponse. */ + interface IListBackupSchedulesResponse { - /** EncryptionConfig kmsKeyName */ - kmsKeyName?: (string|null); + /** ListBackupSchedulesResponse backupSchedules */ + backupSchedules?: (google.spanner.admin.database.v1.IBackupSchedule[]|null); - /** EncryptionConfig kmsKeyNames */ - kmsKeyNames?: (string[]|null); + /** ListBackupSchedulesResponse nextPageToken */ + nextPageToken?: (string|null); } - /** Represents an EncryptionConfig. */ - class EncryptionConfig implements IEncryptionConfig { + /** Represents a ListBackupSchedulesResponse. */ + class ListBackupSchedulesResponse implements IListBackupSchedulesResponse { /** - * Constructs a new EncryptionConfig. + * Constructs a new ListBackupSchedulesResponse. * @param [properties] Properties to set */ - constructor(properties?: google.spanner.admin.database.v1.IEncryptionConfig); + constructor(properties?: google.spanner.admin.database.v1.IListBackupSchedulesResponse); - /** EncryptionConfig kmsKeyName. */ - public kmsKeyName: string; + /** ListBackupSchedulesResponse backupSchedules. */ + public backupSchedules: google.spanner.admin.database.v1.IBackupSchedule[]; - /** EncryptionConfig kmsKeyNames. */ - public kmsKeyNames: string[]; + /** ListBackupSchedulesResponse nextPageToken. */ + public nextPageToken: string; /** - * Creates a new EncryptionConfig instance using the specified properties. + * Creates a new ListBackupSchedulesResponse instance using the specified properties. * @param [properties] Properties to set - * @returns EncryptionConfig instance + * @returns ListBackupSchedulesResponse instance */ - public static create(properties?: google.spanner.admin.database.v1.IEncryptionConfig): google.spanner.admin.database.v1.EncryptionConfig; + public static create(properties?: google.spanner.admin.database.v1.IListBackupSchedulesResponse): google.spanner.admin.database.v1.ListBackupSchedulesResponse; /** - * Encodes the specified EncryptionConfig message. Does not implicitly {@link google.spanner.admin.database.v1.EncryptionConfig.verify|verify} messages. - * @param message EncryptionConfig message or plain object to encode + * Encodes the specified ListBackupSchedulesResponse message. Does not implicitly {@link google.spanner.admin.database.v1.ListBackupSchedulesResponse.verify|verify} messages. + * @param message ListBackupSchedulesResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.spanner.admin.database.v1.IEncryptionConfig, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.spanner.admin.database.v1.IListBackupSchedulesResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified EncryptionConfig message, length delimited. Does not implicitly {@link google.spanner.admin.database.v1.EncryptionConfig.verify|verify} messages. - * @param message EncryptionConfig message or plain object to encode + * Encodes the specified ListBackupSchedulesResponse message, length delimited. Does not implicitly {@link google.spanner.admin.database.v1.ListBackupSchedulesResponse.verify|verify} messages. + * @param message ListBackupSchedulesResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.spanner.admin.database.v1.IEncryptionConfig, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.spanner.admin.database.v1.IListBackupSchedulesResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an EncryptionConfig message from the specified reader or buffer. + * Decodes a ListBackupSchedulesResponse message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns EncryptionConfig + * @returns ListBackupSchedulesResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.spanner.admin.database.v1.EncryptionConfig; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.spanner.admin.database.v1.ListBackupSchedulesResponse; /** - * Decodes an EncryptionConfig message from the specified reader or buffer, length delimited. + * Decodes a ListBackupSchedulesResponse message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns EncryptionConfig + * @returns ListBackupSchedulesResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.spanner.admin.database.v1.EncryptionConfig; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.spanner.admin.database.v1.ListBackupSchedulesResponse; /** - * Verifies an EncryptionConfig message. + * Verifies a ListBackupSchedulesResponse message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates an EncryptionConfig message from a plain object. Also converts values to their respective internal types. + * Creates a ListBackupSchedulesResponse message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns EncryptionConfig + * @returns ListBackupSchedulesResponse */ - public static fromObject(object: { [k: string]: any }): google.spanner.admin.database.v1.EncryptionConfig; + public static fromObject(object: { [k: string]: any }): google.spanner.admin.database.v1.ListBackupSchedulesResponse; /** - * Creates a plain object from an EncryptionConfig message. Also converts values to other types if specified. - * @param message EncryptionConfig + * Creates a plain object from a ListBackupSchedulesResponse message. Also converts values to other types if specified. + * @param message ListBackupSchedulesResponse * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.spanner.admin.database.v1.EncryptionConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.spanner.admin.database.v1.ListBackupSchedulesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this EncryptionConfig to JSON. + * Converts this ListBackupSchedulesResponse to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; /** - * Gets the default type url for EncryptionConfig + * Gets the default type url for ListBackupSchedulesResponse * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns The default type url */ public static getTypeUrl(typeUrlPrefix?: string): string; } - /** Properties of an EncryptionInfo. */ - interface IEncryptionInfo { - - /** EncryptionInfo encryptionType */ - encryptionType?: (google.spanner.admin.database.v1.EncryptionInfo.Type|keyof typeof google.spanner.admin.database.v1.EncryptionInfo.Type|null); + /** Properties of an UpdateBackupScheduleRequest. */ + interface IUpdateBackupScheduleRequest { - /** EncryptionInfo encryptionStatus */ - encryptionStatus?: (google.rpc.IStatus|null); + /** UpdateBackupScheduleRequest backupSchedule */ + backupSchedule?: (google.spanner.admin.database.v1.IBackupSchedule|null); - /** EncryptionInfo kmsKeyVersion */ - kmsKeyVersion?: (string|null); + /** UpdateBackupScheduleRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); } - /** Represents an EncryptionInfo. */ - class EncryptionInfo implements IEncryptionInfo { + /** Represents an UpdateBackupScheduleRequest. */ + class UpdateBackupScheduleRequest implements IUpdateBackupScheduleRequest { /** - * Constructs a new EncryptionInfo. + * Constructs a new UpdateBackupScheduleRequest. * @param [properties] Properties to set */ - constructor(properties?: google.spanner.admin.database.v1.IEncryptionInfo); - - /** EncryptionInfo encryptionType. */ - public encryptionType: (google.spanner.admin.database.v1.EncryptionInfo.Type|keyof typeof google.spanner.admin.database.v1.EncryptionInfo.Type); + constructor(properties?: google.spanner.admin.database.v1.IUpdateBackupScheduleRequest); - /** EncryptionInfo encryptionStatus. */ - public encryptionStatus?: (google.rpc.IStatus|null); + /** UpdateBackupScheduleRequest backupSchedule. */ + public backupSchedule?: (google.spanner.admin.database.v1.IBackupSchedule|null); - /** EncryptionInfo kmsKeyVersion. */ - public kmsKeyVersion: string; + /** UpdateBackupScheduleRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); /** - * Creates a new EncryptionInfo instance using the specified properties. + * Creates a new UpdateBackupScheduleRequest instance using the specified properties. * @param [properties] Properties to set - * @returns EncryptionInfo instance + * @returns UpdateBackupScheduleRequest instance */ - public static create(properties?: google.spanner.admin.database.v1.IEncryptionInfo): google.spanner.admin.database.v1.EncryptionInfo; + public static create(properties?: google.spanner.admin.database.v1.IUpdateBackupScheduleRequest): google.spanner.admin.database.v1.UpdateBackupScheduleRequest; /** - * Encodes the specified EncryptionInfo message. Does not implicitly {@link google.spanner.admin.database.v1.EncryptionInfo.verify|verify} messages. - * @param message EncryptionInfo message or plain object to encode + * Encodes the specified UpdateBackupScheduleRequest message. Does not implicitly {@link google.spanner.admin.database.v1.UpdateBackupScheduleRequest.verify|verify} messages. + * @param message UpdateBackupScheduleRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.spanner.admin.database.v1.IEncryptionInfo, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.spanner.admin.database.v1.IUpdateBackupScheduleRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified EncryptionInfo message, length delimited. Does not implicitly {@link google.spanner.admin.database.v1.EncryptionInfo.verify|verify} messages. - * @param message EncryptionInfo message or plain object to encode + * Encodes the specified UpdateBackupScheduleRequest message, length delimited. Does not implicitly {@link google.spanner.admin.database.v1.UpdateBackupScheduleRequest.verify|verify} messages. + * @param message UpdateBackupScheduleRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.spanner.admin.database.v1.IEncryptionInfo, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.spanner.admin.database.v1.IUpdateBackupScheduleRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an EncryptionInfo message from the specified reader or buffer. + * Decodes an UpdateBackupScheduleRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns EncryptionInfo + * @returns UpdateBackupScheduleRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.spanner.admin.database.v1.EncryptionInfo; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.spanner.admin.database.v1.UpdateBackupScheduleRequest; /** - * Decodes an EncryptionInfo message from the specified reader or buffer, length delimited. + * Decodes an UpdateBackupScheduleRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns EncryptionInfo + * @returns UpdateBackupScheduleRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.spanner.admin.database.v1.EncryptionInfo; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.spanner.admin.database.v1.UpdateBackupScheduleRequest; /** - * Verifies an EncryptionInfo message. + * Verifies an UpdateBackupScheduleRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates an EncryptionInfo message from a plain object. Also converts values to their respective internal types. + * Creates an UpdateBackupScheduleRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns EncryptionInfo + * @returns UpdateBackupScheduleRequest */ - public static fromObject(object: { [k: string]: any }): google.spanner.admin.database.v1.EncryptionInfo; + public static fromObject(object: { [k: string]: any }): google.spanner.admin.database.v1.UpdateBackupScheduleRequest; /** - * Creates a plain object from an EncryptionInfo message. Also converts values to other types if specified. - * @param message EncryptionInfo + * Creates a plain object from an UpdateBackupScheduleRequest message. Also converts values to other types if specified. + * @param message UpdateBackupScheduleRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.spanner.admin.database.v1.EncryptionInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.spanner.admin.database.v1.UpdateBackupScheduleRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this EncryptionInfo to JSON. + * Converts this UpdateBackupScheduleRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; /** - * Gets the default type url for EncryptionInfo + * Gets the default type url for UpdateBackupScheduleRequest * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns The default type url */ public static getTypeUrl(typeUrlPrefix?: string): string; } - namespace EncryptionInfo { - - /** Type enum. */ - enum Type { - TYPE_UNSPECIFIED = 0, - GOOGLE_DEFAULT_ENCRYPTION = 1, - CUSTOMER_MANAGED_ENCRYPTION = 2 - } - } - - /** DatabaseDialect enum. */ - enum DatabaseDialect { - DATABASE_DIALECT_UNSPECIFIED = 0, - GOOGLE_STANDARD_SQL = 1, - POSTGRESQL = 2 - } - /** Represents a DatabaseAdmin */ class DatabaseAdmin extends $protobuf.rpc.Service { @@ -8898,6 +9952,76 @@ export namespace google { * @returns Promise */ public listDatabaseRoles(request: google.spanner.admin.database.v1.IListDatabaseRolesRequest): Promise; + + /** + * Calls CreateBackupSchedule. + * @param request CreateBackupScheduleRequest message or plain object + * @param callback Node-style callback called with the error, if any, and BackupSchedule + */ + public createBackupSchedule(request: google.spanner.admin.database.v1.ICreateBackupScheduleRequest, callback: google.spanner.admin.database.v1.DatabaseAdmin.CreateBackupScheduleCallback): void; + + /** + * Calls CreateBackupSchedule. + * @param request CreateBackupScheduleRequest message or plain object + * @returns Promise + */ + public createBackupSchedule(request: google.spanner.admin.database.v1.ICreateBackupScheduleRequest): Promise; + + /** + * Calls GetBackupSchedule. + * @param request GetBackupScheduleRequest message or plain object + * @param callback Node-style callback called with the error, if any, and BackupSchedule + */ + public getBackupSchedule(request: google.spanner.admin.database.v1.IGetBackupScheduleRequest, callback: google.spanner.admin.database.v1.DatabaseAdmin.GetBackupScheduleCallback): void; + + /** + * Calls GetBackupSchedule. + * @param request GetBackupScheduleRequest message or plain object + * @returns Promise + */ + public getBackupSchedule(request: google.spanner.admin.database.v1.IGetBackupScheduleRequest): Promise; + + /** + * Calls UpdateBackupSchedule. + * @param request UpdateBackupScheduleRequest message or plain object + * @param callback Node-style callback called with the error, if any, and BackupSchedule + */ + public updateBackupSchedule(request: google.spanner.admin.database.v1.IUpdateBackupScheduleRequest, callback: google.spanner.admin.database.v1.DatabaseAdmin.UpdateBackupScheduleCallback): void; + + /** + * Calls UpdateBackupSchedule. + * @param request UpdateBackupScheduleRequest message or plain object + * @returns Promise + */ + public updateBackupSchedule(request: google.spanner.admin.database.v1.IUpdateBackupScheduleRequest): Promise; + + /** + * Calls DeleteBackupSchedule. + * @param request DeleteBackupScheduleRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Empty + */ + public deleteBackupSchedule(request: google.spanner.admin.database.v1.IDeleteBackupScheduleRequest, callback: google.spanner.admin.database.v1.DatabaseAdmin.DeleteBackupScheduleCallback): void; + + /** + * Calls DeleteBackupSchedule. + * @param request DeleteBackupScheduleRequest message or plain object + * @returns Promise + */ + public deleteBackupSchedule(request: google.spanner.admin.database.v1.IDeleteBackupScheduleRequest): Promise; + + /** + * Calls ListBackupSchedules. + * @param request ListBackupSchedulesRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListBackupSchedulesResponse + */ + public listBackupSchedules(request: google.spanner.admin.database.v1.IListBackupSchedulesRequest, callback: google.spanner.admin.database.v1.DatabaseAdmin.ListBackupSchedulesCallback): void; + + /** + * Calls ListBackupSchedules. + * @param request ListBackupSchedulesRequest message or plain object + * @returns Promise + */ + public listBackupSchedules(request: google.spanner.admin.database.v1.IListBackupSchedulesRequest): Promise; } namespace DatabaseAdmin { @@ -9041,6 +10165,41 @@ export namespace google { * @param [response] ListDatabaseRolesResponse */ type ListDatabaseRolesCallback = (error: (Error|null), response?: google.spanner.admin.database.v1.ListDatabaseRolesResponse) => void; + + /** + * Callback as used by {@link google.spanner.admin.database.v1.DatabaseAdmin|createBackupSchedule}. + * @param error Error, if any + * @param [response] BackupSchedule + */ + type CreateBackupScheduleCallback = (error: (Error|null), response?: google.spanner.admin.database.v1.BackupSchedule) => void; + + /** + * Callback as used by {@link google.spanner.admin.database.v1.DatabaseAdmin|getBackupSchedule}. + * @param error Error, if any + * @param [response] BackupSchedule + */ + type GetBackupScheduleCallback = (error: (Error|null), response?: google.spanner.admin.database.v1.BackupSchedule) => void; + + /** + * Callback as used by {@link google.spanner.admin.database.v1.DatabaseAdmin|updateBackupSchedule}. + * @param error Error, if any + * @param [response] BackupSchedule + */ + type UpdateBackupScheduleCallback = (error: (Error|null), response?: google.spanner.admin.database.v1.BackupSchedule) => void; + + /** + * Callback as used by {@link google.spanner.admin.database.v1.DatabaseAdmin|deleteBackupSchedule}. + * @param error Error, if any + * @param [response] Empty + */ + type DeleteBackupScheduleCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; + + /** + * Callback as used by {@link google.spanner.admin.database.v1.DatabaseAdmin|listBackupSchedules}. + * @param error Error, if any + * @param [response] ListBackupSchedulesResponse + */ + type ListBackupSchedulesCallback = (error: (Error|null), response?: google.spanner.admin.database.v1.ListBackupSchedulesResponse) => void; } /** Properties of a RestoreInfo. */ @@ -16623,6 +17782,9 @@ export namespace google { /** SpannerAction executeChangeStreamQuery */ executeChangeStreamQuery?: (google.spanner.executor.v1.IExecuteChangeStreamQuery|null); + + /** SpannerAction queryCancellation */ + queryCancellation?: (google.spanner.executor.v1.IQueryCancellationAction|null); } /** Represents a SpannerAction. */ @@ -16688,8 +17850,11 @@ export namespace google { /** SpannerAction executeChangeStreamQuery. */ public executeChangeStreamQuery?: (google.spanner.executor.v1.IExecuteChangeStreamQuery|null); + /** SpannerAction queryCancellation. */ + public queryCancellation?: (google.spanner.executor.v1.IQueryCancellationAction|null); + /** SpannerAction action. */ - public action?: ("start"|"finish"|"read"|"query"|"mutation"|"dml"|"batchDml"|"write"|"partitionedUpdate"|"admin"|"startBatchTxn"|"closeBatchTxn"|"generateDbPartitionsRead"|"generateDbPartitionsQuery"|"executePartition"|"executeChangeStreamQuery"); + public action?: ("start"|"finish"|"read"|"query"|"mutation"|"dml"|"batchDml"|"write"|"partitionedUpdate"|"admin"|"startBatchTxn"|"closeBatchTxn"|"generateDbPartitionsRead"|"generateDbPartitionsQuery"|"executePartition"|"executeChangeStreamQuery"|"queryCancellation"); /** * Creates a new SpannerAction instance using the specified properties. @@ -22688,6 +23853,109 @@ export namespace google { public static getTypeUrl(typeUrlPrefix?: string): string; } + /** Properties of a QueryCancellationAction. */ + interface IQueryCancellationAction { + + /** QueryCancellationAction longRunningSql */ + longRunningSql?: (string|null); + + /** QueryCancellationAction cancelQuery */ + cancelQuery?: (string|null); + } + + /** Represents a QueryCancellationAction. */ + class QueryCancellationAction implements IQueryCancellationAction { + + /** + * Constructs a new QueryCancellationAction. + * @param [properties] Properties to set + */ + constructor(properties?: google.spanner.executor.v1.IQueryCancellationAction); + + /** QueryCancellationAction longRunningSql. */ + public longRunningSql: string; + + /** QueryCancellationAction cancelQuery. */ + public cancelQuery: string; + + /** + * Creates a new QueryCancellationAction instance using the specified properties. + * @param [properties] Properties to set + * @returns QueryCancellationAction instance + */ + public static create(properties?: google.spanner.executor.v1.IQueryCancellationAction): google.spanner.executor.v1.QueryCancellationAction; + + /** + * Encodes the specified QueryCancellationAction message. Does not implicitly {@link google.spanner.executor.v1.QueryCancellationAction.verify|verify} messages. + * @param message QueryCancellationAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.spanner.executor.v1.IQueryCancellationAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified QueryCancellationAction message, length delimited. Does not implicitly {@link google.spanner.executor.v1.QueryCancellationAction.verify|verify} messages. + * @param message QueryCancellationAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.spanner.executor.v1.IQueryCancellationAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a QueryCancellationAction message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns QueryCancellationAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.spanner.executor.v1.QueryCancellationAction; + + /** + * Decodes a QueryCancellationAction message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns QueryCancellationAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.spanner.executor.v1.QueryCancellationAction; + + /** + * Verifies a QueryCancellationAction message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a QueryCancellationAction message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns QueryCancellationAction + */ + public static fromObject(object: { [k: string]: any }): google.spanner.executor.v1.QueryCancellationAction; + + /** + * Creates a plain object from a QueryCancellationAction message. Also converts values to other types if specified. + * @param message QueryCancellationAction + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.spanner.executor.v1.QueryCancellationAction, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this QueryCancellationAction to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for QueryCancellationAction + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + /** Properties of a CancelOperationAction. */ interface ICancelOperationAction { @@ -28667,6 +29935,12 @@ export namespace google { /** ReadRequest dataBoostEnabled */ dataBoostEnabled?: (boolean|null); + + /** ReadRequest orderBy */ + orderBy?: (google.spanner.v1.ReadRequest.OrderBy|keyof typeof google.spanner.v1.ReadRequest.OrderBy|null); + + /** ReadRequest lockHint */ + lockHint?: (google.spanner.v1.ReadRequest.LockHint|keyof typeof google.spanner.v1.ReadRequest.LockHint|null); } /** Represents a ReadRequest. */ @@ -28714,6 +29988,12 @@ export namespace google { /** ReadRequest dataBoostEnabled. */ public dataBoostEnabled: boolean; + /** ReadRequest orderBy. */ + public orderBy: (google.spanner.v1.ReadRequest.OrderBy|keyof typeof google.spanner.v1.ReadRequest.OrderBy); + + /** ReadRequest lockHint. */ + public lockHint: (google.spanner.v1.ReadRequest.LockHint|keyof typeof google.spanner.v1.ReadRequest.LockHint); + /** * Creates a new ReadRequest instance using the specified properties. * @param [properties] Properties to set @@ -28792,6 +30072,23 @@ export namespace google { public static getTypeUrl(typeUrlPrefix?: string): string; } + namespace ReadRequest { + + /** OrderBy enum. */ + enum OrderBy { + ORDER_BY_UNSPECIFIED = 0, + ORDER_BY_PRIMARY_KEY = 1, + ORDER_BY_NO_ORDER = 2 + } + + /** LockHint enum. */ + enum LockHint { + LOCK_HINT_UNSPECIFIED = 0, + LOCK_HINT_SHARED = 1, + LOCK_HINT_EXCLUSIVE = 2 + } + } + /** Properties of a BeginTransactionRequest. */ interface IBeginTransactionRequest { diff --git a/protos/protos.js b/protos/protos.js index 239a3074d..320809a01 100644 --- a/protos/protos.js +++ b/protos/protos.js @@ -17702,6 +17702,7 @@ * @property {google.spanner.admin.database.v1.DatabaseDialect|null} [databaseDialect] Backup databaseDialect * @property {Array.|null} [referencingBackups] Backup referencingBackups * @property {google.protobuf.ITimestamp|null} [maxExpireTime] Backup maxExpireTime + * @property {Array.|null} [backupSchedules] Backup backupSchedules */ /** @@ -17716,6 +17717,7 @@ this.referencingDatabases = []; this.encryptionInformation = []; this.referencingBackups = []; + this.backupSchedules = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -17826,6 +17828,14 @@ */ Backup.prototype.maxExpireTime = null; + /** + * Backup backupSchedules. + * @member {Array.} backupSchedules + * @memberof google.spanner.admin.database.v1.Backup + * @instance + */ + Backup.prototype.backupSchedules = $util.emptyArray; + /** * Creates a new Backup instance using the specified properties. * @function create @@ -17879,6 +17889,9 @@ if (message.encryptionInformation != null && message.encryptionInformation.length) for (var i = 0; i < message.encryptionInformation.length; ++i) $root.google.spanner.admin.database.v1.EncryptionInfo.encode(message.encryptionInformation[i], writer.uint32(/* id 13, wireType 2 =*/106).fork()).ldelim(); + if (message.backupSchedules != null && message.backupSchedules.length) + for (var i = 0; i < message.backupSchedules.length; ++i) + writer.uint32(/* id 14, wireType 2 =*/114).string(message.backupSchedules[i]); return writer; }; @@ -17971,6 +17984,12 @@ message.maxExpireTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); break; } + case 14: { + if (!(message.backupSchedules && message.backupSchedules.length)) + message.backupSchedules = []; + message.backupSchedules.push(reader.string()); + break; + } default: reader.skipType(tag & 7); break; @@ -18081,6 +18100,13 @@ if (error) return "maxExpireTime." + error; } + if (message.backupSchedules != null && message.hasOwnProperty("backupSchedules")) { + if (!Array.isArray(message.backupSchedules)) + return "backupSchedules: array expected"; + for (var i = 0; i < message.backupSchedules.length; ++i) + if (!$util.isString(message.backupSchedules[i])) + return "backupSchedules: string[] expected"; + } return null; }; @@ -18198,6 +18224,13 @@ throw TypeError(".google.spanner.admin.database.v1.Backup.maxExpireTime: object expected"); message.maxExpireTime = $root.google.protobuf.Timestamp.fromObject(object.maxExpireTime); } + if (object.backupSchedules) { + if (!Array.isArray(object.backupSchedules)) + throw TypeError(".google.spanner.admin.database.v1.Backup.backupSchedules: array expected"); + message.backupSchedules = []; + for (var i = 0; i < object.backupSchedules.length; ++i) + message.backupSchedules[i] = String(object.backupSchedules[i]); + } return message; }; @@ -18218,6 +18251,7 @@ object.referencingDatabases = []; object.referencingBackups = []; object.encryptionInformation = []; + object.backupSchedules = []; } if (options.defaults) { object.name = ""; @@ -18273,6 +18307,11 @@ for (var j = 0; j < message.encryptionInformation.length; ++j) object.encryptionInformation[j] = $root.google.spanner.admin.database.v1.EncryptionInfo.toObject(message.encryptionInformation[j], options); } + if (message.backupSchedules && message.backupSchedules.length) { + object.backupSchedules = []; + for (var j = 0; j < message.backupSchedules.length; ++j) + object.backupSchedules[j] = message.backupSchedules[j]; + } return object; }; @@ -22072,6 +22111,181 @@ return CopyBackupEncryptionConfig; })(); + v1.FullBackupSpec = (function() { + + /** + * Properties of a FullBackupSpec. + * @memberof google.spanner.admin.database.v1 + * @interface IFullBackupSpec + */ + + /** + * Constructs a new FullBackupSpec. + * @memberof google.spanner.admin.database.v1 + * @classdesc Represents a FullBackupSpec. + * @implements IFullBackupSpec + * @constructor + * @param {google.spanner.admin.database.v1.IFullBackupSpec=} [properties] Properties to set + */ + function FullBackupSpec(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Creates a new FullBackupSpec instance using the specified properties. + * @function create + * @memberof google.spanner.admin.database.v1.FullBackupSpec + * @static + * @param {google.spanner.admin.database.v1.IFullBackupSpec=} [properties] Properties to set + * @returns {google.spanner.admin.database.v1.FullBackupSpec} FullBackupSpec instance + */ + FullBackupSpec.create = function create(properties) { + return new FullBackupSpec(properties); + }; + + /** + * Encodes the specified FullBackupSpec message. Does not implicitly {@link google.spanner.admin.database.v1.FullBackupSpec.verify|verify} messages. + * @function encode + * @memberof google.spanner.admin.database.v1.FullBackupSpec + * @static + * @param {google.spanner.admin.database.v1.IFullBackupSpec} message FullBackupSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FullBackupSpec.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified FullBackupSpec message, length delimited. Does not implicitly {@link google.spanner.admin.database.v1.FullBackupSpec.verify|verify} messages. + * @function encodeDelimited + * @memberof google.spanner.admin.database.v1.FullBackupSpec + * @static + * @param {google.spanner.admin.database.v1.IFullBackupSpec} message FullBackupSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FullBackupSpec.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FullBackupSpec message from the specified reader or buffer. + * @function decode + * @memberof google.spanner.admin.database.v1.FullBackupSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.spanner.admin.database.v1.FullBackupSpec} FullBackupSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FullBackupSpec.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.spanner.admin.database.v1.FullBackupSpec(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FullBackupSpec message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.spanner.admin.database.v1.FullBackupSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.spanner.admin.database.v1.FullBackupSpec} FullBackupSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FullBackupSpec.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FullBackupSpec message. + * @function verify + * @memberof google.spanner.admin.database.v1.FullBackupSpec + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FullBackupSpec.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a FullBackupSpec message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.spanner.admin.database.v1.FullBackupSpec + * @static + * @param {Object.} object Plain object + * @returns {google.spanner.admin.database.v1.FullBackupSpec} FullBackupSpec + */ + FullBackupSpec.fromObject = function fromObject(object) { + if (object instanceof $root.google.spanner.admin.database.v1.FullBackupSpec) + return object; + return new $root.google.spanner.admin.database.v1.FullBackupSpec(); + }; + + /** + * Creates a plain object from a FullBackupSpec message. Also converts values to other types if specified. + * @function toObject + * @memberof google.spanner.admin.database.v1.FullBackupSpec + * @static + * @param {google.spanner.admin.database.v1.FullBackupSpec} message FullBackupSpec + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FullBackupSpec.toObject = function toObject() { + return {}; + }; + + /** + * Converts this FullBackupSpec to JSON. + * @function toJSON + * @memberof google.spanner.admin.database.v1.FullBackupSpec + * @instance + * @returns {Object.} JSON object + */ + FullBackupSpec.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for FullBackupSpec + * @function getTypeUrl + * @memberof google.spanner.admin.database.v1.FullBackupSpec + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FullBackupSpec.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.spanner.admin.database.v1.FullBackupSpec"; + }; + + return FullBackupSpec; + })(); + v1.OperationProgress = (function() { /** @@ -22886,6 +23100,2248 @@ return values; })(); + v1.BackupScheduleSpec = (function() { + + /** + * Properties of a BackupScheduleSpec. + * @memberof google.spanner.admin.database.v1 + * @interface IBackupScheduleSpec + * @property {google.spanner.admin.database.v1.ICrontabSpec|null} [cronSpec] BackupScheduleSpec cronSpec + */ + + /** + * Constructs a new BackupScheduleSpec. + * @memberof google.spanner.admin.database.v1 + * @classdesc Represents a BackupScheduleSpec. + * @implements IBackupScheduleSpec + * @constructor + * @param {google.spanner.admin.database.v1.IBackupScheduleSpec=} [properties] Properties to set + */ + function BackupScheduleSpec(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BackupScheduleSpec cronSpec. + * @member {google.spanner.admin.database.v1.ICrontabSpec|null|undefined} cronSpec + * @memberof google.spanner.admin.database.v1.BackupScheduleSpec + * @instance + */ + BackupScheduleSpec.prototype.cronSpec = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * BackupScheduleSpec scheduleSpec. + * @member {"cronSpec"|undefined} scheduleSpec + * @memberof google.spanner.admin.database.v1.BackupScheduleSpec + * @instance + */ + Object.defineProperty(BackupScheduleSpec.prototype, "scheduleSpec", { + get: $util.oneOfGetter($oneOfFields = ["cronSpec"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new BackupScheduleSpec instance using the specified properties. + * @function create + * @memberof google.spanner.admin.database.v1.BackupScheduleSpec + * @static + * @param {google.spanner.admin.database.v1.IBackupScheduleSpec=} [properties] Properties to set + * @returns {google.spanner.admin.database.v1.BackupScheduleSpec} BackupScheduleSpec instance + */ + BackupScheduleSpec.create = function create(properties) { + return new BackupScheduleSpec(properties); + }; + + /** + * Encodes the specified BackupScheduleSpec message. Does not implicitly {@link google.spanner.admin.database.v1.BackupScheduleSpec.verify|verify} messages. + * @function encode + * @memberof google.spanner.admin.database.v1.BackupScheduleSpec + * @static + * @param {google.spanner.admin.database.v1.IBackupScheduleSpec} message BackupScheduleSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BackupScheduleSpec.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.cronSpec != null && Object.hasOwnProperty.call(message, "cronSpec")) + $root.google.spanner.admin.database.v1.CrontabSpec.encode(message.cronSpec, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified BackupScheduleSpec message, length delimited. Does not implicitly {@link google.spanner.admin.database.v1.BackupScheduleSpec.verify|verify} messages. + * @function encodeDelimited + * @memberof google.spanner.admin.database.v1.BackupScheduleSpec + * @static + * @param {google.spanner.admin.database.v1.IBackupScheduleSpec} message BackupScheduleSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BackupScheduleSpec.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BackupScheduleSpec message from the specified reader or buffer. + * @function decode + * @memberof google.spanner.admin.database.v1.BackupScheduleSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.spanner.admin.database.v1.BackupScheduleSpec} BackupScheduleSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BackupScheduleSpec.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.spanner.admin.database.v1.BackupScheduleSpec(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.cronSpec = $root.google.spanner.admin.database.v1.CrontabSpec.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BackupScheduleSpec message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.spanner.admin.database.v1.BackupScheduleSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.spanner.admin.database.v1.BackupScheduleSpec} BackupScheduleSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BackupScheduleSpec.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BackupScheduleSpec message. + * @function verify + * @memberof google.spanner.admin.database.v1.BackupScheduleSpec + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BackupScheduleSpec.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.cronSpec != null && message.hasOwnProperty("cronSpec")) { + properties.scheduleSpec = 1; + { + var error = $root.google.spanner.admin.database.v1.CrontabSpec.verify(message.cronSpec); + if (error) + return "cronSpec." + error; + } + } + return null; + }; + + /** + * Creates a BackupScheduleSpec message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.spanner.admin.database.v1.BackupScheduleSpec + * @static + * @param {Object.} object Plain object + * @returns {google.spanner.admin.database.v1.BackupScheduleSpec} BackupScheduleSpec + */ + BackupScheduleSpec.fromObject = function fromObject(object) { + if (object instanceof $root.google.spanner.admin.database.v1.BackupScheduleSpec) + return object; + var message = new $root.google.spanner.admin.database.v1.BackupScheduleSpec(); + if (object.cronSpec != null) { + if (typeof object.cronSpec !== "object") + throw TypeError(".google.spanner.admin.database.v1.BackupScheduleSpec.cronSpec: object expected"); + message.cronSpec = $root.google.spanner.admin.database.v1.CrontabSpec.fromObject(object.cronSpec); + } + return message; + }; + + /** + * Creates a plain object from a BackupScheduleSpec message. Also converts values to other types if specified. + * @function toObject + * @memberof google.spanner.admin.database.v1.BackupScheduleSpec + * @static + * @param {google.spanner.admin.database.v1.BackupScheduleSpec} message BackupScheduleSpec + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BackupScheduleSpec.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.cronSpec != null && message.hasOwnProperty("cronSpec")) { + object.cronSpec = $root.google.spanner.admin.database.v1.CrontabSpec.toObject(message.cronSpec, options); + if (options.oneofs) + object.scheduleSpec = "cronSpec"; + } + return object; + }; + + /** + * Converts this BackupScheduleSpec to JSON. + * @function toJSON + * @memberof google.spanner.admin.database.v1.BackupScheduleSpec + * @instance + * @returns {Object.} JSON object + */ + BackupScheduleSpec.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for BackupScheduleSpec + * @function getTypeUrl + * @memberof google.spanner.admin.database.v1.BackupScheduleSpec + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BackupScheduleSpec.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.spanner.admin.database.v1.BackupScheduleSpec"; + }; + + return BackupScheduleSpec; + })(); + + v1.BackupSchedule = (function() { + + /** + * Properties of a BackupSchedule. + * @memberof google.spanner.admin.database.v1 + * @interface IBackupSchedule + * @property {string|null} [name] BackupSchedule name + * @property {google.spanner.admin.database.v1.IBackupScheduleSpec|null} [spec] BackupSchedule spec + * @property {google.protobuf.IDuration|null} [retentionDuration] BackupSchedule retentionDuration + * @property {google.spanner.admin.database.v1.ICreateBackupEncryptionConfig|null} [encryptionConfig] BackupSchedule encryptionConfig + * @property {google.spanner.admin.database.v1.IFullBackupSpec|null} [fullBackupSpec] BackupSchedule fullBackupSpec + * @property {google.protobuf.ITimestamp|null} [updateTime] BackupSchedule updateTime + */ + + /** + * Constructs a new BackupSchedule. + * @memberof google.spanner.admin.database.v1 + * @classdesc Represents a BackupSchedule. + * @implements IBackupSchedule + * @constructor + * @param {google.spanner.admin.database.v1.IBackupSchedule=} [properties] Properties to set + */ + function BackupSchedule(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BackupSchedule name. + * @member {string} name + * @memberof google.spanner.admin.database.v1.BackupSchedule + * @instance + */ + BackupSchedule.prototype.name = ""; + + /** + * BackupSchedule spec. + * @member {google.spanner.admin.database.v1.IBackupScheduleSpec|null|undefined} spec + * @memberof google.spanner.admin.database.v1.BackupSchedule + * @instance + */ + BackupSchedule.prototype.spec = null; + + /** + * BackupSchedule retentionDuration. + * @member {google.protobuf.IDuration|null|undefined} retentionDuration + * @memberof google.spanner.admin.database.v1.BackupSchedule + * @instance + */ + BackupSchedule.prototype.retentionDuration = null; + + /** + * BackupSchedule encryptionConfig. + * @member {google.spanner.admin.database.v1.ICreateBackupEncryptionConfig|null|undefined} encryptionConfig + * @memberof google.spanner.admin.database.v1.BackupSchedule + * @instance + */ + BackupSchedule.prototype.encryptionConfig = null; + + /** + * BackupSchedule fullBackupSpec. + * @member {google.spanner.admin.database.v1.IFullBackupSpec|null|undefined} fullBackupSpec + * @memberof google.spanner.admin.database.v1.BackupSchedule + * @instance + */ + BackupSchedule.prototype.fullBackupSpec = null; + + /** + * BackupSchedule updateTime. + * @member {google.protobuf.ITimestamp|null|undefined} updateTime + * @memberof google.spanner.admin.database.v1.BackupSchedule + * @instance + */ + BackupSchedule.prototype.updateTime = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * BackupSchedule backupTypeSpec. + * @member {"fullBackupSpec"|undefined} backupTypeSpec + * @memberof google.spanner.admin.database.v1.BackupSchedule + * @instance + */ + Object.defineProperty(BackupSchedule.prototype, "backupTypeSpec", { + get: $util.oneOfGetter($oneOfFields = ["fullBackupSpec"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new BackupSchedule instance using the specified properties. + * @function create + * @memberof google.spanner.admin.database.v1.BackupSchedule + * @static + * @param {google.spanner.admin.database.v1.IBackupSchedule=} [properties] Properties to set + * @returns {google.spanner.admin.database.v1.BackupSchedule} BackupSchedule instance + */ + BackupSchedule.create = function create(properties) { + return new BackupSchedule(properties); + }; + + /** + * Encodes the specified BackupSchedule message. Does not implicitly {@link google.spanner.admin.database.v1.BackupSchedule.verify|verify} messages. + * @function encode + * @memberof google.spanner.admin.database.v1.BackupSchedule + * @static + * @param {google.spanner.admin.database.v1.IBackupSchedule} message BackupSchedule message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BackupSchedule.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.retentionDuration != null && Object.hasOwnProperty.call(message, "retentionDuration")) + $root.google.protobuf.Duration.encode(message.retentionDuration, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.encryptionConfig != null && Object.hasOwnProperty.call(message, "encryptionConfig")) + $root.google.spanner.admin.database.v1.CreateBackupEncryptionConfig.encode(message.encryptionConfig, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.spec != null && Object.hasOwnProperty.call(message, "spec")) + $root.google.spanner.admin.database.v1.BackupScheduleSpec.encode(message.spec, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.fullBackupSpec != null && Object.hasOwnProperty.call(message, "fullBackupSpec")) + $root.google.spanner.admin.database.v1.FullBackupSpec.encode(message.fullBackupSpec, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) + $root.google.protobuf.Timestamp.encode(message.updateTime, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified BackupSchedule message, length delimited. Does not implicitly {@link google.spanner.admin.database.v1.BackupSchedule.verify|verify} messages. + * @function encodeDelimited + * @memberof google.spanner.admin.database.v1.BackupSchedule + * @static + * @param {google.spanner.admin.database.v1.IBackupSchedule} message BackupSchedule message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BackupSchedule.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BackupSchedule message from the specified reader or buffer. + * @function decode + * @memberof google.spanner.admin.database.v1.BackupSchedule + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.spanner.admin.database.v1.BackupSchedule} BackupSchedule + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BackupSchedule.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.spanner.admin.database.v1.BackupSchedule(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 6: { + message.spec = $root.google.spanner.admin.database.v1.BackupScheduleSpec.decode(reader, reader.uint32()); + break; + } + case 3: { + message.retentionDuration = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + break; + } + case 4: { + message.encryptionConfig = $root.google.spanner.admin.database.v1.CreateBackupEncryptionConfig.decode(reader, reader.uint32()); + break; + } + case 7: { + message.fullBackupSpec = $root.google.spanner.admin.database.v1.FullBackupSpec.decode(reader, reader.uint32()); + break; + } + case 9: { + message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BackupSchedule message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.spanner.admin.database.v1.BackupSchedule + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.spanner.admin.database.v1.BackupSchedule} BackupSchedule + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BackupSchedule.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BackupSchedule message. + * @function verify + * @memberof google.spanner.admin.database.v1.BackupSchedule + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BackupSchedule.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.spec != null && message.hasOwnProperty("spec")) { + var error = $root.google.spanner.admin.database.v1.BackupScheduleSpec.verify(message.spec); + if (error) + return "spec." + error; + } + if (message.retentionDuration != null && message.hasOwnProperty("retentionDuration")) { + var error = $root.google.protobuf.Duration.verify(message.retentionDuration); + if (error) + return "retentionDuration." + error; + } + if (message.encryptionConfig != null && message.hasOwnProperty("encryptionConfig")) { + var error = $root.google.spanner.admin.database.v1.CreateBackupEncryptionConfig.verify(message.encryptionConfig); + if (error) + return "encryptionConfig." + error; + } + if (message.fullBackupSpec != null && message.hasOwnProperty("fullBackupSpec")) { + properties.backupTypeSpec = 1; + { + var error = $root.google.spanner.admin.database.v1.FullBackupSpec.verify(message.fullBackupSpec); + if (error) + return "fullBackupSpec." + error; + } + } + if (message.updateTime != null && message.hasOwnProperty("updateTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.updateTime); + if (error) + return "updateTime." + error; + } + return null; + }; + + /** + * Creates a BackupSchedule message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.spanner.admin.database.v1.BackupSchedule + * @static + * @param {Object.} object Plain object + * @returns {google.spanner.admin.database.v1.BackupSchedule} BackupSchedule + */ + BackupSchedule.fromObject = function fromObject(object) { + if (object instanceof $root.google.spanner.admin.database.v1.BackupSchedule) + return object; + var message = new $root.google.spanner.admin.database.v1.BackupSchedule(); + if (object.name != null) + message.name = String(object.name); + if (object.spec != null) { + if (typeof object.spec !== "object") + throw TypeError(".google.spanner.admin.database.v1.BackupSchedule.spec: object expected"); + message.spec = $root.google.spanner.admin.database.v1.BackupScheduleSpec.fromObject(object.spec); + } + if (object.retentionDuration != null) { + if (typeof object.retentionDuration !== "object") + throw TypeError(".google.spanner.admin.database.v1.BackupSchedule.retentionDuration: object expected"); + message.retentionDuration = $root.google.protobuf.Duration.fromObject(object.retentionDuration); + } + if (object.encryptionConfig != null) { + if (typeof object.encryptionConfig !== "object") + throw TypeError(".google.spanner.admin.database.v1.BackupSchedule.encryptionConfig: object expected"); + message.encryptionConfig = $root.google.spanner.admin.database.v1.CreateBackupEncryptionConfig.fromObject(object.encryptionConfig); + } + if (object.fullBackupSpec != null) { + if (typeof object.fullBackupSpec !== "object") + throw TypeError(".google.spanner.admin.database.v1.BackupSchedule.fullBackupSpec: object expected"); + message.fullBackupSpec = $root.google.spanner.admin.database.v1.FullBackupSpec.fromObject(object.fullBackupSpec); + } + if (object.updateTime != null) { + if (typeof object.updateTime !== "object") + throw TypeError(".google.spanner.admin.database.v1.BackupSchedule.updateTime: object expected"); + message.updateTime = $root.google.protobuf.Timestamp.fromObject(object.updateTime); + } + return message; + }; + + /** + * Creates a plain object from a BackupSchedule message. Also converts values to other types if specified. + * @function toObject + * @memberof google.spanner.admin.database.v1.BackupSchedule + * @static + * @param {google.spanner.admin.database.v1.BackupSchedule} message BackupSchedule + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BackupSchedule.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.retentionDuration = null; + object.encryptionConfig = null; + object.spec = null; + object.updateTime = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.retentionDuration != null && message.hasOwnProperty("retentionDuration")) + object.retentionDuration = $root.google.protobuf.Duration.toObject(message.retentionDuration, options); + if (message.encryptionConfig != null && message.hasOwnProperty("encryptionConfig")) + object.encryptionConfig = $root.google.spanner.admin.database.v1.CreateBackupEncryptionConfig.toObject(message.encryptionConfig, options); + if (message.spec != null && message.hasOwnProperty("spec")) + object.spec = $root.google.spanner.admin.database.v1.BackupScheduleSpec.toObject(message.spec, options); + if (message.fullBackupSpec != null && message.hasOwnProperty("fullBackupSpec")) { + object.fullBackupSpec = $root.google.spanner.admin.database.v1.FullBackupSpec.toObject(message.fullBackupSpec, options); + if (options.oneofs) + object.backupTypeSpec = "fullBackupSpec"; + } + if (message.updateTime != null && message.hasOwnProperty("updateTime")) + object.updateTime = $root.google.protobuf.Timestamp.toObject(message.updateTime, options); + return object; + }; + + /** + * Converts this BackupSchedule to JSON. + * @function toJSON + * @memberof google.spanner.admin.database.v1.BackupSchedule + * @instance + * @returns {Object.} JSON object + */ + BackupSchedule.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for BackupSchedule + * @function getTypeUrl + * @memberof google.spanner.admin.database.v1.BackupSchedule + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BackupSchedule.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.spanner.admin.database.v1.BackupSchedule"; + }; + + return BackupSchedule; + })(); + + v1.CrontabSpec = (function() { + + /** + * Properties of a CrontabSpec. + * @memberof google.spanner.admin.database.v1 + * @interface ICrontabSpec + * @property {string|null} [text] CrontabSpec text + * @property {string|null} [timeZone] CrontabSpec timeZone + * @property {google.protobuf.IDuration|null} [creationWindow] CrontabSpec creationWindow + */ + + /** + * Constructs a new CrontabSpec. + * @memberof google.spanner.admin.database.v1 + * @classdesc Represents a CrontabSpec. + * @implements ICrontabSpec + * @constructor + * @param {google.spanner.admin.database.v1.ICrontabSpec=} [properties] Properties to set + */ + function CrontabSpec(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CrontabSpec text. + * @member {string} text + * @memberof google.spanner.admin.database.v1.CrontabSpec + * @instance + */ + CrontabSpec.prototype.text = ""; + + /** + * CrontabSpec timeZone. + * @member {string} timeZone + * @memberof google.spanner.admin.database.v1.CrontabSpec + * @instance + */ + CrontabSpec.prototype.timeZone = ""; + + /** + * CrontabSpec creationWindow. + * @member {google.protobuf.IDuration|null|undefined} creationWindow + * @memberof google.spanner.admin.database.v1.CrontabSpec + * @instance + */ + CrontabSpec.prototype.creationWindow = null; + + /** + * Creates a new CrontabSpec instance using the specified properties. + * @function create + * @memberof google.spanner.admin.database.v1.CrontabSpec + * @static + * @param {google.spanner.admin.database.v1.ICrontabSpec=} [properties] Properties to set + * @returns {google.spanner.admin.database.v1.CrontabSpec} CrontabSpec instance + */ + CrontabSpec.create = function create(properties) { + return new CrontabSpec(properties); + }; + + /** + * Encodes the specified CrontabSpec message. Does not implicitly {@link google.spanner.admin.database.v1.CrontabSpec.verify|verify} messages. + * @function encode + * @memberof google.spanner.admin.database.v1.CrontabSpec + * @static + * @param {google.spanner.admin.database.v1.ICrontabSpec} message CrontabSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CrontabSpec.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.text != null && Object.hasOwnProperty.call(message, "text")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.text); + if (message.timeZone != null && Object.hasOwnProperty.call(message, "timeZone")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.timeZone); + if (message.creationWindow != null && Object.hasOwnProperty.call(message, "creationWindow")) + $root.google.protobuf.Duration.encode(message.creationWindow, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified CrontabSpec message, length delimited. Does not implicitly {@link google.spanner.admin.database.v1.CrontabSpec.verify|verify} messages. + * @function encodeDelimited + * @memberof google.spanner.admin.database.v1.CrontabSpec + * @static + * @param {google.spanner.admin.database.v1.ICrontabSpec} message CrontabSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CrontabSpec.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CrontabSpec message from the specified reader or buffer. + * @function decode + * @memberof google.spanner.admin.database.v1.CrontabSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.spanner.admin.database.v1.CrontabSpec} CrontabSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CrontabSpec.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.spanner.admin.database.v1.CrontabSpec(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.text = reader.string(); + break; + } + case 2: { + message.timeZone = reader.string(); + break; + } + case 3: { + message.creationWindow = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CrontabSpec message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.spanner.admin.database.v1.CrontabSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.spanner.admin.database.v1.CrontabSpec} CrontabSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CrontabSpec.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CrontabSpec message. + * @function verify + * @memberof google.spanner.admin.database.v1.CrontabSpec + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CrontabSpec.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.text != null && message.hasOwnProperty("text")) + if (!$util.isString(message.text)) + return "text: string expected"; + if (message.timeZone != null && message.hasOwnProperty("timeZone")) + if (!$util.isString(message.timeZone)) + return "timeZone: string expected"; + if (message.creationWindow != null && message.hasOwnProperty("creationWindow")) { + var error = $root.google.protobuf.Duration.verify(message.creationWindow); + if (error) + return "creationWindow." + error; + } + return null; + }; + + /** + * Creates a CrontabSpec message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.spanner.admin.database.v1.CrontabSpec + * @static + * @param {Object.} object Plain object + * @returns {google.spanner.admin.database.v1.CrontabSpec} CrontabSpec + */ + CrontabSpec.fromObject = function fromObject(object) { + if (object instanceof $root.google.spanner.admin.database.v1.CrontabSpec) + return object; + var message = new $root.google.spanner.admin.database.v1.CrontabSpec(); + if (object.text != null) + message.text = String(object.text); + if (object.timeZone != null) + message.timeZone = String(object.timeZone); + if (object.creationWindow != null) { + if (typeof object.creationWindow !== "object") + throw TypeError(".google.spanner.admin.database.v1.CrontabSpec.creationWindow: object expected"); + message.creationWindow = $root.google.protobuf.Duration.fromObject(object.creationWindow); + } + return message; + }; + + /** + * Creates a plain object from a CrontabSpec message. Also converts values to other types if specified. + * @function toObject + * @memberof google.spanner.admin.database.v1.CrontabSpec + * @static + * @param {google.spanner.admin.database.v1.CrontabSpec} message CrontabSpec + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CrontabSpec.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.text = ""; + object.timeZone = ""; + object.creationWindow = null; + } + if (message.text != null && message.hasOwnProperty("text")) + object.text = message.text; + if (message.timeZone != null && message.hasOwnProperty("timeZone")) + object.timeZone = message.timeZone; + if (message.creationWindow != null && message.hasOwnProperty("creationWindow")) + object.creationWindow = $root.google.protobuf.Duration.toObject(message.creationWindow, options); + return object; + }; + + /** + * Converts this CrontabSpec to JSON. + * @function toJSON + * @memberof google.spanner.admin.database.v1.CrontabSpec + * @instance + * @returns {Object.} JSON object + */ + CrontabSpec.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CrontabSpec + * @function getTypeUrl + * @memberof google.spanner.admin.database.v1.CrontabSpec + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CrontabSpec.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.spanner.admin.database.v1.CrontabSpec"; + }; + + return CrontabSpec; + })(); + + v1.CreateBackupScheduleRequest = (function() { + + /** + * Properties of a CreateBackupScheduleRequest. + * @memberof google.spanner.admin.database.v1 + * @interface ICreateBackupScheduleRequest + * @property {string|null} [parent] CreateBackupScheduleRequest parent + * @property {string|null} [backupScheduleId] CreateBackupScheduleRequest backupScheduleId + * @property {google.spanner.admin.database.v1.IBackupSchedule|null} [backupSchedule] CreateBackupScheduleRequest backupSchedule + */ + + /** + * Constructs a new CreateBackupScheduleRequest. + * @memberof google.spanner.admin.database.v1 + * @classdesc Represents a CreateBackupScheduleRequest. + * @implements ICreateBackupScheduleRequest + * @constructor + * @param {google.spanner.admin.database.v1.ICreateBackupScheduleRequest=} [properties] Properties to set + */ + function CreateBackupScheduleRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CreateBackupScheduleRequest parent. + * @member {string} parent + * @memberof google.spanner.admin.database.v1.CreateBackupScheduleRequest + * @instance + */ + CreateBackupScheduleRequest.prototype.parent = ""; + + /** + * CreateBackupScheduleRequest backupScheduleId. + * @member {string} backupScheduleId + * @memberof google.spanner.admin.database.v1.CreateBackupScheduleRequest + * @instance + */ + CreateBackupScheduleRequest.prototype.backupScheduleId = ""; + + /** + * CreateBackupScheduleRequest backupSchedule. + * @member {google.spanner.admin.database.v1.IBackupSchedule|null|undefined} backupSchedule + * @memberof google.spanner.admin.database.v1.CreateBackupScheduleRequest + * @instance + */ + CreateBackupScheduleRequest.prototype.backupSchedule = null; + + /** + * Creates a new CreateBackupScheduleRequest instance using the specified properties. + * @function create + * @memberof google.spanner.admin.database.v1.CreateBackupScheduleRequest + * @static + * @param {google.spanner.admin.database.v1.ICreateBackupScheduleRequest=} [properties] Properties to set + * @returns {google.spanner.admin.database.v1.CreateBackupScheduleRequest} CreateBackupScheduleRequest instance + */ + CreateBackupScheduleRequest.create = function create(properties) { + return new CreateBackupScheduleRequest(properties); + }; + + /** + * Encodes the specified CreateBackupScheduleRequest message. Does not implicitly {@link google.spanner.admin.database.v1.CreateBackupScheduleRequest.verify|verify} messages. + * @function encode + * @memberof google.spanner.admin.database.v1.CreateBackupScheduleRequest + * @static + * @param {google.spanner.admin.database.v1.ICreateBackupScheduleRequest} message CreateBackupScheduleRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateBackupScheduleRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.backupScheduleId != null && Object.hasOwnProperty.call(message, "backupScheduleId")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.backupScheduleId); + if (message.backupSchedule != null && Object.hasOwnProperty.call(message, "backupSchedule")) + $root.google.spanner.admin.database.v1.BackupSchedule.encode(message.backupSchedule, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified CreateBackupScheduleRequest message, length delimited. Does not implicitly {@link google.spanner.admin.database.v1.CreateBackupScheduleRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.spanner.admin.database.v1.CreateBackupScheduleRequest + * @static + * @param {google.spanner.admin.database.v1.ICreateBackupScheduleRequest} message CreateBackupScheduleRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateBackupScheduleRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateBackupScheduleRequest message from the specified reader or buffer. + * @function decode + * @memberof google.spanner.admin.database.v1.CreateBackupScheduleRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.spanner.admin.database.v1.CreateBackupScheduleRequest} CreateBackupScheduleRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateBackupScheduleRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.spanner.admin.database.v1.CreateBackupScheduleRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.backupScheduleId = reader.string(); + break; + } + case 3: { + message.backupSchedule = $root.google.spanner.admin.database.v1.BackupSchedule.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateBackupScheduleRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.spanner.admin.database.v1.CreateBackupScheduleRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.spanner.admin.database.v1.CreateBackupScheduleRequest} CreateBackupScheduleRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateBackupScheduleRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateBackupScheduleRequest message. + * @function verify + * @memberof google.spanner.admin.database.v1.CreateBackupScheduleRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateBackupScheduleRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.backupScheduleId != null && message.hasOwnProperty("backupScheduleId")) + if (!$util.isString(message.backupScheduleId)) + return "backupScheduleId: string expected"; + if (message.backupSchedule != null && message.hasOwnProperty("backupSchedule")) { + var error = $root.google.spanner.admin.database.v1.BackupSchedule.verify(message.backupSchedule); + if (error) + return "backupSchedule." + error; + } + return null; + }; + + /** + * Creates a CreateBackupScheduleRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.spanner.admin.database.v1.CreateBackupScheduleRequest + * @static + * @param {Object.} object Plain object + * @returns {google.spanner.admin.database.v1.CreateBackupScheduleRequest} CreateBackupScheduleRequest + */ + CreateBackupScheduleRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.spanner.admin.database.v1.CreateBackupScheduleRequest) + return object; + var message = new $root.google.spanner.admin.database.v1.CreateBackupScheduleRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.backupScheduleId != null) + message.backupScheduleId = String(object.backupScheduleId); + if (object.backupSchedule != null) { + if (typeof object.backupSchedule !== "object") + throw TypeError(".google.spanner.admin.database.v1.CreateBackupScheduleRequest.backupSchedule: object expected"); + message.backupSchedule = $root.google.spanner.admin.database.v1.BackupSchedule.fromObject(object.backupSchedule); + } + return message; + }; + + /** + * Creates a plain object from a CreateBackupScheduleRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.spanner.admin.database.v1.CreateBackupScheduleRequest + * @static + * @param {google.spanner.admin.database.v1.CreateBackupScheduleRequest} message CreateBackupScheduleRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateBackupScheduleRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.backupScheduleId = ""; + object.backupSchedule = null; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.backupScheduleId != null && message.hasOwnProperty("backupScheduleId")) + object.backupScheduleId = message.backupScheduleId; + if (message.backupSchedule != null && message.hasOwnProperty("backupSchedule")) + object.backupSchedule = $root.google.spanner.admin.database.v1.BackupSchedule.toObject(message.backupSchedule, options); + return object; + }; + + /** + * Converts this CreateBackupScheduleRequest to JSON. + * @function toJSON + * @memberof google.spanner.admin.database.v1.CreateBackupScheduleRequest + * @instance + * @returns {Object.} JSON object + */ + CreateBackupScheduleRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CreateBackupScheduleRequest + * @function getTypeUrl + * @memberof google.spanner.admin.database.v1.CreateBackupScheduleRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CreateBackupScheduleRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.spanner.admin.database.v1.CreateBackupScheduleRequest"; + }; + + return CreateBackupScheduleRequest; + })(); + + v1.GetBackupScheduleRequest = (function() { + + /** + * Properties of a GetBackupScheduleRequest. + * @memberof google.spanner.admin.database.v1 + * @interface IGetBackupScheduleRequest + * @property {string|null} [name] GetBackupScheduleRequest name + */ + + /** + * Constructs a new GetBackupScheduleRequest. + * @memberof google.spanner.admin.database.v1 + * @classdesc Represents a GetBackupScheduleRequest. + * @implements IGetBackupScheduleRequest + * @constructor + * @param {google.spanner.admin.database.v1.IGetBackupScheduleRequest=} [properties] Properties to set + */ + function GetBackupScheduleRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetBackupScheduleRequest name. + * @member {string} name + * @memberof google.spanner.admin.database.v1.GetBackupScheduleRequest + * @instance + */ + GetBackupScheduleRequest.prototype.name = ""; + + /** + * Creates a new GetBackupScheduleRequest instance using the specified properties. + * @function create + * @memberof google.spanner.admin.database.v1.GetBackupScheduleRequest + * @static + * @param {google.spanner.admin.database.v1.IGetBackupScheduleRequest=} [properties] Properties to set + * @returns {google.spanner.admin.database.v1.GetBackupScheduleRequest} GetBackupScheduleRequest instance + */ + GetBackupScheduleRequest.create = function create(properties) { + return new GetBackupScheduleRequest(properties); + }; + + /** + * Encodes the specified GetBackupScheduleRequest message. Does not implicitly {@link google.spanner.admin.database.v1.GetBackupScheduleRequest.verify|verify} messages. + * @function encode + * @memberof google.spanner.admin.database.v1.GetBackupScheduleRequest + * @static + * @param {google.spanner.admin.database.v1.IGetBackupScheduleRequest} message GetBackupScheduleRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetBackupScheduleRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified GetBackupScheduleRequest message, length delimited. Does not implicitly {@link google.spanner.admin.database.v1.GetBackupScheduleRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.spanner.admin.database.v1.GetBackupScheduleRequest + * @static + * @param {google.spanner.admin.database.v1.IGetBackupScheduleRequest} message GetBackupScheduleRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetBackupScheduleRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetBackupScheduleRequest message from the specified reader or buffer. + * @function decode + * @memberof google.spanner.admin.database.v1.GetBackupScheduleRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.spanner.admin.database.v1.GetBackupScheduleRequest} GetBackupScheduleRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetBackupScheduleRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.spanner.admin.database.v1.GetBackupScheduleRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetBackupScheduleRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.spanner.admin.database.v1.GetBackupScheduleRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.spanner.admin.database.v1.GetBackupScheduleRequest} GetBackupScheduleRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetBackupScheduleRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetBackupScheduleRequest message. + * @function verify + * @memberof google.spanner.admin.database.v1.GetBackupScheduleRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetBackupScheduleRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a GetBackupScheduleRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.spanner.admin.database.v1.GetBackupScheduleRequest + * @static + * @param {Object.} object Plain object + * @returns {google.spanner.admin.database.v1.GetBackupScheduleRequest} GetBackupScheduleRequest + */ + GetBackupScheduleRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.spanner.admin.database.v1.GetBackupScheduleRequest) + return object; + var message = new $root.google.spanner.admin.database.v1.GetBackupScheduleRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetBackupScheduleRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.spanner.admin.database.v1.GetBackupScheduleRequest + * @static + * @param {google.spanner.admin.database.v1.GetBackupScheduleRequest} message GetBackupScheduleRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetBackupScheduleRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this GetBackupScheduleRequest to JSON. + * @function toJSON + * @memberof google.spanner.admin.database.v1.GetBackupScheduleRequest + * @instance + * @returns {Object.} JSON object + */ + GetBackupScheduleRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GetBackupScheduleRequest + * @function getTypeUrl + * @memberof google.spanner.admin.database.v1.GetBackupScheduleRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetBackupScheduleRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.spanner.admin.database.v1.GetBackupScheduleRequest"; + }; + + return GetBackupScheduleRequest; + })(); + + v1.DeleteBackupScheduleRequest = (function() { + + /** + * Properties of a DeleteBackupScheduleRequest. + * @memberof google.spanner.admin.database.v1 + * @interface IDeleteBackupScheduleRequest + * @property {string|null} [name] DeleteBackupScheduleRequest name + */ + + /** + * Constructs a new DeleteBackupScheduleRequest. + * @memberof google.spanner.admin.database.v1 + * @classdesc Represents a DeleteBackupScheduleRequest. + * @implements IDeleteBackupScheduleRequest + * @constructor + * @param {google.spanner.admin.database.v1.IDeleteBackupScheduleRequest=} [properties] Properties to set + */ + function DeleteBackupScheduleRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DeleteBackupScheduleRequest name. + * @member {string} name + * @memberof google.spanner.admin.database.v1.DeleteBackupScheduleRequest + * @instance + */ + DeleteBackupScheduleRequest.prototype.name = ""; + + /** + * Creates a new DeleteBackupScheduleRequest instance using the specified properties. + * @function create + * @memberof google.spanner.admin.database.v1.DeleteBackupScheduleRequest + * @static + * @param {google.spanner.admin.database.v1.IDeleteBackupScheduleRequest=} [properties] Properties to set + * @returns {google.spanner.admin.database.v1.DeleteBackupScheduleRequest} DeleteBackupScheduleRequest instance + */ + DeleteBackupScheduleRequest.create = function create(properties) { + return new DeleteBackupScheduleRequest(properties); + }; + + /** + * Encodes the specified DeleteBackupScheduleRequest message. Does not implicitly {@link google.spanner.admin.database.v1.DeleteBackupScheduleRequest.verify|verify} messages. + * @function encode + * @memberof google.spanner.admin.database.v1.DeleteBackupScheduleRequest + * @static + * @param {google.spanner.admin.database.v1.IDeleteBackupScheduleRequest} message DeleteBackupScheduleRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteBackupScheduleRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified DeleteBackupScheduleRequest message, length delimited. Does not implicitly {@link google.spanner.admin.database.v1.DeleteBackupScheduleRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.spanner.admin.database.v1.DeleteBackupScheduleRequest + * @static + * @param {google.spanner.admin.database.v1.IDeleteBackupScheduleRequest} message DeleteBackupScheduleRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteBackupScheduleRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteBackupScheduleRequest message from the specified reader or buffer. + * @function decode + * @memberof google.spanner.admin.database.v1.DeleteBackupScheduleRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.spanner.admin.database.v1.DeleteBackupScheduleRequest} DeleteBackupScheduleRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteBackupScheduleRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.spanner.admin.database.v1.DeleteBackupScheduleRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DeleteBackupScheduleRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.spanner.admin.database.v1.DeleteBackupScheduleRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.spanner.admin.database.v1.DeleteBackupScheduleRequest} DeleteBackupScheduleRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteBackupScheduleRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteBackupScheduleRequest message. + * @function verify + * @memberof google.spanner.admin.database.v1.DeleteBackupScheduleRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteBackupScheduleRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a DeleteBackupScheduleRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.spanner.admin.database.v1.DeleteBackupScheduleRequest + * @static + * @param {Object.} object Plain object + * @returns {google.spanner.admin.database.v1.DeleteBackupScheduleRequest} DeleteBackupScheduleRequest + */ + DeleteBackupScheduleRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.spanner.admin.database.v1.DeleteBackupScheduleRequest) + return object; + var message = new $root.google.spanner.admin.database.v1.DeleteBackupScheduleRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a DeleteBackupScheduleRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.spanner.admin.database.v1.DeleteBackupScheduleRequest + * @static + * @param {google.spanner.admin.database.v1.DeleteBackupScheduleRequest} message DeleteBackupScheduleRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteBackupScheduleRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this DeleteBackupScheduleRequest to JSON. + * @function toJSON + * @memberof google.spanner.admin.database.v1.DeleteBackupScheduleRequest + * @instance + * @returns {Object.} JSON object + */ + DeleteBackupScheduleRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DeleteBackupScheduleRequest + * @function getTypeUrl + * @memberof google.spanner.admin.database.v1.DeleteBackupScheduleRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeleteBackupScheduleRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.spanner.admin.database.v1.DeleteBackupScheduleRequest"; + }; + + return DeleteBackupScheduleRequest; + })(); + + v1.ListBackupSchedulesRequest = (function() { + + /** + * Properties of a ListBackupSchedulesRequest. + * @memberof google.spanner.admin.database.v1 + * @interface IListBackupSchedulesRequest + * @property {string|null} [parent] ListBackupSchedulesRequest parent + * @property {number|null} [pageSize] ListBackupSchedulesRequest pageSize + * @property {string|null} [pageToken] ListBackupSchedulesRequest pageToken + */ + + /** + * Constructs a new ListBackupSchedulesRequest. + * @memberof google.spanner.admin.database.v1 + * @classdesc Represents a ListBackupSchedulesRequest. + * @implements IListBackupSchedulesRequest + * @constructor + * @param {google.spanner.admin.database.v1.IListBackupSchedulesRequest=} [properties] Properties to set + */ + function ListBackupSchedulesRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListBackupSchedulesRequest parent. + * @member {string} parent + * @memberof google.spanner.admin.database.v1.ListBackupSchedulesRequest + * @instance + */ + ListBackupSchedulesRequest.prototype.parent = ""; + + /** + * ListBackupSchedulesRequest pageSize. + * @member {number} pageSize + * @memberof google.spanner.admin.database.v1.ListBackupSchedulesRequest + * @instance + */ + ListBackupSchedulesRequest.prototype.pageSize = 0; + + /** + * ListBackupSchedulesRequest pageToken. + * @member {string} pageToken + * @memberof google.spanner.admin.database.v1.ListBackupSchedulesRequest + * @instance + */ + ListBackupSchedulesRequest.prototype.pageToken = ""; + + /** + * Creates a new ListBackupSchedulesRequest instance using the specified properties. + * @function create + * @memberof google.spanner.admin.database.v1.ListBackupSchedulesRequest + * @static + * @param {google.spanner.admin.database.v1.IListBackupSchedulesRequest=} [properties] Properties to set + * @returns {google.spanner.admin.database.v1.ListBackupSchedulesRequest} ListBackupSchedulesRequest instance + */ + ListBackupSchedulesRequest.create = function create(properties) { + return new ListBackupSchedulesRequest(properties); + }; + + /** + * Encodes the specified ListBackupSchedulesRequest message. Does not implicitly {@link google.spanner.admin.database.v1.ListBackupSchedulesRequest.verify|verify} messages. + * @function encode + * @memberof google.spanner.admin.database.v1.ListBackupSchedulesRequest + * @static + * @param {google.spanner.admin.database.v1.IListBackupSchedulesRequest} message ListBackupSchedulesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListBackupSchedulesRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.pageToken); + return writer; + }; + + /** + * Encodes the specified ListBackupSchedulesRequest message, length delimited. Does not implicitly {@link google.spanner.admin.database.v1.ListBackupSchedulesRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.spanner.admin.database.v1.ListBackupSchedulesRequest + * @static + * @param {google.spanner.admin.database.v1.IListBackupSchedulesRequest} message ListBackupSchedulesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListBackupSchedulesRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListBackupSchedulesRequest message from the specified reader or buffer. + * @function decode + * @memberof google.spanner.admin.database.v1.ListBackupSchedulesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.spanner.admin.database.v1.ListBackupSchedulesRequest} ListBackupSchedulesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListBackupSchedulesRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.spanner.admin.database.v1.ListBackupSchedulesRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.pageSize = reader.int32(); + break; + } + case 4: { + message.pageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListBackupSchedulesRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.spanner.admin.database.v1.ListBackupSchedulesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.spanner.admin.database.v1.ListBackupSchedulesRequest} ListBackupSchedulesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListBackupSchedulesRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListBackupSchedulesRequest message. + * @function verify + * @memberof google.spanner.admin.database.v1.ListBackupSchedulesRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListBackupSchedulesRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + return null; + }; + + /** + * Creates a ListBackupSchedulesRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.spanner.admin.database.v1.ListBackupSchedulesRequest + * @static + * @param {Object.} object Plain object + * @returns {google.spanner.admin.database.v1.ListBackupSchedulesRequest} ListBackupSchedulesRequest + */ + ListBackupSchedulesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.spanner.admin.database.v1.ListBackupSchedulesRequest) + return object; + var message = new $root.google.spanner.admin.database.v1.ListBackupSchedulesRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + return message; + }; + + /** + * Creates a plain object from a ListBackupSchedulesRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.spanner.admin.database.v1.ListBackupSchedulesRequest + * @static + * @param {google.spanner.admin.database.v1.ListBackupSchedulesRequest} message ListBackupSchedulesRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListBackupSchedulesRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.pageSize = 0; + object.pageToken = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + return object; + }; + + /** + * Converts this ListBackupSchedulesRequest to JSON. + * @function toJSON + * @memberof google.spanner.admin.database.v1.ListBackupSchedulesRequest + * @instance + * @returns {Object.} JSON object + */ + ListBackupSchedulesRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListBackupSchedulesRequest + * @function getTypeUrl + * @memberof google.spanner.admin.database.v1.ListBackupSchedulesRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListBackupSchedulesRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.spanner.admin.database.v1.ListBackupSchedulesRequest"; + }; + + return ListBackupSchedulesRequest; + })(); + + v1.ListBackupSchedulesResponse = (function() { + + /** + * Properties of a ListBackupSchedulesResponse. + * @memberof google.spanner.admin.database.v1 + * @interface IListBackupSchedulesResponse + * @property {Array.|null} [backupSchedules] ListBackupSchedulesResponse backupSchedules + * @property {string|null} [nextPageToken] ListBackupSchedulesResponse nextPageToken + */ + + /** + * Constructs a new ListBackupSchedulesResponse. + * @memberof google.spanner.admin.database.v1 + * @classdesc Represents a ListBackupSchedulesResponse. + * @implements IListBackupSchedulesResponse + * @constructor + * @param {google.spanner.admin.database.v1.IListBackupSchedulesResponse=} [properties] Properties to set + */ + function ListBackupSchedulesResponse(properties) { + this.backupSchedules = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListBackupSchedulesResponse backupSchedules. + * @member {Array.} backupSchedules + * @memberof google.spanner.admin.database.v1.ListBackupSchedulesResponse + * @instance + */ + ListBackupSchedulesResponse.prototype.backupSchedules = $util.emptyArray; + + /** + * ListBackupSchedulesResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.spanner.admin.database.v1.ListBackupSchedulesResponse + * @instance + */ + ListBackupSchedulesResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListBackupSchedulesResponse instance using the specified properties. + * @function create + * @memberof google.spanner.admin.database.v1.ListBackupSchedulesResponse + * @static + * @param {google.spanner.admin.database.v1.IListBackupSchedulesResponse=} [properties] Properties to set + * @returns {google.spanner.admin.database.v1.ListBackupSchedulesResponse} ListBackupSchedulesResponse instance + */ + ListBackupSchedulesResponse.create = function create(properties) { + return new ListBackupSchedulesResponse(properties); + }; + + /** + * Encodes the specified ListBackupSchedulesResponse message. Does not implicitly {@link google.spanner.admin.database.v1.ListBackupSchedulesResponse.verify|verify} messages. + * @function encode + * @memberof google.spanner.admin.database.v1.ListBackupSchedulesResponse + * @static + * @param {google.spanner.admin.database.v1.IListBackupSchedulesResponse} message ListBackupSchedulesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListBackupSchedulesResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.backupSchedules != null && message.backupSchedules.length) + for (var i = 0; i < message.backupSchedules.length; ++i) + $root.google.spanner.admin.database.v1.BackupSchedule.encode(message.backupSchedules[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + return writer; + }; + + /** + * Encodes the specified ListBackupSchedulesResponse message, length delimited. Does not implicitly {@link google.spanner.admin.database.v1.ListBackupSchedulesResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.spanner.admin.database.v1.ListBackupSchedulesResponse + * @static + * @param {google.spanner.admin.database.v1.IListBackupSchedulesResponse} message ListBackupSchedulesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListBackupSchedulesResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListBackupSchedulesResponse message from the specified reader or buffer. + * @function decode + * @memberof google.spanner.admin.database.v1.ListBackupSchedulesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.spanner.admin.database.v1.ListBackupSchedulesResponse} ListBackupSchedulesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListBackupSchedulesResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.spanner.admin.database.v1.ListBackupSchedulesResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.backupSchedules && message.backupSchedules.length)) + message.backupSchedules = []; + message.backupSchedules.push($root.google.spanner.admin.database.v1.BackupSchedule.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListBackupSchedulesResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.spanner.admin.database.v1.ListBackupSchedulesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.spanner.admin.database.v1.ListBackupSchedulesResponse} ListBackupSchedulesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListBackupSchedulesResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListBackupSchedulesResponse message. + * @function verify + * @memberof google.spanner.admin.database.v1.ListBackupSchedulesResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListBackupSchedulesResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.backupSchedules != null && message.hasOwnProperty("backupSchedules")) { + if (!Array.isArray(message.backupSchedules)) + return "backupSchedules: array expected"; + for (var i = 0; i < message.backupSchedules.length; ++i) { + var error = $root.google.spanner.admin.database.v1.BackupSchedule.verify(message.backupSchedules[i]); + if (error) + return "backupSchedules." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListBackupSchedulesResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.spanner.admin.database.v1.ListBackupSchedulesResponse + * @static + * @param {Object.} object Plain object + * @returns {google.spanner.admin.database.v1.ListBackupSchedulesResponse} ListBackupSchedulesResponse + */ + ListBackupSchedulesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.spanner.admin.database.v1.ListBackupSchedulesResponse) + return object; + var message = new $root.google.spanner.admin.database.v1.ListBackupSchedulesResponse(); + if (object.backupSchedules) { + if (!Array.isArray(object.backupSchedules)) + throw TypeError(".google.spanner.admin.database.v1.ListBackupSchedulesResponse.backupSchedules: array expected"); + message.backupSchedules = []; + for (var i = 0; i < object.backupSchedules.length; ++i) { + if (typeof object.backupSchedules[i] !== "object") + throw TypeError(".google.spanner.admin.database.v1.ListBackupSchedulesResponse.backupSchedules: object expected"); + message.backupSchedules[i] = $root.google.spanner.admin.database.v1.BackupSchedule.fromObject(object.backupSchedules[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListBackupSchedulesResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.spanner.admin.database.v1.ListBackupSchedulesResponse + * @static + * @param {google.spanner.admin.database.v1.ListBackupSchedulesResponse} message ListBackupSchedulesResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListBackupSchedulesResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.backupSchedules = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.backupSchedules && message.backupSchedules.length) { + object.backupSchedules = []; + for (var j = 0; j < message.backupSchedules.length; ++j) + object.backupSchedules[j] = $root.google.spanner.admin.database.v1.BackupSchedule.toObject(message.backupSchedules[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this ListBackupSchedulesResponse to JSON. + * @function toJSON + * @memberof google.spanner.admin.database.v1.ListBackupSchedulesResponse + * @instance + * @returns {Object.} JSON object + */ + ListBackupSchedulesResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListBackupSchedulesResponse + * @function getTypeUrl + * @memberof google.spanner.admin.database.v1.ListBackupSchedulesResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListBackupSchedulesResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.spanner.admin.database.v1.ListBackupSchedulesResponse"; + }; + + return ListBackupSchedulesResponse; + })(); + + v1.UpdateBackupScheduleRequest = (function() { + + /** + * Properties of an UpdateBackupScheduleRequest. + * @memberof google.spanner.admin.database.v1 + * @interface IUpdateBackupScheduleRequest + * @property {google.spanner.admin.database.v1.IBackupSchedule|null} [backupSchedule] UpdateBackupScheduleRequest backupSchedule + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateBackupScheduleRequest updateMask + */ + + /** + * Constructs a new UpdateBackupScheduleRequest. + * @memberof google.spanner.admin.database.v1 + * @classdesc Represents an UpdateBackupScheduleRequest. + * @implements IUpdateBackupScheduleRequest + * @constructor + * @param {google.spanner.admin.database.v1.IUpdateBackupScheduleRequest=} [properties] Properties to set + */ + function UpdateBackupScheduleRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UpdateBackupScheduleRequest backupSchedule. + * @member {google.spanner.admin.database.v1.IBackupSchedule|null|undefined} backupSchedule + * @memberof google.spanner.admin.database.v1.UpdateBackupScheduleRequest + * @instance + */ + UpdateBackupScheduleRequest.prototype.backupSchedule = null; + + /** + * UpdateBackupScheduleRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.spanner.admin.database.v1.UpdateBackupScheduleRequest + * @instance + */ + UpdateBackupScheduleRequest.prototype.updateMask = null; + + /** + * Creates a new UpdateBackupScheduleRequest instance using the specified properties. + * @function create + * @memberof google.spanner.admin.database.v1.UpdateBackupScheduleRequest + * @static + * @param {google.spanner.admin.database.v1.IUpdateBackupScheduleRequest=} [properties] Properties to set + * @returns {google.spanner.admin.database.v1.UpdateBackupScheduleRequest} UpdateBackupScheduleRequest instance + */ + UpdateBackupScheduleRequest.create = function create(properties) { + return new UpdateBackupScheduleRequest(properties); + }; + + /** + * Encodes the specified UpdateBackupScheduleRequest message. Does not implicitly {@link google.spanner.admin.database.v1.UpdateBackupScheduleRequest.verify|verify} messages. + * @function encode + * @memberof google.spanner.admin.database.v1.UpdateBackupScheduleRequest + * @static + * @param {google.spanner.admin.database.v1.IUpdateBackupScheduleRequest} message UpdateBackupScheduleRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateBackupScheduleRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.backupSchedule != null && Object.hasOwnProperty.call(message, "backupSchedule")) + $root.google.spanner.admin.database.v1.BackupSchedule.encode(message.backupSchedule, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified UpdateBackupScheduleRequest message, length delimited. Does not implicitly {@link google.spanner.admin.database.v1.UpdateBackupScheduleRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.spanner.admin.database.v1.UpdateBackupScheduleRequest + * @static + * @param {google.spanner.admin.database.v1.IUpdateBackupScheduleRequest} message UpdateBackupScheduleRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateBackupScheduleRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UpdateBackupScheduleRequest message from the specified reader or buffer. + * @function decode + * @memberof google.spanner.admin.database.v1.UpdateBackupScheduleRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.spanner.admin.database.v1.UpdateBackupScheduleRequest} UpdateBackupScheduleRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateBackupScheduleRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.spanner.admin.database.v1.UpdateBackupScheduleRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.backupSchedule = $root.google.spanner.admin.database.v1.BackupSchedule.decode(reader, reader.uint32()); + break; + } + case 2: { + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an UpdateBackupScheduleRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.spanner.admin.database.v1.UpdateBackupScheduleRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.spanner.admin.database.v1.UpdateBackupScheduleRequest} UpdateBackupScheduleRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateBackupScheduleRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UpdateBackupScheduleRequest message. + * @function verify + * @memberof google.spanner.admin.database.v1.UpdateBackupScheduleRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateBackupScheduleRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.backupSchedule != null && message.hasOwnProperty("backupSchedule")) { + var error = $root.google.spanner.admin.database.v1.BackupSchedule.verify(message.backupSchedule); + if (error) + return "backupSchedule." + error; + } + if (message.updateMask != null && message.hasOwnProperty("updateMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + if (error) + return "updateMask." + error; + } + return null; + }; + + /** + * Creates an UpdateBackupScheduleRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.spanner.admin.database.v1.UpdateBackupScheduleRequest + * @static + * @param {Object.} object Plain object + * @returns {google.spanner.admin.database.v1.UpdateBackupScheduleRequest} UpdateBackupScheduleRequest + */ + UpdateBackupScheduleRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.spanner.admin.database.v1.UpdateBackupScheduleRequest) + return object; + var message = new $root.google.spanner.admin.database.v1.UpdateBackupScheduleRequest(); + if (object.backupSchedule != null) { + if (typeof object.backupSchedule !== "object") + throw TypeError(".google.spanner.admin.database.v1.UpdateBackupScheduleRequest.backupSchedule: object expected"); + message.backupSchedule = $root.google.spanner.admin.database.v1.BackupSchedule.fromObject(object.backupSchedule); + } + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.spanner.admin.database.v1.UpdateBackupScheduleRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + return message; + }; + + /** + * Creates a plain object from an UpdateBackupScheduleRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.spanner.admin.database.v1.UpdateBackupScheduleRequest + * @static + * @param {google.spanner.admin.database.v1.UpdateBackupScheduleRequest} message UpdateBackupScheduleRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdateBackupScheduleRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.backupSchedule = null; + object.updateMask = null; + } + if (message.backupSchedule != null && message.hasOwnProperty("backupSchedule")) + object.backupSchedule = $root.google.spanner.admin.database.v1.BackupSchedule.toObject(message.backupSchedule, options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + return object; + }; + + /** + * Converts this UpdateBackupScheduleRequest to JSON. + * @function toJSON + * @memberof google.spanner.admin.database.v1.UpdateBackupScheduleRequest + * @instance + * @returns {Object.} JSON object + */ + UpdateBackupScheduleRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for UpdateBackupScheduleRequest + * @function getTypeUrl + * @memberof google.spanner.admin.database.v1.UpdateBackupScheduleRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UpdateBackupScheduleRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.spanner.admin.database.v1.UpdateBackupScheduleRequest"; + }; + + return UpdateBackupScheduleRequest; + })(); + v1.DatabaseAdmin = (function() { /** @@ -23578,6 +26034,171 @@ * @variation 2 */ + /** + * Callback as used by {@link google.spanner.admin.database.v1.DatabaseAdmin|createBackupSchedule}. + * @memberof google.spanner.admin.database.v1.DatabaseAdmin + * @typedef CreateBackupScheduleCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.spanner.admin.database.v1.BackupSchedule} [response] BackupSchedule + */ + + /** + * Calls CreateBackupSchedule. + * @function createBackupSchedule + * @memberof google.spanner.admin.database.v1.DatabaseAdmin + * @instance + * @param {google.spanner.admin.database.v1.ICreateBackupScheduleRequest} request CreateBackupScheduleRequest message or plain object + * @param {google.spanner.admin.database.v1.DatabaseAdmin.CreateBackupScheduleCallback} callback Node-style callback called with the error, if any, and BackupSchedule + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(DatabaseAdmin.prototype.createBackupSchedule = function createBackupSchedule(request, callback) { + return this.rpcCall(createBackupSchedule, $root.google.spanner.admin.database.v1.CreateBackupScheduleRequest, $root.google.spanner.admin.database.v1.BackupSchedule, request, callback); + }, "name", { value: "CreateBackupSchedule" }); + + /** + * Calls CreateBackupSchedule. + * @function createBackupSchedule + * @memberof google.spanner.admin.database.v1.DatabaseAdmin + * @instance + * @param {google.spanner.admin.database.v1.ICreateBackupScheduleRequest} request CreateBackupScheduleRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.spanner.admin.database.v1.DatabaseAdmin|getBackupSchedule}. + * @memberof google.spanner.admin.database.v1.DatabaseAdmin + * @typedef GetBackupScheduleCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.spanner.admin.database.v1.BackupSchedule} [response] BackupSchedule + */ + + /** + * Calls GetBackupSchedule. + * @function getBackupSchedule + * @memberof google.spanner.admin.database.v1.DatabaseAdmin + * @instance + * @param {google.spanner.admin.database.v1.IGetBackupScheduleRequest} request GetBackupScheduleRequest message or plain object + * @param {google.spanner.admin.database.v1.DatabaseAdmin.GetBackupScheduleCallback} callback Node-style callback called with the error, if any, and BackupSchedule + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(DatabaseAdmin.prototype.getBackupSchedule = function getBackupSchedule(request, callback) { + return this.rpcCall(getBackupSchedule, $root.google.spanner.admin.database.v1.GetBackupScheduleRequest, $root.google.spanner.admin.database.v1.BackupSchedule, request, callback); + }, "name", { value: "GetBackupSchedule" }); + + /** + * Calls GetBackupSchedule. + * @function getBackupSchedule + * @memberof google.spanner.admin.database.v1.DatabaseAdmin + * @instance + * @param {google.spanner.admin.database.v1.IGetBackupScheduleRequest} request GetBackupScheduleRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.spanner.admin.database.v1.DatabaseAdmin|updateBackupSchedule}. + * @memberof google.spanner.admin.database.v1.DatabaseAdmin + * @typedef UpdateBackupScheduleCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.spanner.admin.database.v1.BackupSchedule} [response] BackupSchedule + */ + + /** + * Calls UpdateBackupSchedule. + * @function updateBackupSchedule + * @memberof google.spanner.admin.database.v1.DatabaseAdmin + * @instance + * @param {google.spanner.admin.database.v1.IUpdateBackupScheduleRequest} request UpdateBackupScheduleRequest message or plain object + * @param {google.spanner.admin.database.v1.DatabaseAdmin.UpdateBackupScheduleCallback} callback Node-style callback called with the error, if any, and BackupSchedule + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(DatabaseAdmin.prototype.updateBackupSchedule = function updateBackupSchedule(request, callback) { + return this.rpcCall(updateBackupSchedule, $root.google.spanner.admin.database.v1.UpdateBackupScheduleRequest, $root.google.spanner.admin.database.v1.BackupSchedule, request, callback); + }, "name", { value: "UpdateBackupSchedule" }); + + /** + * Calls UpdateBackupSchedule. + * @function updateBackupSchedule + * @memberof google.spanner.admin.database.v1.DatabaseAdmin + * @instance + * @param {google.spanner.admin.database.v1.IUpdateBackupScheduleRequest} request UpdateBackupScheduleRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.spanner.admin.database.v1.DatabaseAdmin|deleteBackupSchedule}. + * @memberof google.spanner.admin.database.v1.DatabaseAdmin + * @typedef DeleteBackupScheduleCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.protobuf.Empty} [response] Empty + */ + + /** + * Calls DeleteBackupSchedule. + * @function deleteBackupSchedule + * @memberof google.spanner.admin.database.v1.DatabaseAdmin + * @instance + * @param {google.spanner.admin.database.v1.IDeleteBackupScheduleRequest} request DeleteBackupScheduleRequest message or plain object + * @param {google.spanner.admin.database.v1.DatabaseAdmin.DeleteBackupScheduleCallback} callback Node-style callback called with the error, if any, and Empty + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(DatabaseAdmin.prototype.deleteBackupSchedule = function deleteBackupSchedule(request, callback) { + return this.rpcCall(deleteBackupSchedule, $root.google.spanner.admin.database.v1.DeleteBackupScheduleRequest, $root.google.protobuf.Empty, request, callback); + }, "name", { value: "DeleteBackupSchedule" }); + + /** + * Calls DeleteBackupSchedule. + * @function deleteBackupSchedule + * @memberof google.spanner.admin.database.v1.DatabaseAdmin + * @instance + * @param {google.spanner.admin.database.v1.IDeleteBackupScheduleRequest} request DeleteBackupScheduleRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.spanner.admin.database.v1.DatabaseAdmin|listBackupSchedules}. + * @memberof google.spanner.admin.database.v1.DatabaseAdmin + * @typedef ListBackupSchedulesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.spanner.admin.database.v1.ListBackupSchedulesResponse} [response] ListBackupSchedulesResponse + */ + + /** + * Calls ListBackupSchedules. + * @function listBackupSchedules + * @memberof google.spanner.admin.database.v1.DatabaseAdmin + * @instance + * @param {google.spanner.admin.database.v1.IListBackupSchedulesRequest} request ListBackupSchedulesRequest message or plain object + * @param {google.spanner.admin.database.v1.DatabaseAdmin.ListBackupSchedulesCallback} callback Node-style callback called with the error, if any, and ListBackupSchedulesResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(DatabaseAdmin.prototype.listBackupSchedules = function listBackupSchedules(request, callback) { + return this.rpcCall(listBackupSchedules, $root.google.spanner.admin.database.v1.ListBackupSchedulesRequest, $root.google.spanner.admin.database.v1.ListBackupSchedulesResponse, request, callback); + }, "name", { value: "ListBackupSchedules" }); + + /** + * Calls ListBackupSchedules. + * @function listBackupSchedules + * @memberof google.spanner.admin.database.v1.DatabaseAdmin + * @instance + * @param {google.spanner.admin.database.v1.IListBackupSchedulesRequest} request ListBackupSchedulesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + return DatabaseAdmin; })(); @@ -42027,6 +44648,7 @@ * @property {google.spanner.executor.v1.IGenerateDbPartitionsForQueryAction|null} [generateDbPartitionsQuery] SpannerAction generateDbPartitionsQuery * @property {google.spanner.executor.v1.IExecutePartitionAction|null} [executePartition] SpannerAction executePartition * @property {google.spanner.executor.v1.IExecuteChangeStreamQuery|null} [executeChangeStreamQuery] SpannerAction executeChangeStreamQuery + * @property {google.spanner.executor.v1.IQueryCancellationAction|null} [queryCancellation] SpannerAction queryCancellation */ /** @@ -42188,17 +44810,25 @@ */ SpannerAction.prototype.executeChangeStreamQuery = null; + /** + * SpannerAction queryCancellation. + * @member {google.spanner.executor.v1.IQueryCancellationAction|null|undefined} queryCancellation + * @memberof google.spanner.executor.v1.SpannerAction + * @instance + */ + SpannerAction.prototype.queryCancellation = null; + // OneOf field names bound to virtual getters and setters var $oneOfFields; /** * SpannerAction action. - * @member {"start"|"finish"|"read"|"query"|"mutation"|"dml"|"batchDml"|"write"|"partitionedUpdate"|"admin"|"startBatchTxn"|"closeBatchTxn"|"generateDbPartitionsRead"|"generateDbPartitionsQuery"|"executePartition"|"executeChangeStreamQuery"|undefined} action + * @member {"start"|"finish"|"read"|"query"|"mutation"|"dml"|"batchDml"|"write"|"partitionedUpdate"|"admin"|"startBatchTxn"|"closeBatchTxn"|"generateDbPartitionsRead"|"generateDbPartitionsQuery"|"executePartition"|"executeChangeStreamQuery"|"queryCancellation"|undefined} action * @memberof google.spanner.executor.v1.SpannerAction * @instance */ Object.defineProperty(SpannerAction.prototype, "action", { - get: $util.oneOfGetter($oneOfFields = ["start", "finish", "read", "query", "mutation", "dml", "batchDml", "write", "partitionedUpdate", "admin", "startBatchTxn", "closeBatchTxn", "generateDbPartitionsRead", "generateDbPartitionsQuery", "executePartition", "executeChangeStreamQuery"]), + get: $util.oneOfGetter($oneOfFields = ["start", "finish", "read", "query", "mutation", "dml", "batchDml", "write", "partitionedUpdate", "admin", "startBatchTxn", "closeBatchTxn", "generateDbPartitionsRead", "generateDbPartitionsQuery", "executePartition", "executeChangeStreamQuery", "queryCancellation"]), set: $util.oneOfSetter($oneOfFields) }); @@ -42262,6 +44892,8 @@ $root.google.spanner.executor.v1.ExecutePartitionAction.encode(message.executePartition, writer.uint32(/* id 44, wireType 2 =*/354).fork()).ldelim(); if (message.executeChangeStreamQuery != null && Object.hasOwnProperty.call(message, "executeChangeStreamQuery")) $root.google.spanner.executor.v1.ExecuteChangeStreamQuery.encode(message.executeChangeStreamQuery, writer.uint32(/* id 50, wireType 2 =*/402).fork()).ldelim(); + if (message.queryCancellation != null && Object.hasOwnProperty.call(message, "queryCancellation")) + $root.google.spanner.executor.v1.QueryCancellationAction.encode(message.queryCancellation, writer.uint32(/* id 51, wireType 2 =*/410).fork()).ldelim(); return writer; }; @@ -42368,6 +45000,10 @@ message.executeChangeStreamQuery = $root.google.spanner.executor.v1.ExecuteChangeStreamQuery.decode(reader, reader.uint32()); break; } + case 51: { + message.queryCancellation = $root.google.spanner.executor.v1.QueryCancellationAction.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -42570,6 +45206,16 @@ return "executeChangeStreamQuery." + error; } } + if (message.queryCancellation != null && message.hasOwnProperty("queryCancellation")) { + if (properties.action === 1) + return "action: multiple values"; + properties.action = 1; + { + var error = $root.google.spanner.executor.v1.QueryCancellationAction.verify(message.queryCancellation); + if (error) + return "queryCancellation." + error; + } + } return null; }; @@ -42672,6 +45318,11 @@ throw TypeError(".google.spanner.executor.v1.SpannerAction.executeChangeStreamQuery: object expected"); message.executeChangeStreamQuery = $root.google.spanner.executor.v1.ExecuteChangeStreamQuery.fromObject(object.executeChangeStreamQuery); } + if (object.queryCancellation != null) { + if (typeof object.queryCancellation !== "object") + throw TypeError(".google.spanner.executor.v1.SpannerAction.queryCancellation: object expected"); + message.queryCancellation = $root.google.spanner.executor.v1.QueryCancellationAction.fromObject(object.queryCancellation); + } return message; }; @@ -42776,6 +45427,11 @@ if (options.oneofs) object.action = "executeChangeStreamQuery"; } + if (message.queryCancellation != null && message.hasOwnProperty("queryCancellation")) { + object.queryCancellation = $root.google.spanner.executor.v1.QueryCancellationAction.toObject(message.queryCancellation, options); + if (options.oneofs) + object.action = "queryCancellation"; + } return object; }; @@ -58406,6 +61062,233 @@ return GetOperationAction; })(); + v1.QueryCancellationAction = (function() { + + /** + * Properties of a QueryCancellationAction. + * @memberof google.spanner.executor.v1 + * @interface IQueryCancellationAction + * @property {string|null} [longRunningSql] QueryCancellationAction longRunningSql + * @property {string|null} [cancelQuery] QueryCancellationAction cancelQuery + */ + + /** + * Constructs a new QueryCancellationAction. + * @memberof google.spanner.executor.v1 + * @classdesc Represents a QueryCancellationAction. + * @implements IQueryCancellationAction + * @constructor + * @param {google.spanner.executor.v1.IQueryCancellationAction=} [properties] Properties to set + */ + function QueryCancellationAction(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryCancellationAction longRunningSql. + * @member {string} longRunningSql + * @memberof google.spanner.executor.v1.QueryCancellationAction + * @instance + */ + QueryCancellationAction.prototype.longRunningSql = ""; + + /** + * QueryCancellationAction cancelQuery. + * @member {string} cancelQuery + * @memberof google.spanner.executor.v1.QueryCancellationAction + * @instance + */ + QueryCancellationAction.prototype.cancelQuery = ""; + + /** + * Creates a new QueryCancellationAction instance using the specified properties. + * @function create + * @memberof google.spanner.executor.v1.QueryCancellationAction + * @static + * @param {google.spanner.executor.v1.IQueryCancellationAction=} [properties] Properties to set + * @returns {google.spanner.executor.v1.QueryCancellationAction} QueryCancellationAction instance + */ + QueryCancellationAction.create = function create(properties) { + return new QueryCancellationAction(properties); + }; + + /** + * Encodes the specified QueryCancellationAction message. Does not implicitly {@link google.spanner.executor.v1.QueryCancellationAction.verify|verify} messages. + * @function encode + * @memberof google.spanner.executor.v1.QueryCancellationAction + * @static + * @param {google.spanner.executor.v1.IQueryCancellationAction} message QueryCancellationAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryCancellationAction.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.longRunningSql != null && Object.hasOwnProperty.call(message, "longRunningSql")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.longRunningSql); + if (message.cancelQuery != null && Object.hasOwnProperty.call(message, "cancelQuery")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.cancelQuery); + return writer; + }; + + /** + * Encodes the specified QueryCancellationAction message, length delimited. Does not implicitly {@link google.spanner.executor.v1.QueryCancellationAction.verify|verify} messages. + * @function encodeDelimited + * @memberof google.spanner.executor.v1.QueryCancellationAction + * @static + * @param {google.spanner.executor.v1.IQueryCancellationAction} message QueryCancellationAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryCancellationAction.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryCancellationAction message from the specified reader or buffer. + * @function decode + * @memberof google.spanner.executor.v1.QueryCancellationAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.spanner.executor.v1.QueryCancellationAction} QueryCancellationAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryCancellationAction.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.spanner.executor.v1.QueryCancellationAction(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.longRunningSql = reader.string(); + break; + } + case 2: { + message.cancelQuery = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryCancellationAction message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.spanner.executor.v1.QueryCancellationAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.spanner.executor.v1.QueryCancellationAction} QueryCancellationAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryCancellationAction.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryCancellationAction message. + * @function verify + * @memberof google.spanner.executor.v1.QueryCancellationAction + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryCancellationAction.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.longRunningSql != null && message.hasOwnProperty("longRunningSql")) + if (!$util.isString(message.longRunningSql)) + return "longRunningSql: string expected"; + if (message.cancelQuery != null && message.hasOwnProperty("cancelQuery")) + if (!$util.isString(message.cancelQuery)) + return "cancelQuery: string expected"; + return null; + }; + + /** + * Creates a QueryCancellationAction message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.spanner.executor.v1.QueryCancellationAction + * @static + * @param {Object.} object Plain object + * @returns {google.spanner.executor.v1.QueryCancellationAction} QueryCancellationAction + */ + QueryCancellationAction.fromObject = function fromObject(object) { + if (object instanceof $root.google.spanner.executor.v1.QueryCancellationAction) + return object; + var message = new $root.google.spanner.executor.v1.QueryCancellationAction(); + if (object.longRunningSql != null) + message.longRunningSql = String(object.longRunningSql); + if (object.cancelQuery != null) + message.cancelQuery = String(object.cancelQuery); + return message; + }; + + /** + * Creates a plain object from a QueryCancellationAction message. Also converts values to other types if specified. + * @function toObject + * @memberof google.spanner.executor.v1.QueryCancellationAction + * @static + * @param {google.spanner.executor.v1.QueryCancellationAction} message QueryCancellationAction + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryCancellationAction.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.longRunningSql = ""; + object.cancelQuery = ""; + } + if (message.longRunningSql != null && message.hasOwnProperty("longRunningSql")) + object.longRunningSql = message.longRunningSql; + if (message.cancelQuery != null && message.hasOwnProperty("cancelQuery")) + object.cancelQuery = message.cancelQuery; + return object; + }; + + /** + * Converts this QueryCancellationAction to JSON. + * @function toJSON + * @memberof google.spanner.executor.v1.QueryCancellationAction + * @instance + * @returns {Object.} JSON object + */ + QueryCancellationAction.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for QueryCancellationAction + * @function getTypeUrl + * @memberof google.spanner.executor.v1.QueryCancellationAction + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + QueryCancellationAction.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.spanner.executor.v1.QueryCancellationAction"; + }; + + return QueryCancellationAction; + })(); + v1.CancelOperationAction = (function() { /** @@ -73430,6 +76313,8 @@ * @property {google.spanner.v1.IRequestOptions|null} [requestOptions] ReadRequest requestOptions * @property {google.spanner.v1.IDirectedReadOptions|null} [directedReadOptions] ReadRequest directedReadOptions * @property {boolean|null} [dataBoostEnabled] ReadRequest dataBoostEnabled + * @property {google.spanner.v1.ReadRequest.OrderBy|null} [orderBy] ReadRequest orderBy + * @property {google.spanner.v1.ReadRequest.LockHint|null} [lockHint] ReadRequest lockHint */ /** @@ -73544,6 +76429,22 @@ */ ReadRequest.prototype.dataBoostEnabled = false; + /** + * ReadRequest orderBy. + * @member {google.spanner.v1.ReadRequest.OrderBy} orderBy + * @memberof google.spanner.v1.ReadRequest + * @instance + */ + ReadRequest.prototype.orderBy = 0; + + /** + * ReadRequest lockHint. + * @member {google.spanner.v1.ReadRequest.LockHint} lockHint + * @memberof google.spanner.v1.ReadRequest + * @instance + */ + ReadRequest.prototype.lockHint = 0; + /** * Creates a new ReadRequest instance using the specified properties. * @function create @@ -73593,6 +76494,10 @@ $root.google.spanner.v1.DirectedReadOptions.encode(message.directedReadOptions, writer.uint32(/* id 14, wireType 2 =*/114).fork()).ldelim(); if (message.dataBoostEnabled != null && Object.hasOwnProperty.call(message, "dataBoostEnabled")) writer.uint32(/* id 15, wireType 0 =*/120).bool(message.dataBoostEnabled); + if (message.orderBy != null && Object.hasOwnProperty.call(message, "orderBy")) + writer.uint32(/* id 16, wireType 0 =*/128).int32(message.orderBy); + if (message.lockHint != null && Object.hasOwnProperty.call(message, "lockHint")) + writer.uint32(/* id 17, wireType 0 =*/136).int32(message.lockHint); return writer; }; @@ -73677,6 +76582,14 @@ message.dataBoostEnabled = reader.bool(); break; } + case 16: { + message.orderBy = reader.int32(); + break; + } + case 17: { + message.lockHint = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -73760,6 +76673,24 @@ if (message.dataBoostEnabled != null && message.hasOwnProperty("dataBoostEnabled")) if (typeof message.dataBoostEnabled !== "boolean") return "dataBoostEnabled: boolean expected"; + if (message.orderBy != null && message.hasOwnProperty("orderBy")) + switch (message.orderBy) { + default: + return "orderBy: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.lockHint != null && message.hasOwnProperty("lockHint")) + switch (message.lockHint) { + default: + return "lockHint: enum value expected"; + case 0: + case 1: + case 2: + break; + } return null; }; @@ -73829,6 +76760,46 @@ } if (object.dataBoostEnabled != null) message.dataBoostEnabled = Boolean(object.dataBoostEnabled); + switch (object.orderBy) { + default: + if (typeof object.orderBy === "number") { + message.orderBy = object.orderBy; + break; + } + break; + case "ORDER_BY_UNSPECIFIED": + case 0: + message.orderBy = 0; + break; + case "ORDER_BY_PRIMARY_KEY": + case 1: + message.orderBy = 1; + break; + case "ORDER_BY_NO_ORDER": + case 2: + message.orderBy = 2; + break; + } + switch (object.lockHint) { + default: + if (typeof object.lockHint === "number") { + message.lockHint = object.lockHint; + break; + } + break; + case "LOCK_HINT_UNSPECIFIED": + case 0: + message.lockHint = 0; + break; + case "LOCK_HINT_SHARED": + case 1: + message.lockHint = 1; + break; + case "LOCK_HINT_EXCLUSIVE": + case 2: + message.lockHint = 2; + break; + } return message; }; @@ -73875,6 +76846,8 @@ object.requestOptions = null; object.directedReadOptions = null; object.dataBoostEnabled = false; + object.orderBy = options.enums === String ? "ORDER_BY_UNSPECIFIED" : 0; + object.lockHint = options.enums === String ? "LOCK_HINT_UNSPECIFIED" : 0; } if (message.session != null && message.hasOwnProperty("session")) object.session = message.session; @@ -73906,6 +76879,10 @@ object.directedReadOptions = $root.google.spanner.v1.DirectedReadOptions.toObject(message.directedReadOptions, options); if (message.dataBoostEnabled != null && message.hasOwnProperty("dataBoostEnabled")) object.dataBoostEnabled = message.dataBoostEnabled; + if (message.orderBy != null && message.hasOwnProperty("orderBy")) + object.orderBy = options.enums === String ? $root.google.spanner.v1.ReadRequest.OrderBy[message.orderBy] === undefined ? message.orderBy : $root.google.spanner.v1.ReadRequest.OrderBy[message.orderBy] : message.orderBy; + if (message.lockHint != null && message.hasOwnProperty("lockHint")) + object.lockHint = options.enums === String ? $root.google.spanner.v1.ReadRequest.LockHint[message.lockHint] === undefined ? message.lockHint : $root.google.spanner.v1.ReadRequest.LockHint[message.lockHint] : message.lockHint; return object; }; @@ -73935,6 +76912,38 @@ return typeUrlPrefix + "/google.spanner.v1.ReadRequest"; }; + /** + * OrderBy enum. + * @name google.spanner.v1.ReadRequest.OrderBy + * @enum {number} + * @property {number} ORDER_BY_UNSPECIFIED=0 ORDER_BY_UNSPECIFIED value + * @property {number} ORDER_BY_PRIMARY_KEY=1 ORDER_BY_PRIMARY_KEY value + * @property {number} ORDER_BY_NO_ORDER=2 ORDER_BY_NO_ORDER value + */ + ReadRequest.OrderBy = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "ORDER_BY_UNSPECIFIED"] = 0; + values[valuesById[1] = "ORDER_BY_PRIMARY_KEY"] = 1; + values[valuesById[2] = "ORDER_BY_NO_ORDER"] = 2; + return values; + })(); + + /** + * LockHint enum. + * @name google.spanner.v1.ReadRequest.LockHint + * @enum {number} + * @property {number} LOCK_HINT_UNSPECIFIED=0 LOCK_HINT_UNSPECIFIED value + * @property {number} LOCK_HINT_SHARED=1 LOCK_HINT_SHARED value + * @property {number} LOCK_HINT_EXCLUSIVE=2 LOCK_HINT_EXCLUSIVE value + */ + ReadRequest.LockHint = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "LOCK_HINT_UNSPECIFIED"] = 0; + values[valuesById[1] = "LOCK_HINT_SHARED"] = 1; + values[valuesById[2] = "LOCK_HINT_EXCLUSIVE"] = 2; + return values; + })(); + return ReadRequest; })(); diff --git a/protos/protos.json b/protos/protos.json index f1daeaffc..e4a6dddac 100644 --- a/protos/protos.json +++ b/protos/protos.json @@ -1720,6 +1720,14 @@ "options": { "(google.api.field_behavior)": "OUTPUT_ONLY" } + }, + "backupSchedules": { + "rule": "repeated", + "type": "string", + "id": 14, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } } }, "nested": { @@ -2076,6 +2084,9 @@ } } }, + "FullBackupSpec": { + "fields": {} + }, "OperationProgress": { "fields": { "progressPercent": { @@ -2153,6 +2164,209 @@ "POSTGRESQL": 2 } }, + "BackupScheduleSpec": { + "oneofs": { + "scheduleSpec": { + "oneof": [ + "cronSpec" + ] + } + }, + "fields": { + "cronSpec": { + "type": "CrontabSpec", + "id": 1 + } + } + }, + "BackupSchedule": { + "options": { + "(google.api.resource).type": "spanner.googleapis.com/BackupSchedule", + "(google.api.resource).pattern": "projects/{project}/instances/{instance}/databases/{database}/backupSchedules/{schedule}", + "(google.api.resource).plural": "backupSchedules", + "(google.api.resource).singular": "backupSchedule" + }, + "oneofs": { + "backupTypeSpec": { + "oneof": [ + "fullBackupSpec" + ] + } + }, + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "IDENTIFIER" + } + }, + "spec": { + "type": "BackupScheduleSpec", + "id": 6, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "retentionDuration": { + "type": "google.protobuf.Duration", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "encryptionConfig": { + "type": "CreateBackupEncryptionConfig", + "id": 4, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "fullBackupSpec": { + "type": "FullBackupSpec", + "id": 7 + }, + "updateTime": { + "type": "google.protobuf.Timestamp", + "id": 9, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + } + } + }, + "CrontabSpec": { + "fields": { + "text": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "timeZone": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "creationWindow": { + "type": "google.protobuf.Duration", + "id": 3, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + } + } + }, + "CreateBackupScheduleRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "spanner.googleapis.com/Database" + } + }, + "backupScheduleId": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "backupSchedule": { + "type": "BackupSchedule", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "GetBackupScheduleRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "spanner.googleapis.com/BackupSchedule" + } + } + } + }, + "DeleteBackupScheduleRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "spanner.googleapis.com/BackupSchedule" + } + } + } + }, + "ListBackupSchedulesRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "spanner.googleapis.com/Database" + } + }, + "pageSize": { + "type": "int32", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "pageToken": { + "type": "string", + "id": 4, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "ListBackupSchedulesResponse": { + "fields": { + "backupSchedules": { + "rule": "repeated", + "type": "BackupSchedule", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, + "UpdateBackupScheduleRequest": { + "fields": { + "backupSchedule": { + "type": "BackupSchedule", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, "DatabaseAdmin": { "options": { "(google.api.default_host)": "spanner.googleapis.com", @@ -2321,7 +2535,7 @@ "options": { "(google.api.http).post": "/v1/{resource=projects/*/instances/*/databases/*}:setIamPolicy", "(google.api.http).body": "*", - "(google.api.http).additional_bindings.post": "/v1/{resource=projects/*/instances/*/backups/*}:setIamPolicy", + "(google.api.http).additional_bindings.post": "/v1/{resource=projects/*/instances/*/databases/*/backupSchedules/*}:setIamPolicy", "(google.api.http).additional_bindings.body": "*", "(google.api.method_signature)": "resource,policy" }, @@ -2330,10 +2544,16 @@ "(google.api.http)": { "post": "/v1/{resource=projects/*/instances/*/databases/*}:setIamPolicy", "body": "*", - "additional_bindings": { - "post": "/v1/{resource=projects/*/instances/*/backups/*}:setIamPolicy", - "body": "*" - } + "additional_bindings": [ + { + "post": "/v1/{resource=projects/*/instances/*/backups/*}:setIamPolicy", + "body": "*" + }, + { + "post": "/v1/{resource=projects/*/instances/*/databases/*/backupSchedules/*}:setIamPolicy", + "body": "*" + } + ] } }, { @@ -2347,7 +2567,7 @@ "options": { "(google.api.http).post": "/v1/{resource=projects/*/instances/*/databases/*}:getIamPolicy", "(google.api.http).body": "*", - "(google.api.http).additional_bindings.post": "/v1/{resource=projects/*/instances/*/backups/*}:getIamPolicy", + "(google.api.http).additional_bindings.post": "/v1/{resource=projects/*/instances/*/databases/*/backupSchedules/*}:getIamPolicy", "(google.api.http).additional_bindings.body": "*", "(google.api.method_signature)": "resource" }, @@ -2356,10 +2576,16 @@ "(google.api.http)": { "post": "/v1/{resource=projects/*/instances/*/databases/*}:getIamPolicy", "body": "*", - "additional_bindings": { - "post": "/v1/{resource=projects/*/instances/*/backups/*}:getIamPolicy", - "body": "*" - } + "additional_bindings": [ + { + "post": "/v1/{resource=projects/*/instances/*/backups/*}:getIamPolicy", + "body": "*" + }, + { + "post": "/v1/{resource=projects/*/instances/*/databases/*/backupSchedules/*}:getIamPolicy", + "body": "*" + } + ] } }, { @@ -2387,6 +2613,10 @@ "post": "/v1/{resource=projects/*/instances/*/backups/*}:testIamPermissions", "body": "*" }, + { + "post": "/v1/{resource=projects/*/instances/*/databases/*/backupSchedules/*}:testIamPermissions", + "body": "*" + }, { "post": "/v1/{resource=projects/*/instances/*/databases/*/databaseRoles/*}:testIamPermissions", "body": "*" @@ -2610,6 +2840,100 @@ "(google.api.method_signature)": "parent" } ] + }, + "CreateBackupSchedule": { + "requestType": "CreateBackupScheduleRequest", + "responseType": "BackupSchedule", + "options": { + "(google.api.http).post": "/v1/{parent=projects/*/instances/*/databases/*}/backupSchedules", + "(google.api.http).body": "backup_schedule", + "(google.api.method_signature)": "parent,backup_schedule,backup_schedule_id" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{parent=projects/*/instances/*/databases/*}/backupSchedules", + "body": "backup_schedule" + } + }, + { + "(google.api.method_signature)": "parent,backup_schedule,backup_schedule_id" + } + ] + }, + "GetBackupSchedule": { + "requestType": "GetBackupScheduleRequest", + "responseType": "BackupSchedule", + "options": { + "(google.api.http).get": "/v1/{name=projects/*/instances/*/databases/*/backupSchedules/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{name=projects/*/instances/*/databases/*/backupSchedules/*}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "UpdateBackupSchedule": { + "requestType": "UpdateBackupScheduleRequest", + "responseType": "BackupSchedule", + "options": { + "(google.api.http).patch": "/v1/{backup_schedule.name=projects/*/instances/*/databases/*/backupSchedules/*}", + "(google.api.http).body": "backup_schedule", + "(google.api.method_signature)": "backup_schedule,update_mask" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/v1/{backup_schedule.name=projects/*/instances/*/databases/*/backupSchedules/*}", + "body": "backup_schedule" + } + }, + { + "(google.api.method_signature)": "backup_schedule,update_mask" + } + ] + }, + "DeleteBackupSchedule": { + "requestType": "DeleteBackupScheduleRequest", + "responseType": "google.protobuf.Empty", + "options": { + "(google.api.http).delete": "/v1/{name=projects/*/instances/*/databases/*/backupSchedules/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v1/{name=projects/*/instances/*/databases/*/backupSchedules/*}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "ListBackupSchedules": { + "requestType": "ListBackupSchedulesRequest", + "responseType": "ListBackupSchedulesResponse", + "options": { + "(google.api.http).get": "/v1/{parent=projects/*/instances/*/databases/*}/backupSchedules", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{parent=projects/*/instances/*/databases/*}/backupSchedules" + } + }, + { + "(google.api.method_signature)": "parent" + } + ] } } }, @@ -4694,7 +5018,8 @@ "generateDbPartitionsRead", "generateDbPartitionsQuery", "executePartition", - "executeChangeStreamQuery" + "executeChangeStreamQuery", + "queryCancellation" ] } }, @@ -4770,6 +5095,10 @@ "executeChangeStreamQuery": { "type": "ExecuteChangeStreamQuery", "id": 50 + }, + "queryCancellation": { + "type": "QueryCancellationAction", + "id": 51 } } }, @@ -6172,6 +6501,18 @@ } } }, + "QueryCancellationAction": { + "fields": { + "longRunningSql": { + "type": "string", + "id": 1 + }, + "cancelQuery": { + "type": "string", + "id": 2 + } + } + }, "CancelOperationAction": { "fields": { "operation": { @@ -7772,6 +8113,36 @@ "dataBoostEnabled": { "type": "bool", "id": 15 + }, + "orderBy": { + "type": "OrderBy", + "id": 16, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "lockHint": { + "type": "LockHint", + "id": 17, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + }, + "nested": { + "OrderBy": { + "values": { + "ORDER_BY_UNSPECIFIED": 0, + "ORDER_BY_PRIMARY_KEY": 1, + "ORDER_BY_NO_ORDER": 2 + } + }, + "LockHint": { + "values": { + "LOCK_HINT_UNSPECIFIED": 0, + "LOCK_HINT_SHARED": 1, + "LOCK_HINT_EXCLUSIVE": 2 + } } } }, diff --git a/src/v1/database_admin_client.ts b/src/v1/database_admin_client.ts index 3fae88a1d..99cd4637c 100644 --- a/src/v1/database_admin_client.ts +++ b/src/v1/database_admin_client.ts @@ -211,6 +211,9 @@ export class DatabaseAdminClient { backupPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/instances/{instance}/backups/{backup}' ), + backupSchedulePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/instances/{instance}/databases/{database}/backupSchedules/{schedule}' + ), cryptoKeyPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}' ), @@ -254,6 +257,11 @@ export class DatabaseAdminClient { 'nextPageToken', 'databaseRoles' ), + listBackupSchedules: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'backupSchedules' + ), }; const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); @@ -455,6 +463,11 @@ export class DatabaseAdminClient { 'listDatabaseOperations', 'listBackupOperations', 'listDatabaseRoles', + 'createBackupSchedule', + 'getBackupSchedule', + 'updateBackupSchedule', + 'deleteBackupSchedule', + 'listBackupSchedules', ]; for (const methodName of databaseAdminStubMethods) { const callPromise = this.databaseAdminStub.then( @@ -1418,6 +1431,400 @@ export class DatabaseAdminClient { this.initialize(); return this.innerApiCalls.deleteBackup(request, options, callback); } + /** + * Creates a new backup schedule. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the database that this backup schedule applies to. + * @param {string} request.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//instances//databases//backupSchedules/`. + * @param {google.spanner.admin.database.v1.BackupSchedule} request.backupSchedule + * Required. The backup schedule to create. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.spanner.admin.database.v1.BackupSchedule|BackupSchedule}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + */ + createBackupSchedule( + request?: protos.google.spanner.admin.database.v1.ICreateBackupScheduleRequest, + options?: CallOptions + ): Promise< + [ + protos.google.spanner.admin.database.v1.IBackupSchedule, + ( + | protos.google.spanner.admin.database.v1.ICreateBackupScheduleRequest + | undefined + ), + {} | undefined, + ] + >; + createBackupSchedule( + request: protos.google.spanner.admin.database.v1.ICreateBackupScheduleRequest, + options: CallOptions, + callback: Callback< + protos.google.spanner.admin.database.v1.IBackupSchedule, + | protos.google.spanner.admin.database.v1.ICreateBackupScheduleRequest + | null + | undefined, + {} | null | undefined + > + ): void; + createBackupSchedule( + request: protos.google.spanner.admin.database.v1.ICreateBackupScheduleRequest, + callback: Callback< + protos.google.spanner.admin.database.v1.IBackupSchedule, + | protos.google.spanner.admin.database.v1.ICreateBackupScheduleRequest + | null + | undefined, + {} | null | undefined + > + ): void; + createBackupSchedule( + request?: protos.google.spanner.admin.database.v1.ICreateBackupScheduleRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.spanner.admin.database.v1.IBackupSchedule, + | protos.google.spanner.admin.database.v1.ICreateBackupScheduleRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.spanner.admin.database.v1.IBackupSchedule, + | protos.google.spanner.admin.database.v1.ICreateBackupScheduleRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.spanner.admin.database.v1.IBackupSchedule, + ( + | protos.google.spanner.admin.database.v1.ICreateBackupScheduleRequest + | undefined + ), + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createBackupSchedule(request, options, callback); + } + /** + * Gets backup schedule for the input schedule name. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the schedule to retrieve. + * Values are of the form + * `projects//instances//databases//backupSchedules/`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.spanner.admin.database.v1.BackupSchedule|BackupSchedule}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + */ + getBackupSchedule( + request?: protos.google.spanner.admin.database.v1.IGetBackupScheduleRequest, + options?: CallOptions + ): Promise< + [ + protos.google.spanner.admin.database.v1.IBackupSchedule, + ( + | protos.google.spanner.admin.database.v1.IGetBackupScheduleRequest + | undefined + ), + {} | undefined, + ] + >; + getBackupSchedule( + request: protos.google.spanner.admin.database.v1.IGetBackupScheduleRequest, + options: CallOptions, + callback: Callback< + protos.google.spanner.admin.database.v1.IBackupSchedule, + | protos.google.spanner.admin.database.v1.IGetBackupScheduleRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getBackupSchedule( + request: protos.google.spanner.admin.database.v1.IGetBackupScheduleRequest, + callback: Callback< + protos.google.spanner.admin.database.v1.IBackupSchedule, + | protos.google.spanner.admin.database.v1.IGetBackupScheduleRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getBackupSchedule( + request?: protos.google.spanner.admin.database.v1.IGetBackupScheduleRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.spanner.admin.database.v1.IBackupSchedule, + | protos.google.spanner.admin.database.v1.IGetBackupScheduleRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.spanner.admin.database.v1.IBackupSchedule, + | protos.google.spanner.admin.database.v1.IGetBackupScheduleRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.spanner.admin.database.v1.IBackupSchedule, + ( + | protos.google.spanner.admin.database.v1.IGetBackupScheduleRequest + | undefined + ), + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getBackupSchedule(request, options, callback); + } + /** + * Updates a backup schedule. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.spanner.admin.database.v1.BackupSchedule} request.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 {google.protobuf.FieldMask} request.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. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.spanner.admin.database.v1.BackupSchedule|BackupSchedule}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + */ + updateBackupSchedule( + request?: protos.google.spanner.admin.database.v1.IUpdateBackupScheduleRequest, + options?: CallOptions + ): Promise< + [ + protos.google.spanner.admin.database.v1.IBackupSchedule, + ( + | protos.google.spanner.admin.database.v1.IUpdateBackupScheduleRequest + | undefined + ), + {} | undefined, + ] + >; + updateBackupSchedule( + request: protos.google.spanner.admin.database.v1.IUpdateBackupScheduleRequest, + options: CallOptions, + callback: Callback< + protos.google.spanner.admin.database.v1.IBackupSchedule, + | protos.google.spanner.admin.database.v1.IUpdateBackupScheduleRequest + | null + | undefined, + {} | null | undefined + > + ): void; + updateBackupSchedule( + request: protos.google.spanner.admin.database.v1.IUpdateBackupScheduleRequest, + callback: Callback< + protos.google.spanner.admin.database.v1.IBackupSchedule, + | protos.google.spanner.admin.database.v1.IUpdateBackupScheduleRequest + | null + | undefined, + {} | null | undefined + > + ): void; + updateBackupSchedule( + request?: protos.google.spanner.admin.database.v1.IUpdateBackupScheduleRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.spanner.admin.database.v1.IBackupSchedule, + | protos.google.spanner.admin.database.v1.IUpdateBackupScheduleRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.spanner.admin.database.v1.IBackupSchedule, + | protos.google.spanner.admin.database.v1.IUpdateBackupScheduleRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.spanner.admin.database.v1.IBackupSchedule, + ( + | protos.google.spanner.admin.database.v1.IUpdateBackupScheduleRequest + | undefined + ), + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'backup_schedule.name': request.backupSchedule!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateBackupSchedule(request, options, callback); + } + /** + * Deletes a backup schedule. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the schedule to delete. + * Values are of the form + * `projects//instances//databases//backupSchedules/`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.protobuf.Empty|Empty}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + */ + deleteBackupSchedule( + request?: protos.google.spanner.admin.database.v1.IDeleteBackupScheduleRequest, + options?: CallOptions + ): Promise< + [ + protos.google.protobuf.IEmpty, + ( + | protos.google.spanner.admin.database.v1.IDeleteBackupScheduleRequest + | undefined + ), + {} | undefined, + ] + >; + deleteBackupSchedule( + request: protos.google.spanner.admin.database.v1.IDeleteBackupScheduleRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.spanner.admin.database.v1.IDeleteBackupScheduleRequest + | null + | undefined, + {} | null | undefined + > + ): void; + deleteBackupSchedule( + request: protos.google.spanner.admin.database.v1.IDeleteBackupScheduleRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.spanner.admin.database.v1.IDeleteBackupScheduleRequest + | null + | undefined, + {} | null | undefined + > + ): void; + deleteBackupSchedule( + request?: protos.google.spanner.admin.database.v1.IDeleteBackupScheduleRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.protobuf.IEmpty, + | protos.google.spanner.admin.database.v1.IDeleteBackupScheduleRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.IEmpty, + | protos.google.spanner.admin.database.v1.IDeleteBackupScheduleRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.protobuf.IEmpty, + ( + | protos.google.spanner.admin.database.v1.IDeleteBackupScheduleRequest + | undefined + ), + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteBackupSchedule(request, options, callback); + } /** * Creates a new Cloud Spanner database and starts to prepare it for serving. @@ -3931,6 +4338,211 @@ export class DatabaseAdminClient { callSettings ) as AsyncIterable; } + /** + * Lists all the backup schedules for the database. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Database is the parent resource whose backup schedules should be + * listed. Values are of the form + * projects//instances//databases/ + * @param {number} [request.pageSize] + * Optional. Number of backup schedules to be returned in the response. If 0 + * or less, defaults to the server's maximum allowed page size. + * @param {string} [request.pageToken] + * Optional. If non-empty, `page_token` should contain a + * {@link protos.google.spanner.admin.database.v1.ListBackupSchedulesResponse.next_page_token|next_page_token} + * from a previous + * {@link protos.google.spanner.admin.database.v1.ListBackupSchedulesResponse|ListBackupSchedulesResponse} + * to the same `parent`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link protos.google.spanner.admin.database.v1.BackupSchedule|BackupSchedule}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listBackupSchedulesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listBackupSchedules( + request?: protos.google.spanner.admin.database.v1.IListBackupSchedulesRequest, + options?: CallOptions + ): Promise< + [ + protos.google.spanner.admin.database.v1.IBackupSchedule[], + protos.google.spanner.admin.database.v1.IListBackupSchedulesRequest | null, + protos.google.spanner.admin.database.v1.IListBackupSchedulesResponse, + ] + >; + listBackupSchedules( + request: protos.google.spanner.admin.database.v1.IListBackupSchedulesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.spanner.admin.database.v1.IListBackupSchedulesRequest, + | protos.google.spanner.admin.database.v1.IListBackupSchedulesResponse + | null + | undefined, + protos.google.spanner.admin.database.v1.IBackupSchedule + > + ): void; + listBackupSchedules( + request: protos.google.spanner.admin.database.v1.IListBackupSchedulesRequest, + callback: PaginationCallback< + protos.google.spanner.admin.database.v1.IListBackupSchedulesRequest, + | protos.google.spanner.admin.database.v1.IListBackupSchedulesResponse + | null + | undefined, + protos.google.spanner.admin.database.v1.IBackupSchedule + > + ): void; + listBackupSchedules( + request?: protos.google.spanner.admin.database.v1.IListBackupSchedulesRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.spanner.admin.database.v1.IListBackupSchedulesRequest, + | protos.google.spanner.admin.database.v1.IListBackupSchedulesResponse + | null + | undefined, + protos.google.spanner.admin.database.v1.IBackupSchedule + >, + callback?: PaginationCallback< + protos.google.spanner.admin.database.v1.IListBackupSchedulesRequest, + | protos.google.spanner.admin.database.v1.IListBackupSchedulesResponse + | null + | undefined, + protos.google.spanner.admin.database.v1.IBackupSchedule + > + ): Promise< + [ + protos.google.spanner.admin.database.v1.IBackupSchedule[], + protos.google.spanner.admin.database.v1.IListBackupSchedulesRequest | null, + protos.google.spanner.admin.database.v1.IListBackupSchedulesResponse, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listBackupSchedules(request, options, callback); + } + + /** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Database is the parent resource whose backup schedules should be + * listed. Values are of the form + * projects//instances//databases/ + * @param {number} [request.pageSize] + * Optional. Number of backup schedules to be returned in the response. If 0 + * or less, defaults to the server's maximum allowed page size. + * @param {string} [request.pageToken] + * Optional. If non-empty, `page_token` should contain a + * {@link protos.google.spanner.admin.database.v1.ListBackupSchedulesResponse.next_page_token|next_page_token} + * from a previous + * {@link protos.google.spanner.admin.database.v1.ListBackupSchedulesResponse|ListBackupSchedulesResponse} + * to the same `parent`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.spanner.admin.database.v1.BackupSchedule|BackupSchedule} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listBackupSchedulesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listBackupSchedulesStream( + request?: protos.google.spanner.admin.database.v1.IListBackupSchedulesRequest, + options?: CallOptions + ): Transform { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listBackupSchedules']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listBackupSchedules.createStream( + this.innerApiCalls.listBackupSchedules as GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listBackupSchedules`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Database is the parent resource whose backup schedules should be + * listed. Values are of the form + * projects//instances//databases/ + * @param {number} [request.pageSize] + * Optional. Number of backup schedules to be returned in the response. If 0 + * or less, defaults to the server's maximum allowed page size. + * @param {string} [request.pageToken] + * Optional. If non-empty, `page_token` should contain a + * {@link protos.google.spanner.admin.database.v1.ListBackupSchedulesResponse.next_page_token|next_page_token} + * from a previous + * {@link protos.google.spanner.admin.database.v1.ListBackupSchedulesResponse|ListBackupSchedulesResponse} + * to the same `parent`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.spanner.admin.database.v1.BackupSchedule|BackupSchedule}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listBackupSchedulesAsync( + request?: protos.google.spanner.admin.database.v1.IListBackupSchedulesRequest, + options?: CallOptions + ): AsyncIterable { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listBackupSchedules']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listBackupSchedules.asyncIterate( + this.innerApiCalls['listBackupSchedules'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } /** * Gets the latest state of a long-running operation. Clients can use this * method to poll the operation result at intervals as recommended by the API @@ -4159,6 +4771,81 @@ export class DatabaseAdminClient { return this.pathTemplates.backupPathTemplate.match(backupName).backup; } + /** + * Return a fully-qualified backupSchedule resource name string. + * + * @param {string} project + * @param {string} instance + * @param {string} database + * @param {string} schedule + * @returns {string} Resource name string. + */ + backupSchedulePath( + project: string, + instance: string, + database: string, + schedule: string + ) { + return this.pathTemplates.backupSchedulePathTemplate.render({ + project: project, + instance: instance, + database: database, + schedule: schedule, + }); + } + + /** + * Parse the project from BackupSchedule resource. + * + * @param {string} backupScheduleName + * A fully-qualified path representing BackupSchedule resource. + * @returns {string} A string representing the project. + */ + matchProjectFromBackupScheduleName(backupScheduleName: string) { + return this.pathTemplates.backupSchedulePathTemplate.match( + backupScheduleName + ).project; + } + + /** + * Parse the instance from BackupSchedule resource. + * + * @param {string} backupScheduleName + * A fully-qualified path representing BackupSchedule resource. + * @returns {string} A string representing the instance. + */ + matchInstanceFromBackupScheduleName(backupScheduleName: string) { + return this.pathTemplates.backupSchedulePathTemplate.match( + backupScheduleName + ).instance; + } + + /** + * Parse the database from BackupSchedule resource. + * + * @param {string} backupScheduleName + * A fully-qualified path representing BackupSchedule resource. + * @returns {string} A string representing the database. + */ + matchDatabaseFromBackupScheduleName(backupScheduleName: string) { + return this.pathTemplates.backupSchedulePathTemplate.match( + backupScheduleName + ).database; + } + + /** + * Parse the schedule from BackupSchedule resource. + * + * @param {string} backupScheduleName + * A fully-qualified path representing BackupSchedule resource. + * @returns {string} A string representing the schedule. + */ + matchScheduleFromBackupScheduleName(backupScheduleName: string) { + return this.pathTemplates.backupSchedulePathTemplate.match( + backupScheduleName + ).schedule; + } + /** * Return a fully-qualified cryptoKey resource name string. * diff --git a/src/v1/database_admin_client_config.json b/src/v1/database_admin_client_config.json index 5a2c31c0e..73fd4af7f 100644 --- a/src/v1/database_admin_client_config.json +++ b/src/v1/database_admin_client_config.json @@ -128,6 +128,31 @@ "timeout_millis": 3600000, "retry_codes_name": "idempotent", "retry_params_name": "e9fafda332ce8a1702dc1575de3ca81c4feb4799" + }, + "CreateBackupSchedule": { + "timeout_millis": 3600000, + "retry_codes_name": "idempotent", + "retry_params_name": "e9fafda332ce8a1702dc1575de3ca81c4feb4799" + }, + "GetBackupSchedule": { + "timeout_millis": 3600000, + "retry_codes_name": "idempotent", + "retry_params_name": "e9fafda332ce8a1702dc1575de3ca81c4feb4799" + }, + "UpdateBackupSchedule": { + "timeout_millis": 3600000, + "retry_codes_name": "idempotent", + "retry_params_name": "e9fafda332ce8a1702dc1575de3ca81c4feb4799" + }, + "DeleteBackupSchedule": { + "timeout_millis": 3600000, + "retry_codes_name": "idempotent", + "retry_params_name": "e9fafda332ce8a1702dc1575de3ca81c4feb4799" + }, + "ListBackupSchedules": { + "timeout_millis": 3600000, + "retry_codes_name": "idempotent", + "retry_params_name": "e9fafda332ce8a1702dc1575de3ca81c4feb4799" } } } diff --git a/src/v1/database_admin_proto_list.json b/src/v1/database_admin_proto_list.json index c20bcc2fc..8d5db481c 100644 --- a/src/v1/database_admin_proto_list.json +++ b/src/v1/database_admin_proto_list.json @@ -1,5 +1,6 @@ [ "../../protos/google/spanner/admin/database/v1/backup.proto", + "../../protos/google/spanner/admin/database/v1/backup_schedule.proto", "../../protos/google/spanner/admin/database/v1/common.proto", "../../protos/google/spanner/admin/database/v1/spanner_database_admin.proto" ] diff --git a/src/v1/spanner_client.ts b/src/v1/spanner_client.ts index 910433c5c..88ccdd254 100644 --- a/src/v1/spanner_client.ts +++ b/src/v1/spanner_client.ts @@ -227,17 +227,17 @@ export class SpannerClient { executeStreamingSql: new this._gaxModule.StreamDescriptor( this._gaxModule.StreamType.SERVER_STREAMING, !!opts.fallback, - /* gaxStreamingRetries: */ false + !!opts.gaxServerStreamingRetries ), streamingRead: new this._gaxModule.StreamDescriptor( this._gaxModule.StreamType.SERVER_STREAMING, !!opts.fallback, - /* gaxStreamingRetries: */ false + !!opts.gaxServerStreamingRetries ), batchWrite: new this._gaxModule.StreamDescriptor( this._gaxModule.StreamType.SERVER_STREAMING, !!opts.fallback, - /* gaxStreamingRetries: */ false + !!opts.gaxServerStreamingRetries ), }; @@ -1161,6 +1161,17 @@ export class SpannerClient { * * If the field is set to `true` but the request does not set * `partition_token`, the API returns an `INVALID_ARGUMENT` error. + * @param {google.spanner.v1.ReadRequest.OrderBy} [request.orderBy] + * Optional. Order for the returned rows. + * + * By default, Spanner will return result rows in primary key order except for + * PartitionRead requests. For applications that do not require rows to be + * returned in primary key (`ORDER_BY_PRIMARY_KEY`) order, setting + * `ORDER_BY_NO_ORDER` option allows Spanner to optimize row retrieval, + * resulting in lower latencies in certain cases (e.g. bulk point lookups). + * @param {google.spanner.v1.ReadRequest.LockHint} [request.lockHint] + * Optional. Lock Hint for the request, it can only be used with read-write + * transactions. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. @@ -1973,6 +1984,17 @@ export class SpannerClient { * * If the field is set to `true` but the request does not set * `partition_token`, the API returns an `INVALID_ARGUMENT` error. + * @param {google.spanner.v1.ReadRequest.OrderBy} [request.orderBy] + * Optional. Order for the returned rows. + * + * By default, Spanner will return result rows in primary key order except for + * PartitionRead requests. For applications that do not require rows to be + * returned in primary key (`ORDER_BY_PRIMARY_KEY`) order, setting + * `ORDER_BY_NO_ORDER` option allows Spanner to optimize row retrieval, + * resulting in lower latencies in certain cases (e.g. bulk point lookups). + * @param {google.spanner.v1.ReadRequest.LockHint} [request.lockHint] + * Optional. Lock Hint for the request, it can only be used with read-write + * transactions. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Stream} diff --git a/src/v1/spanner_executor_proxy_client.ts b/src/v1/spanner_executor_proxy_client.ts index 578d53b43..3373a5e2a 100644 --- a/src/v1/spanner_executor_proxy_client.ts +++ b/src/v1/spanner_executor_proxy_client.ts @@ -197,6 +197,9 @@ export class SpannerExecutorProxyClient { backupPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/instances/{instance}/backups/{backup}' ), + backupSchedulePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/instances/{instance}/databases/{database}/backupSchedules/{schedule}' + ), databasePathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/instances/{instance}/databases/{database}' ), @@ -223,7 +226,7 @@ export class SpannerExecutorProxyClient { executeActionAsync: new this._gaxModule.StreamDescriptor( this._gaxModule.StreamType.BIDI_STREAMING, !!opts.fallback, - /* gaxStreamingRetries: */ false + !!opts.gaxServerStreamingRetries ), }; @@ -483,6 +486,81 @@ export class SpannerExecutorProxyClient { return this.pathTemplates.backupPathTemplate.match(backupName).backup; } + /** + * Return a fully-qualified backupSchedule resource name string. + * + * @param {string} project + * @param {string} instance + * @param {string} database + * @param {string} schedule + * @returns {string} Resource name string. + */ + backupSchedulePath( + project: string, + instance: string, + database: string, + schedule: string + ) { + return this.pathTemplates.backupSchedulePathTemplate.render({ + project: project, + instance: instance, + database: database, + schedule: schedule, + }); + } + + /** + * Parse the project from BackupSchedule resource. + * + * @param {string} backupScheduleName + * A fully-qualified path representing BackupSchedule resource. + * @returns {string} A string representing the project. + */ + matchProjectFromBackupScheduleName(backupScheduleName: string) { + return this.pathTemplates.backupSchedulePathTemplate.match( + backupScheduleName + ).project; + } + + /** + * Parse the instance from BackupSchedule resource. + * + * @param {string} backupScheduleName + * A fully-qualified path representing BackupSchedule resource. + * @returns {string} A string representing the instance. + */ + matchInstanceFromBackupScheduleName(backupScheduleName: string) { + return this.pathTemplates.backupSchedulePathTemplate.match( + backupScheduleName + ).instance; + } + + /** + * Parse the database from BackupSchedule resource. + * + * @param {string} backupScheduleName + * A fully-qualified path representing BackupSchedule resource. + * @returns {string} A string representing the database. + */ + matchDatabaseFromBackupScheduleName(backupScheduleName: string) { + return this.pathTemplates.backupSchedulePathTemplate.match( + backupScheduleName + ).database; + } + + /** + * Parse the schedule from BackupSchedule resource. + * + * @param {string} backupScheduleName + * A fully-qualified path representing BackupSchedule resource. + * @returns {string} A string representing the schedule. + */ + matchScheduleFromBackupScheduleName(backupScheduleName: string) { + return this.pathTemplates.backupSchedulePathTemplate.match( + backupScheduleName + ).schedule; + } + /** * Return a fully-qualified database resource name string. * diff --git a/src/v1/spanner_executor_proxy_proto_list.json b/src/v1/spanner_executor_proxy_proto_list.json index 2b5d804d3..eae56f346 100644 --- a/src/v1/spanner_executor_proxy_proto_list.json +++ b/src/v1/spanner_executor_proxy_proto_list.json @@ -1,5 +1,6 @@ [ "../../protos/google/spanner/admin/database/v1/backup.proto", + "../../protos/google/spanner/admin/database/v1/backup_schedule.proto", "../../protos/google/spanner/admin/database/v1/common.proto", "../../protos/google/spanner/admin/instance/v1/common.proto", "../../protos/google/spanner/executor/v1/cloud_executor.proto", diff --git a/test/gapic_database_admin_v1.ts b/test/gapic_database_admin_v1.ts index 97c7e5aa5..f30e64281 100644 --- a/test/gapic_database_admin_v1.ts +++ b/test/gapic_database_admin_v1.ts @@ -1509,69 +1509,65 @@ describe('v1.DatabaseAdminClient', () => { }); }); - describe('createDatabase', () => { - it('invokes createDatabase without error', async () => { + describe('createBackupSchedule', () => { + it('invokes createBackupSchedule without error', async () => { const client = new databaseadminModule.v1.DatabaseAdminClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.spanner.admin.database.v1.CreateDatabaseRequest() + new protos.google.spanner.admin.database.v1.CreateBackupScheduleRequest() ); const defaultValue1 = getTypeDefaultValue( - '.google.spanner.admin.database.v1.CreateDatabaseRequest', + '.google.spanner.admin.database.v1.CreateBackupScheduleRequest', ['parent'] ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() + new protos.google.spanner.admin.database.v1.BackupSchedule() ); - client.innerApiCalls.createDatabase = - stubLongRunningCall(expectedResponse); - const [operation] = await client.createDatabase(request); - const [response] = await operation.promise(); + client.innerApiCalls.createBackupSchedule = + stubSimpleCall(expectedResponse); + const [response] = await client.createBackupSchedule(request); assert.deepStrictEqual(response, expectedResponse); const actualRequest = ( - client.innerApiCalls.createDatabase as SinonStub + client.innerApiCalls.createBackupSchedule as SinonStub ).getCall(0).args[0]; assert.deepStrictEqual(actualRequest, request); const actualHeaderRequestParams = ( - client.innerApiCalls.createDatabase as SinonStub + client.innerApiCalls.createBackupSchedule as SinonStub ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - it('invokes createDatabase without error using callback', async () => { + it('invokes createBackupSchedule without error using callback', async () => { const client = new databaseadminModule.v1.DatabaseAdminClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.spanner.admin.database.v1.CreateDatabaseRequest() + new protos.google.spanner.admin.database.v1.CreateBackupScheduleRequest() ); const defaultValue1 = getTypeDefaultValue( - '.google.spanner.admin.database.v1.CreateDatabaseRequest', + '.google.spanner.admin.database.v1.CreateBackupScheduleRequest', ['parent'] ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() + new protos.google.spanner.admin.database.v1.BackupSchedule() ); - client.innerApiCalls.createDatabase = - stubLongRunningCallWithCallback(expectedResponse); + client.innerApiCalls.createBackupSchedule = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { - client.createDatabase( + client.createBackupSchedule( request, ( err?: Error | null, - result?: LROperation< - protos.google.spanner.admin.database.v1.IDatabase, - protos.google.spanner.admin.database.v1.ICreateDatabaseMetadata - > | null + result?: protos.google.spanner.admin.database.v1.IBackupSchedule | null ) => { if (err) { reject(err); @@ -1581,193 +1577,260 @@ describe('v1.DatabaseAdminClient', () => { } ); }); - const operation = (await promise) as LROperation< - protos.google.spanner.admin.database.v1.IDatabase, - protos.google.spanner.admin.database.v1.ICreateDatabaseMetadata - >; - const [response] = await operation.promise(); + const response = await promise; assert.deepStrictEqual(response, expectedResponse); const actualRequest = ( - client.innerApiCalls.createDatabase as SinonStub + client.innerApiCalls.createBackupSchedule as SinonStub ).getCall(0).args[0]; assert.deepStrictEqual(actualRequest, request); const actualHeaderRequestParams = ( - client.innerApiCalls.createDatabase as SinonStub + client.innerApiCalls.createBackupSchedule as SinonStub ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - it('invokes createDatabase with call error', async () => { + it('invokes createBackupSchedule with error', async () => { const client = new databaseadminModule.v1.DatabaseAdminClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.spanner.admin.database.v1.CreateDatabaseRequest() + new protos.google.spanner.admin.database.v1.CreateBackupScheduleRequest() ); const defaultValue1 = getTypeDefaultValue( - '.google.spanner.admin.database.v1.CreateDatabaseRequest', + '.google.spanner.admin.database.v1.CreateBackupScheduleRequest', ['parent'] ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); - client.innerApiCalls.createDatabase = stubLongRunningCall( + client.innerApiCalls.createBackupSchedule = stubSimpleCall( undefined, expectedError ); - await assert.rejects(client.createDatabase(request), expectedError); + await assert.rejects(client.createBackupSchedule(request), expectedError); const actualRequest = ( - client.innerApiCalls.createDatabase as SinonStub + client.innerApiCalls.createBackupSchedule as SinonStub ).getCall(0).args[0]; assert.deepStrictEqual(actualRequest, request); const actualHeaderRequestParams = ( - client.innerApiCalls.createDatabase as SinonStub + client.innerApiCalls.createBackupSchedule as SinonStub ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - it('invokes createDatabase with LRO error', async () => { + it('invokes createBackupSchedule with closed client', async () => { const client = new databaseadminModule.v1.DatabaseAdminClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.spanner.admin.database.v1.CreateDatabaseRequest() + new protos.google.spanner.admin.database.v1.CreateBackupScheduleRequest() ); const defaultValue1 = getTypeDefaultValue( - '.google.spanner.admin.database.v1.CreateDatabaseRequest', + '.google.spanner.admin.database.v1.CreateBackupScheduleRequest', ['parent'] ); request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createDatabase = stubLongRunningCall( - undefined, - undefined, - expectedError + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createBackupSchedule(request), expectedError); + }); + }); + + describe('getBackupSchedule', () => { + it('invokes getBackupSchedule without error', async () => { + const client = new databaseadminModule.v1.DatabaseAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.spanner.admin.database.v1.GetBackupScheduleRequest() ); - const [operation] = await client.createDatabase(request); - await assert.rejects(operation.promise(), expectedError); + const defaultValue1 = getTypeDefaultValue( + '.google.spanner.admin.database.v1.GetBackupScheduleRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.spanner.admin.database.v1.BackupSchedule() + ); + client.innerApiCalls.getBackupSchedule = stubSimpleCall(expectedResponse); + const [response] = await client.getBackupSchedule(request); + assert.deepStrictEqual(response, expectedResponse); const actualRequest = ( - client.innerApiCalls.createDatabase as SinonStub + client.innerApiCalls.getBackupSchedule as SinonStub ).getCall(0).args[0]; assert.deepStrictEqual(actualRequest, request); const actualHeaderRequestParams = ( - client.innerApiCalls.createDatabase as SinonStub + client.innerApiCalls.getBackupSchedule as SinonStub ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - it('invokes checkCreateDatabaseProgress without error', async () => { + it('invokes getBackupSchedule without error using callback', async () => { const client = new databaseadminModule.v1.DatabaseAdminClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() + const request = generateSampleMessage( + new protos.google.spanner.admin.database.v1.GetBackupScheduleRequest() ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')}; - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateDatabaseProgress( - expectedResponse.name + const defaultValue1 = getTypeDefaultValue( + '.google.spanner.admin.database.v1.GetBackupScheduleRequest', + ['name'] ); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.spanner.admin.database.v1.BackupSchedule() + ); + client.innerApiCalls.getBackupSchedule = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getBackupSchedule( + request, + ( + err?: Error | null, + result?: protos.google.spanner.admin.database.v1.IBackupSchedule | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getBackupSchedule as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getBackupSchedule as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - it('invokes checkCreateDatabaseProgress with error', async () => { + it('invokes getBackupSchedule with error', async () => { const client = new databaseadminModule.v1.DatabaseAdminClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); + const request = generateSampleMessage( + new protos.google.spanner.admin.database.v1.GetBackupScheduleRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.spanner.admin.database.v1.GetBackupScheduleRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall( + client.innerApiCalls.getBackupSchedule = stubSimpleCall( undefined, expectedError ); - await assert.rejects( - client.checkCreateDatabaseProgress(''), - expectedError + await assert.rejects(client.getBackupSchedule(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getBackupSchedule as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getBackupSchedule as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getBackupSchedule with closed client', async () => { + const client = new databaseadminModule.v1.DatabaseAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.spanner.admin.database.v1.GetBackupScheduleRequest() ); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + const defaultValue1 = getTypeDefaultValue( + '.google.spanner.admin.database.v1.GetBackupScheduleRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getBackupSchedule(request), expectedError); }); }); - describe('updateDatabase', () => { - it('invokes updateDatabase without error', async () => { + describe('updateBackupSchedule', () => { + it('invokes updateBackupSchedule without error', async () => { const client = new databaseadminModule.v1.DatabaseAdminClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.spanner.admin.database.v1.UpdateDatabaseRequest() + new protos.google.spanner.admin.database.v1.UpdateBackupScheduleRequest() ); - request.database ??= {}; + request.backupSchedule ??= {}; const defaultValue1 = getTypeDefaultValue( - '.google.spanner.admin.database.v1.UpdateDatabaseRequest', - ['database', 'name'] + '.google.spanner.admin.database.v1.UpdateBackupScheduleRequest', + ['backupSchedule', 'name'] ); - request.database.name = defaultValue1; - const expectedHeaderRequestParams = `database.name=${defaultValue1}`; + request.backupSchedule.name = defaultValue1; + const expectedHeaderRequestParams = `backup_schedule.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() + new protos.google.spanner.admin.database.v1.BackupSchedule() ); - client.innerApiCalls.updateDatabase = - stubLongRunningCall(expectedResponse); - const [operation] = await client.updateDatabase(request); - const [response] = await operation.promise(); + client.innerApiCalls.updateBackupSchedule = + stubSimpleCall(expectedResponse); + const [response] = await client.updateBackupSchedule(request); assert.deepStrictEqual(response, expectedResponse); const actualRequest = ( - client.innerApiCalls.updateDatabase as SinonStub + client.innerApiCalls.updateBackupSchedule as SinonStub ).getCall(0).args[0]; assert.deepStrictEqual(actualRequest, request); const actualHeaderRequestParams = ( - client.innerApiCalls.updateDatabase as SinonStub + client.innerApiCalls.updateBackupSchedule as SinonStub ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - it('invokes updateDatabase without error using callback', async () => { + it('invokes updateBackupSchedule without error using callback', async () => { const client = new databaseadminModule.v1.DatabaseAdminClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.spanner.admin.database.v1.UpdateDatabaseRequest() + new protos.google.spanner.admin.database.v1.UpdateBackupScheduleRequest() ); - request.database ??= {}; + request.backupSchedule ??= {}; const defaultValue1 = getTypeDefaultValue( - '.google.spanner.admin.database.v1.UpdateDatabaseRequest', - ['database', 'name'] + '.google.spanner.admin.database.v1.UpdateBackupScheduleRequest', + ['backupSchedule', 'name'] ); - request.database.name = defaultValue1; - const expectedHeaderRequestParams = `database.name=${defaultValue1}`; + request.backupSchedule.name = defaultValue1; + const expectedHeaderRequestParams = `backup_schedule.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() + new protos.google.spanner.admin.database.v1.BackupSchedule() ); - client.innerApiCalls.updateDatabase = - stubLongRunningCallWithCallback(expectedResponse); + client.innerApiCalls.updateBackupSchedule = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { - client.updateDatabase( + client.updateBackupSchedule( request, ( err?: Error | null, - result?: LROperation< - protos.google.spanner.admin.database.v1.IDatabase, - protos.google.spanner.admin.database.v1.IUpdateDatabaseMetadata - > | null + result?: protos.google.spanner.admin.database.v1.IBackupSchedule | null ) => { if (err) { reject(err); @@ -1777,192 +1840,264 @@ describe('v1.DatabaseAdminClient', () => { } ); }); - const operation = (await promise) as LROperation< - protos.google.spanner.admin.database.v1.IDatabase, - protos.google.spanner.admin.database.v1.IUpdateDatabaseMetadata - >; - const [response] = await operation.promise(); + const response = await promise; assert.deepStrictEqual(response, expectedResponse); const actualRequest = ( - client.innerApiCalls.updateDatabase as SinonStub + client.innerApiCalls.updateBackupSchedule as SinonStub ).getCall(0).args[0]; assert.deepStrictEqual(actualRequest, request); const actualHeaderRequestParams = ( - client.innerApiCalls.updateDatabase as SinonStub + client.innerApiCalls.updateBackupSchedule as SinonStub ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - it('invokes updateDatabase with call error', async () => { + it('invokes updateBackupSchedule with error', async () => { const client = new databaseadminModule.v1.DatabaseAdminClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.spanner.admin.database.v1.UpdateDatabaseRequest() + new protos.google.spanner.admin.database.v1.UpdateBackupScheduleRequest() ); - request.database ??= {}; + request.backupSchedule ??= {}; const defaultValue1 = getTypeDefaultValue( - '.google.spanner.admin.database.v1.UpdateDatabaseRequest', - ['database', 'name'] + '.google.spanner.admin.database.v1.UpdateBackupScheduleRequest', + ['backupSchedule', 'name'] ); - request.database.name = defaultValue1; - const expectedHeaderRequestParams = `database.name=${defaultValue1}`; + request.backupSchedule.name = defaultValue1; + const expectedHeaderRequestParams = `backup_schedule.name=${defaultValue1}`; const expectedError = new Error('expected'); - client.innerApiCalls.updateDatabase = stubLongRunningCall( + client.innerApiCalls.updateBackupSchedule = stubSimpleCall( undefined, expectedError ); - await assert.rejects(client.updateDatabase(request), expectedError); + await assert.rejects(client.updateBackupSchedule(request), expectedError); const actualRequest = ( - client.innerApiCalls.updateDatabase as SinonStub + client.innerApiCalls.updateBackupSchedule as SinonStub ).getCall(0).args[0]; assert.deepStrictEqual(actualRequest, request); const actualHeaderRequestParams = ( - client.innerApiCalls.updateDatabase as SinonStub + client.innerApiCalls.updateBackupSchedule as SinonStub ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - it('invokes updateDatabase with LRO error', async () => { + it('invokes updateBackupSchedule with closed client', async () => { const client = new databaseadminModule.v1.DatabaseAdminClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.spanner.admin.database.v1.UpdateDatabaseRequest() + new protos.google.spanner.admin.database.v1.UpdateBackupScheduleRequest() ); - request.database ??= {}; + request.backupSchedule ??= {}; const defaultValue1 = getTypeDefaultValue( - '.google.spanner.admin.database.v1.UpdateDatabaseRequest', - ['database', 'name'] - ); - request.database.name = defaultValue1; - const expectedHeaderRequestParams = `database.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateDatabase = stubLongRunningCall( - undefined, - undefined, - expectedError + '.google.spanner.admin.database.v1.UpdateBackupScheduleRequest', + ['backupSchedule', 'name'] ); - const [operation] = await client.updateDatabase(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = ( - client.innerApiCalls.updateDatabase as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.updateDatabase as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + request.backupSchedule.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateBackupSchedule(request), expectedError); }); + }); - it('invokes checkUpdateDatabaseProgress without error', async () => { + describe('deleteBackupSchedule', () => { + it('invokes deleteBackupSchedule without error', async () => { const client = new databaseadminModule.v1.DatabaseAdminClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() + const request = generateSampleMessage( + new protos.google.spanner.admin.database.v1.DeleteBackupScheduleRequest() ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')}; - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateDatabaseProgress( - expectedResponse.name + const defaultValue1 = getTypeDefaultValue( + '.google.spanner.admin.database.v1.DeleteBackupScheduleRequest', + ['name'] ); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteBackupSchedule = + stubSimpleCall(expectedResponse); + const [response] = await client.deleteBackupSchedule(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteBackupSchedule as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteBackupSchedule as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - it('invokes checkUpdateDatabaseProgress with error', async () => { + it('invokes deleteBackupSchedule without error using callback', async () => { const client = new databaseadminModule.v1.DatabaseAdminClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall( + const request = generateSampleMessage( + new protos.google.spanner.admin.database.v1.DeleteBackupScheduleRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.spanner.admin.database.v1.DeleteBackupScheduleRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteBackupSchedule = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteBackupSchedule( + request, + ( + err?: Error | null, + result?: protos.google.protobuf.IEmpty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteBackupSchedule as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteBackupSchedule as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteBackupSchedule with error', async () => { + const client = new databaseadminModule.v1.DatabaseAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.spanner.admin.database.v1.DeleteBackupScheduleRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.spanner.admin.database.v1.DeleteBackupScheduleRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteBackupSchedule = stubSimpleCall( undefined, expectedError ); - await assert.rejects( - client.checkUpdateDatabaseProgress(''), - expectedError + await assert.rejects(client.deleteBackupSchedule(request), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteBackupSchedule as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteBackupSchedule as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteBackupSchedule with closed client', async () => { + const client = new databaseadminModule.v1.DatabaseAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.spanner.admin.database.v1.DeleteBackupScheduleRequest() ); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + const defaultValue1 = getTypeDefaultValue( + '.google.spanner.admin.database.v1.DeleteBackupScheduleRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteBackupSchedule(request), expectedError); }); }); - describe('updateDatabaseDdl', () => { - it('invokes updateDatabaseDdl without error', async () => { + describe('createDatabase', () => { + it('invokes createDatabase without error', async () => { const client = new databaseadminModule.v1.DatabaseAdminClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.spanner.admin.database.v1.UpdateDatabaseDdlRequest() + new protos.google.spanner.admin.database.v1.CreateDatabaseRequest() ); const defaultValue1 = getTypeDefaultValue( - '.google.spanner.admin.database.v1.UpdateDatabaseDdlRequest', - ['database'] + '.google.spanner.admin.database.v1.CreateDatabaseRequest', + ['parent'] ); - request.database = defaultValue1; - const expectedHeaderRequestParams = `database=${defaultValue1}`; + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.updateDatabaseDdl = + client.innerApiCalls.createDatabase = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateDatabaseDdl(request); + const [operation] = await client.createDatabase(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); const actualRequest = ( - client.innerApiCalls.updateDatabaseDdl as SinonStub + client.innerApiCalls.createDatabase as SinonStub ).getCall(0).args[0]; assert.deepStrictEqual(actualRequest, request); const actualHeaderRequestParams = ( - client.innerApiCalls.updateDatabaseDdl as SinonStub + client.innerApiCalls.createDatabase as SinonStub ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - it('invokes updateDatabaseDdl without error using callback', async () => { + it('invokes createDatabase without error using callback', async () => { const client = new databaseadminModule.v1.DatabaseAdminClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.spanner.admin.database.v1.UpdateDatabaseDdlRequest() + new protos.google.spanner.admin.database.v1.CreateDatabaseRequest() ); const defaultValue1 = getTypeDefaultValue( - '.google.spanner.admin.database.v1.UpdateDatabaseDdlRequest', - ['database'] + '.google.spanner.admin.database.v1.CreateDatabaseRequest', + ['parent'] ); - request.database = defaultValue1; - const expectedHeaderRequestParams = `database=${defaultValue1}`; + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.updateDatabaseDdl = + client.innerApiCalls.createDatabase = stubLongRunningCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { - client.updateDatabaseDdl( + client.createDatabase( request, ( err?: Error | null, result?: LROperation< - protos.google.protobuf.IEmpty, - protos.google.spanner.admin.database.v1.IUpdateDatabaseDdlMetadata + protos.google.spanner.admin.database.v1.IDatabase, + protos.google.spanner.admin.database.v1.ICreateDatabaseMetadata > | null ) => { if (err) { @@ -1974,86 +2109,86 @@ describe('v1.DatabaseAdminClient', () => { ); }); const operation = (await promise) as LROperation< - protos.google.protobuf.IEmpty, - protos.google.spanner.admin.database.v1.IUpdateDatabaseDdlMetadata + protos.google.spanner.admin.database.v1.IDatabase, + protos.google.spanner.admin.database.v1.ICreateDatabaseMetadata >; const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); const actualRequest = ( - client.innerApiCalls.updateDatabaseDdl as SinonStub + client.innerApiCalls.createDatabase as SinonStub ).getCall(0).args[0]; assert.deepStrictEqual(actualRequest, request); const actualHeaderRequestParams = ( - client.innerApiCalls.updateDatabaseDdl as SinonStub + client.innerApiCalls.createDatabase as SinonStub ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - it('invokes updateDatabaseDdl with call error', async () => { + it('invokes createDatabase with call error', async () => { const client = new databaseadminModule.v1.DatabaseAdminClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.spanner.admin.database.v1.UpdateDatabaseDdlRequest() + new protos.google.spanner.admin.database.v1.CreateDatabaseRequest() ); const defaultValue1 = getTypeDefaultValue( - '.google.spanner.admin.database.v1.UpdateDatabaseDdlRequest', - ['database'] + '.google.spanner.admin.database.v1.CreateDatabaseRequest', + ['parent'] ); - request.database = defaultValue1; - const expectedHeaderRequestParams = `database=${defaultValue1}`; + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); - client.innerApiCalls.updateDatabaseDdl = stubLongRunningCall( + client.innerApiCalls.createDatabase = stubLongRunningCall( undefined, expectedError ); - await assert.rejects(client.updateDatabaseDdl(request), expectedError); + await assert.rejects(client.createDatabase(request), expectedError); const actualRequest = ( - client.innerApiCalls.updateDatabaseDdl as SinonStub + client.innerApiCalls.createDatabase as SinonStub ).getCall(0).args[0]; assert.deepStrictEqual(actualRequest, request); const actualHeaderRequestParams = ( - client.innerApiCalls.updateDatabaseDdl as SinonStub + client.innerApiCalls.createDatabase as SinonStub ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - it('invokes updateDatabaseDdl with LRO error', async () => { + it('invokes createDatabase with LRO error', async () => { const client = new databaseadminModule.v1.DatabaseAdminClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.spanner.admin.database.v1.UpdateDatabaseDdlRequest() + new protos.google.spanner.admin.database.v1.CreateDatabaseRequest() ); const defaultValue1 = getTypeDefaultValue( - '.google.spanner.admin.database.v1.UpdateDatabaseDdlRequest', - ['database'] + '.google.spanner.admin.database.v1.CreateDatabaseRequest', + ['parent'] ); - request.database = defaultValue1; - const expectedHeaderRequestParams = `database=${defaultValue1}`; + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); - client.innerApiCalls.updateDatabaseDdl = stubLongRunningCall( + client.innerApiCalls.createDatabase = stubLongRunningCall( undefined, undefined, expectedError ); - const [operation] = await client.updateDatabaseDdl(request); + const [operation] = await client.createDatabase(request); await assert.rejects(operation.promise(), expectedError); const actualRequest = ( - client.innerApiCalls.updateDatabaseDdl as SinonStub + client.innerApiCalls.createDatabase as SinonStub ).getCall(0).args[0]; assert.deepStrictEqual(actualRequest, request); const actualHeaderRequestParams = ( - client.innerApiCalls.updateDatabaseDdl as SinonStub + client.innerApiCalls.createDatabase as SinonStub ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - it('invokes checkUpdateDatabaseDdlProgress without error', async () => { + it('invokes checkCreateDatabaseProgress without error', async () => { const client = new databaseadminModule.v1.DatabaseAdminClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', @@ -2067,7 +2202,7 @@ describe('v1.DatabaseAdminClient', () => { expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')}; client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateDatabaseDdlProgress( + const decodedOperation = await client.checkCreateDatabaseProgress( expectedResponse.name ); assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); @@ -2075,7 +2210,7 @@ describe('v1.DatabaseAdminClient', () => { assert((client.operationsClient.getOperation as SinonStub).getCall(0)); }); - it('invokes checkUpdateDatabaseDdlProgress with error', async () => { + it('invokes checkCreateDatabaseProgress with error', async () => { const client = new databaseadminModule.v1.DatabaseAdminClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', @@ -2088,74 +2223,77 @@ describe('v1.DatabaseAdminClient', () => { expectedError ); await assert.rejects( - client.checkUpdateDatabaseDdlProgress(''), + client.checkCreateDatabaseProgress(''), expectedError ); assert((client.operationsClient.getOperation as SinonStub).getCall(0)); }); }); - describe('createBackup', () => { - it('invokes createBackup without error', async () => { + describe('updateDatabase', () => { + it('invokes updateDatabase without error', async () => { const client = new databaseadminModule.v1.DatabaseAdminClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.spanner.admin.database.v1.CreateBackupRequest() + new protos.google.spanner.admin.database.v1.UpdateDatabaseRequest() ); + request.database ??= {}; const defaultValue1 = getTypeDefaultValue( - '.google.spanner.admin.database.v1.CreateBackupRequest', - ['parent'] + '.google.spanner.admin.database.v1.UpdateDatabaseRequest', + ['database', 'name'] ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + request.database.name = defaultValue1; + const expectedHeaderRequestParams = `database.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.createBackup = stubLongRunningCall(expectedResponse); - const [operation] = await client.createBackup(request); + client.innerApiCalls.updateDatabase = + stubLongRunningCall(expectedResponse); + const [operation] = await client.updateDatabase(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); const actualRequest = ( - client.innerApiCalls.createBackup as SinonStub + client.innerApiCalls.updateDatabase as SinonStub ).getCall(0).args[0]; assert.deepStrictEqual(actualRequest, request); const actualHeaderRequestParams = ( - client.innerApiCalls.createBackup as SinonStub + client.innerApiCalls.updateDatabase as SinonStub ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - it('invokes createBackup without error using callback', async () => { + it('invokes updateDatabase without error using callback', async () => { const client = new databaseadminModule.v1.DatabaseAdminClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.spanner.admin.database.v1.CreateBackupRequest() + new protos.google.spanner.admin.database.v1.UpdateDatabaseRequest() ); + request.database ??= {}; const defaultValue1 = getTypeDefaultValue( - '.google.spanner.admin.database.v1.CreateBackupRequest', - ['parent'] + '.google.spanner.admin.database.v1.UpdateDatabaseRequest', + ['database', 'name'] ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + request.database.name = defaultValue1; + const expectedHeaderRequestParams = `database.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.createBackup = + client.innerApiCalls.updateDatabase = stubLongRunningCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { - client.createBackup( + client.updateDatabase( request, ( err?: Error | null, result?: LROperation< - protos.google.spanner.admin.database.v1.IBackup, - protos.google.spanner.admin.database.v1.ICreateBackupMetadata + protos.google.spanner.admin.database.v1.IDatabase, + protos.google.spanner.admin.database.v1.IUpdateDatabaseMetadata > | null ) => { if (err) { @@ -2167,86 +2305,88 @@ describe('v1.DatabaseAdminClient', () => { ); }); const operation = (await promise) as LROperation< - protos.google.spanner.admin.database.v1.IBackup, - protos.google.spanner.admin.database.v1.ICreateBackupMetadata + protos.google.spanner.admin.database.v1.IDatabase, + protos.google.spanner.admin.database.v1.IUpdateDatabaseMetadata >; const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); const actualRequest = ( - client.innerApiCalls.createBackup as SinonStub + client.innerApiCalls.updateDatabase as SinonStub ).getCall(0).args[0]; assert.deepStrictEqual(actualRequest, request); const actualHeaderRequestParams = ( - client.innerApiCalls.createBackup as SinonStub + client.innerApiCalls.updateDatabase as SinonStub ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - it('invokes createBackup with call error', async () => { + it('invokes updateDatabase with call error', async () => { const client = new databaseadminModule.v1.DatabaseAdminClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.spanner.admin.database.v1.CreateBackupRequest() + new protos.google.spanner.admin.database.v1.UpdateDatabaseRequest() ); + request.database ??= {}; const defaultValue1 = getTypeDefaultValue( - '.google.spanner.admin.database.v1.CreateBackupRequest', - ['parent'] + '.google.spanner.admin.database.v1.UpdateDatabaseRequest', + ['database', 'name'] ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + request.database.name = defaultValue1; + const expectedHeaderRequestParams = `database.name=${defaultValue1}`; const expectedError = new Error('expected'); - client.innerApiCalls.createBackup = stubLongRunningCall( + client.innerApiCalls.updateDatabase = stubLongRunningCall( undefined, expectedError ); - await assert.rejects(client.createBackup(request), expectedError); + await assert.rejects(client.updateDatabase(request), expectedError); const actualRequest = ( - client.innerApiCalls.createBackup as SinonStub + client.innerApiCalls.updateDatabase as SinonStub ).getCall(0).args[0]; assert.deepStrictEqual(actualRequest, request); const actualHeaderRequestParams = ( - client.innerApiCalls.createBackup as SinonStub + client.innerApiCalls.updateDatabase as SinonStub ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - it('invokes createBackup with LRO error', async () => { + it('invokes updateDatabase with LRO error', async () => { const client = new databaseadminModule.v1.DatabaseAdminClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.spanner.admin.database.v1.CreateBackupRequest() + new protos.google.spanner.admin.database.v1.UpdateDatabaseRequest() ); + request.database ??= {}; const defaultValue1 = getTypeDefaultValue( - '.google.spanner.admin.database.v1.CreateBackupRequest', - ['parent'] + '.google.spanner.admin.database.v1.UpdateDatabaseRequest', + ['database', 'name'] ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + request.database.name = defaultValue1; + const expectedHeaderRequestParams = `database.name=${defaultValue1}`; const expectedError = new Error('expected'); - client.innerApiCalls.createBackup = stubLongRunningCall( + client.innerApiCalls.updateDatabase = stubLongRunningCall( undefined, undefined, expectedError ); - const [operation] = await client.createBackup(request); + const [operation] = await client.updateDatabase(request); await assert.rejects(operation.promise(), expectedError); const actualRequest = ( - client.innerApiCalls.createBackup as SinonStub + client.innerApiCalls.updateDatabase as SinonStub ).getCall(0).args[0]; assert.deepStrictEqual(actualRequest, request); const actualHeaderRequestParams = ( - client.innerApiCalls.createBackup as SinonStub + client.innerApiCalls.updateDatabase as SinonStub ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - it('invokes checkCreateBackupProgress without error', async () => { + it('invokes checkUpdateDatabaseProgress without error', async () => { const client = new databaseadminModule.v1.DatabaseAdminClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', @@ -2260,7 +2400,7 @@ describe('v1.DatabaseAdminClient', () => { expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')}; client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateBackupProgress( + const decodedOperation = await client.checkUpdateDatabaseProgress( expectedResponse.name ); assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); @@ -2268,7 +2408,7 @@ describe('v1.DatabaseAdminClient', () => { assert((client.operationsClient.getOperation as SinonStub).getCall(0)); }); - it('invokes checkCreateBackupProgress with error', async () => { + it('invokes checkUpdateDatabaseProgress with error', async () => { const client = new databaseadminModule.v1.DatabaseAdminClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', @@ -2280,72 +2420,76 @@ describe('v1.DatabaseAdminClient', () => { undefined, expectedError ); - await assert.rejects(client.checkCreateBackupProgress(''), expectedError); + await assert.rejects( + client.checkUpdateDatabaseProgress(''), + expectedError + ); assert((client.operationsClient.getOperation as SinonStub).getCall(0)); }); }); - describe('copyBackup', () => { - it('invokes copyBackup without error', async () => { + describe('updateDatabaseDdl', () => { + it('invokes updateDatabaseDdl without error', async () => { const client = new databaseadminModule.v1.DatabaseAdminClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.spanner.admin.database.v1.CopyBackupRequest() + new protos.google.spanner.admin.database.v1.UpdateDatabaseDdlRequest() ); const defaultValue1 = getTypeDefaultValue( - '.google.spanner.admin.database.v1.CopyBackupRequest', - ['parent'] + '.google.spanner.admin.database.v1.UpdateDatabaseDdlRequest', + ['database'] ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + request.database = defaultValue1; + const expectedHeaderRequestParams = `database=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.copyBackup = stubLongRunningCall(expectedResponse); - const [operation] = await client.copyBackup(request); + client.innerApiCalls.updateDatabaseDdl = + stubLongRunningCall(expectedResponse); + const [operation] = await client.updateDatabaseDdl(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); const actualRequest = ( - client.innerApiCalls.copyBackup as SinonStub + client.innerApiCalls.updateDatabaseDdl as SinonStub ).getCall(0).args[0]; assert.deepStrictEqual(actualRequest, request); const actualHeaderRequestParams = ( - client.innerApiCalls.copyBackup as SinonStub + client.innerApiCalls.updateDatabaseDdl as SinonStub ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - it('invokes copyBackup without error using callback', async () => { + it('invokes updateDatabaseDdl without error using callback', async () => { const client = new databaseadminModule.v1.DatabaseAdminClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.spanner.admin.database.v1.CopyBackupRequest() + new protos.google.spanner.admin.database.v1.UpdateDatabaseDdlRequest() ); const defaultValue1 = getTypeDefaultValue( - '.google.spanner.admin.database.v1.CopyBackupRequest', - ['parent'] + '.google.spanner.admin.database.v1.UpdateDatabaseDdlRequest', + ['database'] ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + request.database = defaultValue1; + const expectedHeaderRequestParams = `database=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.copyBackup = + client.innerApiCalls.updateDatabaseDdl = stubLongRunningCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { - client.copyBackup( + client.updateDatabaseDdl( request, ( err?: Error | null, result?: LROperation< - protos.google.spanner.admin.database.v1.IBackup, - protos.google.spanner.admin.database.v1.ICopyBackupMetadata + protos.google.protobuf.IEmpty, + protos.google.spanner.admin.database.v1.IUpdateDatabaseDdlMetadata > | null ) => { if (err) { @@ -2357,86 +2501,86 @@ describe('v1.DatabaseAdminClient', () => { ); }); const operation = (await promise) as LROperation< - protos.google.spanner.admin.database.v1.IBackup, - protos.google.spanner.admin.database.v1.ICopyBackupMetadata + protos.google.protobuf.IEmpty, + protos.google.spanner.admin.database.v1.IUpdateDatabaseDdlMetadata >; const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); const actualRequest = ( - client.innerApiCalls.copyBackup as SinonStub + client.innerApiCalls.updateDatabaseDdl as SinonStub ).getCall(0).args[0]; assert.deepStrictEqual(actualRequest, request); const actualHeaderRequestParams = ( - client.innerApiCalls.copyBackup as SinonStub + client.innerApiCalls.updateDatabaseDdl as SinonStub ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - it('invokes copyBackup with call error', async () => { + it('invokes updateDatabaseDdl with call error', async () => { const client = new databaseadminModule.v1.DatabaseAdminClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.spanner.admin.database.v1.CopyBackupRequest() + new protos.google.spanner.admin.database.v1.UpdateDatabaseDdlRequest() ); const defaultValue1 = getTypeDefaultValue( - '.google.spanner.admin.database.v1.CopyBackupRequest', - ['parent'] + '.google.spanner.admin.database.v1.UpdateDatabaseDdlRequest', + ['database'] ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + request.database = defaultValue1; + const expectedHeaderRequestParams = `database=${defaultValue1}`; const expectedError = new Error('expected'); - client.innerApiCalls.copyBackup = stubLongRunningCall( + client.innerApiCalls.updateDatabaseDdl = stubLongRunningCall( undefined, expectedError ); - await assert.rejects(client.copyBackup(request), expectedError); + await assert.rejects(client.updateDatabaseDdl(request), expectedError); const actualRequest = ( - client.innerApiCalls.copyBackup as SinonStub + client.innerApiCalls.updateDatabaseDdl as SinonStub ).getCall(0).args[0]; assert.deepStrictEqual(actualRequest, request); const actualHeaderRequestParams = ( - client.innerApiCalls.copyBackup as SinonStub + client.innerApiCalls.updateDatabaseDdl as SinonStub ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - it('invokes copyBackup with LRO error', async () => { + it('invokes updateDatabaseDdl with LRO error', async () => { const client = new databaseadminModule.v1.DatabaseAdminClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.spanner.admin.database.v1.CopyBackupRequest() + new protos.google.spanner.admin.database.v1.UpdateDatabaseDdlRequest() ); const defaultValue1 = getTypeDefaultValue( - '.google.spanner.admin.database.v1.CopyBackupRequest', - ['parent'] + '.google.spanner.admin.database.v1.UpdateDatabaseDdlRequest', + ['database'] ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + request.database = defaultValue1; + const expectedHeaderRequestParams = `database=${defaultValue1}`; const expectedError = new Error('expected'); - client.innerApiCalls.copyBackup = stubLongRunningCall( + client.innerApiCalls.updateDatabaseDdl = stubLongRunningCall( undefined, undefined, expectedError ); - const [operation] = await client.copyBackup(request); + const [operation] = await client.updateDatabaseDdl(request); await assert.rejects(operation.promise(), expectedError); const actualRequest = ( - client.innerApiCalls.copyBackup as SinonStub + client.innerApiCalls.updateDatabaseDdl as SinonStub ).getCall(0).args[0]; assert.deepStrictEqual(actualRequest, request); const actualHeaderRequestParams = ( - client.innerApiCalls.copyBackup as SinonStub + client.innerApiCalls.updateDatabaseDdl as SinonStub ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - it('invokes checkCopyBackupProgress without error', async () => { + it('invokes checkUpdateDatabaseDdlProgress without error', async () => { const client = new databaseadminModule.v1.DatabaseAdminClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', @@ -2450,7 +2594,7 @@ describe('v1.DatabaseAdminClient', () => { expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')}; client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCopyBackupProgress( + const decodedOperation = await client.checkUpdateDatabaseDdlProgress( expectedResponse.name ); assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); @@ -2458,7 +2602,7 @@ describe('v1.DatabaseAdminClient', () => { assert((client.operationsClient.getOperation as SinonStub).getCall(0)); }); - it('invokes checkCopyBackupProgress with error', async () => { + it('invokes checkUpdateDatabaseDdlProgress with error', async () => { const client = new databaseadminModule.v1.DatabaseAdminClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', @@ -2470,23 +2614,26 @@ describe('v1.DatabaseAdminClient', () => { undefined, expectedError ); - await assert.rejects(client.checkCopyBackupProgress(''), expectedError); + await assert.rejects( + client.checkUpdateDatabaseDdlProgress(''), + expectedError + ); assert((client.operationsClient.getOperation as SinonStub).getCall(0)); }); }); - describe('restoreDatabase', () => { - it('invokes restoreDatabase without error', async () => { + describe('createBackup', () => { + it('invokes createBackup without error', async () => { const client = new databaseadminModule.v1.DatabaseAdminClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.spanner.admin.database.v1.RestoreDatabaseRequest() + new protos.google.spanner.admin.database.v1.CreateBackupRequest() ); const defaultValue1 = getTypeDefaultValue( - '.google.spanner.admin.database.v1.RestoreDatabaseRequest', + '.google.spanner.admin.database.v1.CreateBackupRequest', ['parent'] ); request.parent = defaultValue1; @@ -2494,32 +2641,31 @@ describe('v1.DatabaseAdminClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.restoreDatabase = - stubLongRunningCall(expectedResponse); - const [operation] = await client.restoreDatabase(request); + client.innerApiCalls.createBackup = stubLongRunningCall(expectedResponse); + const [operation] = await client.createBackup(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); const actualRequest = ( - client.innerApiCalls.restoreDatabase as SinonStub + client.innerApiCalls.createBackup as SinonStub ).getCall(0).args[0]; assert.deepStrictEqual(actualRequest, request); const actualHeaderRequestParams = ( - client.innerApiCalls.restoreDatabase as SinonStub + client.innerApiCalls.createBackup as SinonStub ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - it('invokes restoreDatabase without error using callback', async () => { + it('invokes createBackup without error using callback', async () => { const client = new databaseadminModule.v1.DatabaseAdminClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.spanner.admin.database.v1.RestoreDatabaseRequest() + new protos.google.spanner.admin.database.v1.CreateBackupRequest() ); const defaultValue1 = getTypeDefaultValue( - '.google.spanner.admin.database.v1.RestoreDatabaseRequest', + '.google.spanner.admin.database.v1.CreateBackupRequest', ['parent'] ); request.parent = defaultValue1; @@ -2527,16 +2673,16 @@ describe('v1.DatabaseAdminClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.restoreDatabase = + client.innerApiCalls.createBackup = stubLongRunningCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { - client.restoreDatabase( + client.createBackup( request, ( err?: Error | null, result?: LROperation< - protos.google.spanner.admin.database.v1.IDatabase, - protos.google.spanner.admin.database.v1.IRestoreDatabaseMetadata + protos.google.spanner.admin.database.v1.IBackup, + protos.google.spanner.admin.database.v1.ICreateBackupMetadata > | null ) => { if (err) { @@ -2548,86 +2694,86 @@ describe('v1.DatabaseAdminClient', () => { ); }); const operation = (await promise) as LROperation< - protos.google.spanner.admin.database.v1.IDatabase, - protos.google.spanner.admin.database.v1.IRestoreDatabaseMetadata + protos.google.spanner.admin.database.v1.IBackup, + protos.google.spanner.admin.database.v1.ICreateBackupMetadata >; const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); const actualRequest = ( - client.innerApiCalls.restoreDatabase as SinonStub + client.innerApiCalls.createBackup as SinonStub ).getCall(0).args[0]; assert.deepStrictEqual(actualRequest, request); const actualHeaderRequestParams = ( - client.innerApiCalls.restoreDatabase as SinonStub + client.innerApiCalls.createBackup as SinonStub ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - it('invokes restoreDatabase with call error', async () => { + it('invokes createBackup with call error', async () => { const client = new databaseadminModule.v1.DatabaseAdminClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.spanner.admin.database.v1.RestoreDatabaseRequest() + new protos.google.spanner.admin.database.v1.CreateBackupRequest() ); const defaultValue1 = getTypeDefaultValue( - '.google.spanner.admin.database.v1.RestoreDatabaseRequest', + '.google.spanner.admin.database.v1.CreateBackupRequest', ['parent'] ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); - client.innerApiCalls.restoreDatabase = stubLongRunningCall( + client.innerApiCalls.createBackup = stubLongRunningCall( undefined, expectedError ); - await assert.rejects(client.restoreDatabase(request), expectedError); + await assert.rejects(client.createBackup(request), expectedError); const actualRequest = ( - client.innerApiCalls.restoreDatabase as SinonStub + client.innerApiCalls.createBackup as SinonStub ).getCall(0).args[0]; assert.deepStrictEqual(actualRequest, request); const actualHeaderRequestParams = ( - client.innerApiCalls.restoreDatabase as SinonStub + client.innerApiCalls.createBackup as SinonStub ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - it('invokes restoreDatabase with LRO error', async () => { + it('invokes createBackup with LRO error', async () => { const client = new databaseadminModule.v1.DatabaseAdminClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.spanner.admin.database.v1.RestoreDatabaseRequest() + new protos.google.spanner.admin.database.v1.CreateBackupRequest() ); const defaultValue1 = getTypeDefaultValue( - '.google.spanner.admin.database.v1.RestoreDatabaseRequest', + '.google.spanner.admin.database.v1.CreateBackupRequest', ['parent'] ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); - client.innerApiCalls.restoreDatabase = stubLongRunningCall( + client.innerApiCalls.createBackup = stubLongRunningCall( undefined, undefined, expectedError ); - const [operation] = await client.restoreDatabase(request); + const [operation] = await client.createBackup(request); await assert.rejects(operation.promise(), expectedError); const actualRequest = ( - client.innerApiCalls.restoreDatabase as SinonStub + client.innerApiCalls.createBackup as SinonStub ).getCall(0).args[0]; assert.deepStrictEqual(actualRequest, request); const actualHeaderRequestParams = ( - client.innerApiCalls.restoreDatabase as SinonStub + client.innerApiCalls.createBackup as SinonStub ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - it('invokes checkRestoreDatabaseProgress without error', async () => { + it('invokes checkCreateBackupProgress without error', async () => { const client = new databaseadminModule.v1.DatabaseAdminClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', @@ -2641,7 +2787,7 @@ describe('v1.DatabaseAdminClient', () => { expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')}; client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkRestoreDatabaseProgress( + const decodedOperation = await client.checkCreateBackupProgress( expectedResponse.name ); assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); @@ -2649,7 +2795,7 @@ describe('v1.DatabaseAdminClient', () => { assert((client.operationsClient.getOperation as SinonStub).getCall(0)); }); - it('invokes checkRestoreDatabaseProgress with error', async () => { + it('invokes checkCreateBackupProgress with error', async () => { const client = new databaseadminModule.v1.DatabaseAdminClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', @@ -2661,88 +2807,797 @@ describe('v1.DatabaseAdminClient', () => { undefined, expectedError ); - await assert.rejects( - client.checkRestoreDatabaseProgress(''), - expectedError - ); + await assert.rejects(client.checkCreateBackupProgress(''), expectedError); assert((client.operationsClient.getOperation as SinonStub).getCall(0)); }); }); - describe('listDatabases', () => { - it('invokes listDatabases without error', async () => { + describe('copyBackup', () => { + it('invokes copyBackup without error', async () => { const client = new databaseadminModule.v1.DatabaseAdminClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.spanner.admin.database.v1.ListDatabasesRequest() + new protos.google.spanner.admin.database.v1.CopyBackupRequest() ); const defaultValue1 = getTypeDefaultValue( - '.google.spanner.admin.database.v1.ListDatabasesRequest', + '.google.spanner.admin.database.v1.CopyBackupRequest', ['parent'] ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage( - new protos.google.spanner.admin.database.v1.Database() - ), - generateSampleMessage( - new protos.google.spanner.admin.database.v1.Database() - ), - generateSampleMessage( - new protos.google.spanner.admin.database.v1.Database() - ), - ]; - client.innerApiCalls.listDatabases = stubSimpleCall(expectedResponse); - const [response] = await client.listDatabases(request); + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.copyBackup = stubLongRunningCall(expectedResponse); + const [operation] = await client.copyBackup(request); + const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); const actualRequest = ( - client.innerApiCalls.listDatabases as SinonStub + client.innerApiCalls.copyBackup as SinonStub ).getCall(0).args[0]; assert.deepStrictEqual(actualRequest, request); const actualHeaderRequestParams = ( - client.innerApiCalls.listDatabases as SinonStub + client.innerApiCalls.copyBackup as SinonStub ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - it('invokes listDatabases without error using callback', async () => { + it('invokes copyBackup without error using callback', async () => { const client = new databaseadminModule.v1.DatabaseAdminClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.spanner.admin.database.v1.ListDatabasesRequest() + new protos.google.spanner.admin.database.v1.CopyBackupRequest() ); const defaultValue1 = getTypeDefaultValue( - '.google.spanner.admin.database.v1.ListDatabasesRequest', + '.google.spanner.admin.database.v1.CopyBackupRequest', ['parent'] ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage( - new protos.google.spanner.admin.database.v1.Database() - ), - generateSampleMessage( - new protos.google.spanner.admin.database.v1.Database() - ), - generateSampleMessage( - new protos.google.spanner.admin.database.v1.Database() - ), - ]; - client.innerApiCalls.listDatabases = - stubSimpleCallWithCallback(expectedResponse); + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.copyBackup = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.copyBackup( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.spanner.admin.database.v1.IBackup, + protos.google.spanner.admin.database.v1.ICopyBackupMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.spanner.admin.database.v1.IBackup, + protos.google.spanner.admin.database.v1.ICopyBackupMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.copyBackup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.copyBackup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes copyBackup with call error', async () => { + const client = new databaseadminModule.v1.DatabaseAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.spanner.admin.database.v1.CopyBackupRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.spanner.admin.database.v1.CopyBackupRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.copyBackup = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.copyBackup(request), expectedError); + const actualRequest = ( + client.innerApiCalls.copyBackup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.copyBackup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes copyBackup with LRO error', async () => { + const client = new databaseadminModule.v1.DatabaseAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.spanner.admin.database.v1.CopyBackupRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.spanner.admin.database.v1.CopyBackupRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.copyBackup = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.copyBackup(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.copyBackup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.copyBackup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCopyBackupProgress without error', async () => { + const client = new databaseadminModule.v1.DatabaseAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')}; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCopyBackupProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCopyBackupProgress with error', async () => { + const client = new databaseadminModule.v1.DatabaseAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.checkCopyBackupProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('restoreDatabase', () => { + it('invokes restoreDatabase without error', async () => { + const client = new databaseadminModule.v1.DatabaseAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.spanner.admin.database.v1.RestoreDatabaseRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.spanner.admin.database.v1.RestoreDatabaseRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.restoreDatabase = + stubLongRunningCall(expectedResponse); + const [operation] = await client.restoreDatabase(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.restoreDatabase as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.restoreDatabase as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes restoreDatabase without error using callback', async () => { + const client = new databaseadminModule.v1.DatabaseAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.spanner.admin.database.v1.RestoreDatabaseRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.spanner.admin.database.v1.RestoreDatabaseRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.restoreDatabase = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.restoreDatabase( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.spanner.admin.database.v1.IDatabase, + protos.google.spanner.admin.database.v1.IRestoreDatabaseMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.spanner.admin.database.v1.IDatabase, + protos.google.spanner.admin.database.v1.IRestoreDatabaseMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.restoreDatabase as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.restoreDatabase as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes restoreDatabase with call error', async () => { + const client = new databaseadminModule.v1.DatabaseAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.spanner.admin.database.v1.RestoreDatabaseRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.spanner.admin.database.v1.RestoreDatabaseRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.restoreDatabase = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.restoreDatabase(request), expectedError); + const actualRequest = ( + client.innerApiCalls.restoreDatabase as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.restoreDatabase as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes restoreDatabase with LRO error', async () => { + const client = new databaseadminModule.v1.DatabaseAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.spanner.admin.database.v1.RestoreDatabaseRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.spanner.admin.database.v1.RestoreDatabaseRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.restoreDatabase = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.restoreDatabase(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.restoreDatabase as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.restoreDatabase as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkRestoreDatabaseProgress without error', async () => { + const client = new databaseadminModule.v1.DatabaseAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')}; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkRestoreDatabaseProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkRestoreDatabaseProgress with error', async () => { + const client = new databaseadminModule.v1.DatabaseAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.checkRestoreDatabaseProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('listDatabases', () => { + it('invokes listDatabases without error', async () => { + const client = new databaseadminModule.v1.DatabaseAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.spanner.admin.database.v1.ListDatabasesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.spanner.admin.database.v1.ListDatabasesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.spanner.admin.database.v1.Database() + ), + generateSampleMessage( + new protos.google.spanner.admin.database.v1.Database() + ), + generateSampleMessage( + new protos.google.spanner.admin.database.v1.Database() + ), + ]; + client.innerApiCalls.listDatabases = stubSimpleCall(expectedResponse); + const [response] = await client.listDatabases(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listDatabases as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listDatabases as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listDatabases without error using callback', async () => { + const client = new databaseadminModule.v1.DatabaseAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.spanner.admin.database.v1.ListDatabasesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.spanner.admin.database.v1.ListDatabasesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.spanner.admin.database.v1.Database() + ), + generateSampleMessage( + new protos.google.spanner.admin.database.v1.Database() + ), + generateSampleMessage( + new protos.google.spanner.admin.database.v1.Database() + ), + ]; + client.innerApiCalls.listDatabases = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.listDatabases( request, ( err?: Error | null, - result?: protos.google.spanner.admin.database.v1.IDatabase[] | null + result?: protos.google.spanner.admin.database.v1.IDatabase[] | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listDatabases as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listDatabases as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listDatabases with error', async () => { + const client = new databaseadminModule.v1.DatabaseAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.spanner.admin.database.v1.ListDatabasesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.spanner.admin.database.v1.ListDatabasesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listDatabases = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.listDatabases(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listDatabases as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listDatabases as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listDatabasesStream without error', async () => { + const client = new databaseadminModule.v1.DatabaseAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.spanner.admin.database.v1.ListDatabasesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.spanner.admin.database.v1.ListDatabasesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.spanner.admin.database.v1.Database() + ), + generateSampleMessage( + new protos.google.spanner.admin.database.v1.Database() + ), + generateSampleMessage( + new protos.google.spanner.admin.database.v1.Database() + ), + ]; + client.descriptors.page.listDatabases.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listDatabasesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.spanner.admin.database.v1.Database[] = + []; + stream.on( + 'data', + (response: protos.google.spanner.admin.database.v1.Database) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listDatabases.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listDatabases, request) + ); + assert( + (client.descriptors.page.listDatabases.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams) + ); + }); + + it('invokes listDatabasesStream with error', async () => { + const client = new databaseadminModule.v1.DatabaseAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.spanner.admin.database.v1.ListDatabasesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.spanner.admin.database.v1.ListDatabasesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listDatabases.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listDatabasesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.spanner.admin.database.v1.Database[] = + []; + stream.on( + 'data', + (response: protos.google.spanner.admin.database.v1.Database) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listDatabases.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listDatabases, request) + ); + assert( + (client.descriptors.page.listDatabases.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams) + ); + }); + + it('uses async iteration with listDatabases without error', async () => { + const client = new databaseadminModule.v1.DatabaseAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.spanner.admin.database.v1.ListDatabasesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.spanner.admin.database.v1.ListDatabasesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.spanner.admin.database.v1.Database() + ), + generateSampleMessage( + new protos.google.spanner.admin.database.v1.Database() + ), + generateSampleMessage( + new protos.google.spanner.admin.database.v1.Database() + ), + ]; + client.descriptors.page.listDatabases.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.spanner.admin.database.v1.IDatabase[] = []; + const iterable = client.listDatabasesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listDatabases.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + (client.descriptors.page.listDatabases.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams) + ); + }); + + it('uses async iteration with listDatabases with error', async () => { + const client = new databaseadminModule.v1.DatabaseAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.spanner.admin.database.v1.ListDatabasesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.spanner.admin.database.v1.ListDatabasesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listDatabases.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listDatabasesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.spanner.admin.database.v1.IDatabase[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listDatabases.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + (client.descriptors.page.listDatabases.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams) + ); + }); + }); + + describe('listBackups', () => { + it('invokes listBackups without error', async () => { + const client = new databaseadminModule.v1.DatabaseAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.spanner.admin.database.v1.ListBackupsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.spanner.admin.database.v1.ListBackupsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.spanner.admin.database.v1.Backup() + ), + generateSampleMessage( + new protos.google.spanner.admin.database.v1.Backup() + ), + generateSampleMessage( + new protos.google.spanner.admin.database.v1.Backup() + ), + ]; + client.innerApiCalls.listBackups = stubSimpleCall(expectedResponse); + const [response] = await client.listBackups(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listBackups as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listBackups as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listBackups without error using callback', async () => { + const client = new databaseadminModule.v1.DatabaseAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.spanner.admin.database.v1.ListBackupsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.spanner.admin.database.v1.ListBackupsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.spanner.admin.database.v1.Backup() + ), + generateSampleMessage( + new protos.google.spanner.admin.database.v1.Backup() + ), + generateSampleMessage( + new protos.google.spanner.admin.database.v1.Backup() + ), + ]; + client.innerApiCalls.listBackups = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listBackups( + request, + ( + err?: Error | null, + result?: protos.google.spanner.admin.database.v1.IBackup[] | null ) => { if (err) { reject(err); @@ -2755,81 +3610,80 @@ describe('v1.DatabaseAdminClient', () => { const response = await promise; assert.deepStrictEqual(response, expectedResponse); const actualRequest = ( - client.innerApiCalls.listDatabases as SinonStub + client.innerApiCalls.listBackups as SinonStub ).getCall(0).args[0]; assert.deepStrictEqual(actualRequest, request); const actualHeaderRequestParams = ( - client.innerApiCalls.listDatabases as SinonStub + client.innerApiCalls.listBackups as SinonStub ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - it('invokes listDatabases with error', async () => { + it('invokes listBackups with error', async () => { const client = new databaseadminModule.v1.DatabaseAdminClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.spanner.admin.database.v1.ListDatabasesRequest() + new protos.google.spanner.admin.database.v1.ListBackupsRequest() ); const defaultValue1 = getTypeDefaultValue( - '.google.spanner.admin.database.v1.ListDatabasesRequest', + '.google.spanner.admin.database.v1.ListBackupsRequest', ['parent'] ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); - client.innerApiCalls.listDatabases = stubSimpleCall( + client.innerApiCalls.listBackups = stubSimpleCall( undefined, expectedError ); - await assert.rejects(client.listDatabases(request), expectedError); + await assert.rejects(client.listBackups(request), expectedError); const actualRequest = ( - client.innerApiCalls.listDatabases as SinonStub + client.innerApiCalls.listBackups as SinonStub ).getCall(0).args[0]; assert.deepStrictEqual(actualRequest, request); const actualHeaderRequestParams = ( - client.innerApiCalls.listDatabases as SinonStub + client.innerApiCalls.listBackups as SinonStub ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - it('invokes listDatabasesStream without error', async () => { + it('invokes listBackupsStream without error', async () => { const client = new databaseadminModule.v1.DatabaseAdminClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.spanner.admin.database.v1.ListDatabasesRequest() + new protos.google.spanner.admin.database.v1.ListBackupsRequest() ); const defaultValue1 = getTypeDefaultValue( - '.google.spanner.admin.database.v1.ListDatabasesRequest', + '.google.spanner.admin.database.v1.ListBackupsRequest', ['parent'] ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( - new protos.google.spanner.admin.database.v1.Database() + new protos.google.spanner.admin.database.v1.Backup() ), generateSampleMessage( - new protos.google.spanner.admin.database.v1.Database() + new protos.google.spanner.admin.database.v1.Backup() ), generateSampleMessage( - new protos.google.spanner.admin.database.v1.Database() + new protos.google.spanner.admin.database.v1.Backup() ), ]; - client.descriptors.page.listDatabases.createStream = + client.descriptors.page.listBackups.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listDatabasesStream(request); + const stream = client.listBackupsStream(request); const promise = new Promise((resolve, reject) => { - const responses: protos.google.spanner.admin.database.v1.Database[] = - []; + const responses: protos.google.spanner.admin.database.v1.Backup[] = []; stream.on( 'data', - (response: protos.google.spanner.admin.database.v1.Database) => { + (response: protos.google.spanner.admin.database.v1.Backup) => { responses.push(response); } ); @@ -2843,12 +3697,12 @@ describe('v1.DatabaseAdminClient', () => { const responses = await promise; assert.deepStrictEqual(responses, expectedResponse); assert( - (client.descriptors.page.listDatabases.createStream as SinonStub) + (client.descriptors.page.listBackups.createStream as SinonStub) .getCall(0) - .calledWith(client.innerApiCalls.listDatabases, request) + .calledWith(client.innerApiCalls.listBackups, request) ); assert( - (client.descriptors.page.listDatabases.createStream as SinonStub) + (client.descriptors.page.listBackups.createStream as SinonStub) .getCall(0) .args[2].otherArgs.headers[ 'x-goog-request-params' @@ -2856,31 +3710,32 @@ describe('v1.DatabaseAdminClient', () => { ); }); - it('invokes listDatabasesStream with error', async () => { + it('invokes listBackupsStream with error', async () => { const client = new databaseadminModule.v1.DatabaseAdminClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.spanner.admin.database.v1.ListDatabasesRequest() + new protos.google.spanner.admin.database.v1.ListBackupsRequest() ); const defaultValue1 = getTypeDefaultValue( - '.google.spanner.admin.database.v1.ListDatabasesRequest', + '.google.spanner.admin.database.v1.ListBackupsRequest', ['parent'] ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); - client.descriptors.page.listDatabases.createStream = - stubPageStreamingCall(undefined, expectedError); - const stream = client.listDatabasesStream(request); + client.descriptors.page.listBackups.createStream = stubPageStreamingCall( + undefined, + expectedError + ); + const stream = client.listBackupsStream(request); const promise = new Promise((resolve, reject) => { - const responses: protos.google.spanner.admin.database.v1.Database[] = - []; + const responses: protos.google.spanner.admin.database.v1.Backup[] = []; stream.on( 'data', - (response: protos.google.spanner.admin.database.v1.Database) => { + (response: protos.google.spanner.admin.database.v1.Backup) => { responses.push(response); } ); @@ -2893,12 +3748,12 @@ describe('v1.DatabaseAdminClient', () => { }); await assert.rejects(promise, expectedError); assert( - (client.descriptors.page.listDatabases.createStream as SinonStub) + (client.descriptors.page.listBackups.createStream as SinonStub) .getCall(0) - .calledWith(client.innerApiCalls.listDatabases, request) + .calledWith(client.innerApiCalls.listBackups, request) ); assert( - (client.descriptors.page.listDatabases.createStream as SinonStub) + (client.descriptors.page.listBackups.createStream as SinonStub) .getCall(0) .args[2].otherArgs.headers[ 'x-goog-request-params' @@ -2906,48 +3761,48 @@ describe('v1.DatabaseAdminClient', () => { ); }); - it('uses async iteration with listDatabases without error', async () => { + it('uses async iteration with listBackups without error', async () => { const client = new databaseadminModule.v1.DatabaseAdminClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.spanner.admin.database.v1.ListDatabasesRequest() + new protos.google.spanner.admin.database.v1.ListBackupsRequest() ); const defaultValue1 = getTypeDefaultValue( - '.google.spanner.admin.database.v1.ListDatabasesRequest', + '.google.spanner.admin.database.v1.ListBackupsRequest', ['parent'] ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( - new protos.google.spanner.admin.database.v1.Database() + new protos.google.spanner.admin.database.v1.Backup() ), generateSampleMessage( - new protos.google.spanner.admin.database.v1.Database() + new protos.google.spanner.admin.database.v1.Backup() ), generateSampleMessage( - new protos.google.spanner.admin.database.v1.Database() + new protos.google.spanner.admin.database.v1.Backup() ), ]; - client.descriptors.page.listDatabases.asyncIterate = + client.descriptors.page.listBackups.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.spanner.admin.database.v1.IDatabase[] = []; - const iterable = client.listDatabasesAsync(request); + const responses: protos.google.spanner.admin.database.v1.IBackup[] = []; + const iterable = client.listBackupsAsync(request); for await (const resource of iterable) { responses.push(resource!); } assert.deepStrictEqual(responses, expectedResponse); assert.deepStrictEqual( - ( - client.descriptors.page.listDatabases.asyncIterate as SinonStub - ).getCall(0).args[1], + (client.descriptors.page.listBackups.asyncIterate as SinonStub).getCall( + 0 + ).args[1], request ); assert( - (client.descriptors.page.listDatabases.asyncIterate as SinonStub) + (client.descriptors.page.listBackups.asyncIterate as SinonStub) .getCall(0) .args[2].otherArgs.headers[ 'x-goog-request-params' @@ -2955,40 +3810,41 @@ describe('v1.DatabaseAdminClient', () => { ); }); - it('uses async iteration with listDatabases with error', async () => { + it('uses async iteration with listBackups with error', async () => { const client = new databaseadminModule.v1.DatabaseAdminClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.spanner.admin.database.v1.ListDatabasesRequest() + new protos.google.spanner.admin.database.v1.ListBackupsRequest() ); const defaultValue1 = getTypeDefaultValue( - '.google.spanner.admin.database.v1.ListDatabasesRequest', + '.google.spanner.admin.database.v1.ListBackupsRequest', ['parent'] ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); - client.descriptors.page.listDatabases.asyncIterate = - stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listDatabasesAsync(request); + client.descriptors.page.listBackups.asyncIterate = stubAsyncIterationCall( + undefined, + expectedError + ); + const iterable = client.listBackupsAsync(request); await assert.rejects(async () => { - const responses: protos.google.spanner.admin.database.v1.IDatabase[] = - []; + const responses: protos.google.spanner.admin.database.v1.IBackup[] = []; for await (const resource of iterable) { responses.push(resource!); } }); assert.deepStrictEqual( - ( - client.descriptors.page.listDatabases.asyncIterate as SinonStub - ).getCall(0).args[1], + (client.descriptors.page.listBackups.asyncIterate as SinonStub).getCall( + 0 + ).args[1], request ); assert( - (client.descriptors.page.listDatabases.asyncIterate as SinonStub) + (client.descriptors.page.listBackups.asyncIterate as SinonStub) .getCall(0) .args[2].otherArgs.headers[ 'x-goog-request-params' @@ -2997,80 +3853,69 @@ describe('v1.DatabaseAdminClient', () => { }); }); - describe('listBackups', () => { - it('invokes listBackups without error', async () => { + describe('listDatabaseOperations', () => { + it('invokes listDatabaseOperations without error', async () => { const client = new databaseadminModule.v1.DatabaseAdminClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.spanner.admin.database.v1.ListBackupsRequest() + new protos.google.spanner.admin.database.v1.ListDatabaseOperationsRequest() ); const defaultValue1 = getTypeDefaultValue( - '.google.spanner.admin.database.v1.ListBackupsRequest', + '.google.spanner.admin.database.v1.ListDatabaseOperationsRequest', ['parent'] ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ - generateSampleMessage( - new protos.google.spanner.admin.database.v1.Backup() - ), - generateSampleMessage( - new protos.google.spanner.admin.database.v1.Backup() - ), - generateSampleMessage( - new protos.google.spanner.admin.database.v1.Backup() - ), + generateSampleMessage(new protos.google.longrunning.Operation()), + generateSampleMessage(new protos.google.longrunning.Operation()), + generateSampleMessage(new protos.google.longrunning.Operation()), ]; - client.innerApiCalls.listBackups = stubSimpleCall(expectedResponse); - const [response] = await client.listBackups(request); + client.innerApiCalls.listDatabaseOperations = + stubSimpleCall(expectedResponse); + const [response] = await client.listDatabaseOperations(request); assert.deepStrictEqual(response, expectedResponse); const actualRequest = ( - client.innerApiCalls.listBackups as SinonStub + client.innerApiCalls.listDatabaseOperations as SinonStub ).getCall(0).args[0]; assert.deepStrictEqual(actualRequest, request); const actualHeaderRequestParams = ( - client.innerApiCalls.listBackups as SinonStub + client.innerApiCalls.listDatabaseOperations as SinonStub ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - it('invokes listBackups without error using callback', async () => { + it('invokes listDatabaseOperations without error using callback', async () => { const client = new databaseadminModule.v1.DatabaseAdminClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.spanner.admin.database.v1.ListBackupsRequest() + new protos.google.spanner.admin.database.v1.ListDatabaseOperationsRequest() ); const defaultValue1 = getTypeDefaultValue( - '.google.spanner.admin.database.v1.ListBackupsRequest', + '.google.spanner.admin.database.v1.ListDatabaseOperationsRequest', ['parent'] ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ - generateSampleMessage( - new protos.google.spanner.admin.database.v1.Backup() - ), - generateSampleMessage( - new protos.google.spanner.admin.database.v1.Backup() - ), - generateSampleMessage( - new protos.google.spanner.admin.database.v1.Backup() - ), + generateSampleMessage(new protos.google.longrunning.Operation()), + generateSampleMessage(new protos.google.longrunning.Operation()), + generateSampleMessage(new protos.google.longrunning.Operation()), ]; - client.innerApiCalls.listBackups = + client.innerApiCalls.listDatabaseOperations = stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { - client.listBackups( + client.listDatabaseOperations( request, ( err?: Error | null, - result?: protos.google.spanner.admin.database.v1.IBackup[] | null + result?: protos.google.longrunning.IOperation[] | null ) => { if (err) { reject(err); @@ -3083,83 +3928,77 @@ describe('v1.DatabaseAdminClient', () => { const response = await promise; assert.deepStrictEqual(response, expectedResponse); const actualRequest = ( - client.innerApiCalls.listBackups as SinonStub + client.innerApiCalls.listDatabaseOperations as SinonStub ).getCall(0).args[0]; assert.deepStrictEqual(actualRequest, request); const actualHeaderRequestParams = ( - client.innerApiCalls.listBackups as SinonStub + client.innerApiCalls.listDatabaseOperations as SinonStub ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - it('invokes listBackups with error', async () => { + it('invokes listDatabaseOperations with error', async () => { const client = new databaseadminModule.v1.DatabaseAdminClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.spanner.admin.database.v1.ListBackupsRequest() + new protos.google.spanner.admin.database.v1.ListDatabaseOperationsRequest() ); const defaultValue1 = getTypeDefaultValue( - '.google.spanner.admin.database.v1.ListBackupsRequest', + '.google.spanner.admin.database.v1.ListDatabaseOperationsRequest', ['parent'] ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); - client.innerApiCalls.listBackups = stubSimpleCall( + client.innerApiCalls.listDatabaseOperations = stubSimpleCall( undefined, expectedError ); - await assert.rejects(client.listBackups(request), expectedError); + await assert.rejects( + client.listDatabaseOperations(request), + expectedError + ); const actualRequest = ( - client.innerApiCalls.listBackups as SinonStub + client.innerApiCalls.listDatabaseOperations as SinonStub ).getCall(0).args[0]; assert.deepStrictEqual(actualRequest, request); const actualHeaderRequestParams = ( - client.innerApiCalls.listBackups as SinonStub + client.innerApiCalls.listDatabaseOperations as SinonStub ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - it('invokes listBackupsStream without error', async () => { + it('invokes listDatabaseOperationsStream without error', async () => { const client = new databaseadminModule.v1.DatabaseAdminClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.spanner.admin.database.v1.ListBackupsRequest() + new protos.google.spanner.admin.database.v1.ListDatabaseOperationsRequest() ); const defaultValue1 = getTypeDefaultValue( - '.google.spanner.admin.database.v1.ListBackupsRequest', + '.google.spanner.admin.database.v1.ListDatabaseOperationsRequest', ['parent'] ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ - generateSampleMessage( - new protos.google.spanner.admin.database.v1.Backup() - ), - generateSampleMessage( - new protos.google.spanner.admin.database.v1.Backup() - ), - generateSampleMessage( - new protos.google.spanner.admin.database.v1.Backup() - ), + generateSampleMessage(new protos.google.longrunning.Operation()), + generateSampleMessage(new protos.google.longrunning.Operation()), + generateSampleMessage(new protos.google.longrunning.Operation()), ]; - client.descriptors.page.listBackups.createStream = + client.descriptors.page.listDatabaseOperations.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listBackupsStream(request); + const stream = client.listDatabaseOperationsStream(request); const promise = new Promise((resolve, reject) => { - const responses: protos.google.spanner.admin.database.v1.Backup[] = []; - stream.on( - 'data', - (response: protos.google.spanner.admin.database.v1.Backup) => { - responses.push(response); - } - ); + const responses: protos.google.longrunning.Operation[] = []; + stream.on('data', (response: protos.google.longrunning.Operation) => { + responses.push(response); + }); stream.on('end', () => { resolve(responses); }); @@ -3170,48 +4009,49 @@ describe('v1.DatabaseAdminClient', () => { const responses = await promise; assert.deepStrictEqual(responses, expectedResponse); assert( - (client.descriptors.page.listBackups.createStream as SinonStub) + ( + client.descriptors.page.listDatabaseOperations + .createStream as SinonStub + ) .getCall(0) - .calledWith(client.innerApiCalls.listBackups, request) + .calledWith(client.innerApiCalls.listDatabaseOperations, request) ); assert( - (client.descriptors.page.listBackups.createStream as SinonStub) + ( + client.descriptors.page.listDatabaseOperations + .createStream as SinonStub + ) .getCall(0) - .args[2].otherArgs.headers[ - 'x-goog-request-params' - ].includes(expectedHeaderRequestParams) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); - it('invokes listBackupsStream with error', async () => { + it('invokes listDatabaseOperationsStream with error', async () => { const client = new databaseadminModule.v1.DatabaseAdminClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.spanner.admin.database.v1.ListBackupsRequest() + new protos.google.spanner.admin.database.v1.ListDatabaseOperationsRequest() ); const defaultValue1 = getTypeDefaultValue( - '.google.spanner.admin.database.v1.ListBackupsRequest', + '.google.spanner.admin.database.v1.ListDatabaseOperationsRequest', ['parent'] ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); - client.descriptors.page.listBackups.createStream = stubPageStreamingCall( - undefined, - expectedError - ); - const stream = client.listBackupsStream(request); + client.descriptors.page.listDatabaseOperations.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listDatabaseOperationsStream(request); const promise = new Promise((resolve, reject) => { - const responses: protos.google.spanner.admin.database.v1.Backup[] = []; - stream.on( - 'data', - (response: protos.google.spanner.admin.database.v1.Backup) => { - responses.push(response); - } - ); + const responses: protos.google.longrunning.Operation[] = []; + stream.on('data', (response: protos.google.longrunning.Operation) => { + responses.push(response); + }); stream.on('end', () => { resolve(responses); }); @@ -3221,123 +4061,129 @@ describe('v1.DatabaseAdminClient', () => { }); await assert.rejects(promise, expectedError); assert( - (client.descriptors.page.listBackups.createStream as SinonStub) + ( + client.descriptors.page.listDatabaseOperations + .createStream as SinonStub + ) .getCall(0) - .calledWith(client.innerApiCalls.listBackups, request) + .calledWith(client.innerApiCalls.listDatabaseOperations, request) ); assert( - (client.descriptors.page.listBackups.createStream as SinonStub) + ( + client.descriptors.page.listDatabaseOperations + .createStream as SinonStub + ) .getCall(0) - .args[2].otherArgs.headers[ - 'x-goog-request-params' - ].includes(expectedHeaderRequestParams) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); - it('uses async iteration with listBackups without error', async () => { + it('uses async iteration with listDatabaseOperations without error', async () => { const client = new databaseadminModule.v1.DatabaseAdminClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.spanner.admin.database.v1.ListBackupsRequest() + new protos.google.spanner.admin.database.v1.ListDatabaseOperationsRequest() ); const defaultValue1 = getTypeDefaultValue( - '.google.spanner.admin.database.v1.ListBackupsRequest', + '.google.spanner.admin.database.v1.ListDatabaseOperationsRequest', ['parent'] ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ - generateSampleMessage( - new protos.google.spanner.admin.database.v1.Backup() - ), - generateSampleMessage( - new protos.google.spanner.admin.database.v1.Backup() - ), - generateSampleMessage( - new protos.google.spanner.admin.database.v1.Backup() - ), + generateSampleMessage(new protos.google.longrunning.Operation()), + generateSampleMessage(new protos.google.longrunning.Operation()), + generateSampleMessage(new protos.google.longrunning.Operation()), ]; - client.descriptors.page.listBackups.asyncIterate = + client.descriptors.page.listDatabaseOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.spanner.admin.database.v1.IBackup[] = []; - const iterable = client.listBackupsAsync(request); + const responses: protos.google.longrunning.IOperation[] = []; + const iterable = client.listDatabaseOperationsAsync(request); for await (const resource of iterable) { responses.push(resource!); } assert.deepStrictEqual(responses, expectedResponse); assert.deepStrictEqual( - (client.descriptors.page.listBackups.asyncIterate as SinonStub).getCall( - 0 - ).args[1], + ( + client.descriptors.page.listDatabaseOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], request ); assert( - (client.descriptors.page.listBackups.asyncIterate as SinonStub) + ( + client.descriptors.page.listDatabaseOperations + .asyncIterate as SinonStub + ) .getCall(0) - .args[2].otherArgs.headers[ - 'x-goog-request-params' - ].includes(expectedHeaderRequestParams) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); - it('uses async iteration with listBackups with error', async () => { + it('uses async iteration with listDatabaseOperations with error', async () => { const client = new databaseadminModule.v1.DatabaseAdminClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.spanner.admin.database.v1.ListBackupsRequest() + new protos.google.spanner.admin.database.v1.ListDatabaseOperationsRequest() ); const defaultValue1 = getTypeDefaultValue( - '.google.spanner.admin.database.v1.ListBackupsRequest', + '.google.spanner.admin.database.v1.ListDatabaseOperationsRequest', ['parent'] ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); - client.descriptors.page.listBackups.asyncIterate = stubAsyncIterationCall( - undefined, - expectedError - ); - const iterable = client.listBackupsAsync(request); + client.descriptors.page.listDatabaseOperations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listDatabaseOperationsAsync(request); await assert.rejects(async () => { - const responses: protos.google.spanner.admin.database.v1.IBackup[] = []; + const responses: protos.google.longrunning.IOperation[] = []; for await (const resource of iterable) { responses.push(resource!); } }); assert.deepStrictEqual( - (client.descriptors.page.listBackups.asyncIterate as SinonStub).getCall( - 0 - ).args[1], + ( + client.descriptors.page.listDatabaseOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], request ); assert( - (client.descriptors.page.listBackups.asyncIterate as SinonStub) + ( + client.descriptors.page.listDatabaseOperations + .asyncIterate as SinonStub + ) .getCall(0) - .args[2].otherArgs.headers[ - 'x-goog-request-params' - ].includes(expectedHeaderRequestParams) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); }); - describe('listDatabaseOperations', () => { - it('invokes listDatabaseOperations without error', async () => { + describe('listBackupOperations', () => { + it('invokes listBackupOperations without error', async () => { const client = new databaseadminModule.v1.DatabaseAdminClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.spanner.admin.database.v1.ListDatabaseOperationsRequest() + new protos.google.spanner.admin.database.v1.ListBackupOperationsRequest() ); const defaultValue1 = getTypeDefaultValue( - '.google.spanner.admin.database.v1.ListDatabaseOperationsRequest', + '.google.spanner.admin.database.v1.ListBackupOperationsRequest', ['parent'] ); request.parent = defaultValue1; @@ -3347,31 +4193,31 @@ describe('v1.DatabaseAdminClient', () => { generateSampleMessage(new protos.google.longrunning.Operation()), generateSampleMessage(new protos.google.longrunning.Operation()), ]; - client.innerApiCalls.listDatabaseOperations = + client.innerApiCalls.listBackupOperations = stubSimpleCall(expectedResponse); - const [response] = await client.listDatabaseOperations(request); + const [response] = await client.listBackupOperations(request); assert.deepStrictEqual(response, expectedResponse); const actualRequest = ( - client.innerApiCalls.listDatabaseOperations as SinonStub + client.innerApiCalls.listBackupOperations as SinonStub ).getCall(0).args[0]; assert.deepStrictEqual(actualRequest, request); const actualHeaderRequestParams = ( - client.innerApiCalls.listDatabaseOperations as SinonStub + client.innerApiCalls.listBackupOperations as SinonStub ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - it('invokes listDatabaseOperations without error using callback', async () => { + it('invokes listBackupOperations without error using callback', async () => { const client = new databaseadminModule.v1.DatabaseAdminClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.spanner.admin.database.v1.ListDatabaseOperationsRequest() + new protos.google.spanner.admin.database.v1.ListBackupOperationsRequest() ); const defaultValue1 = getTypeDefaultValue( - '.google.spanner.admin.database.v1.ListDatabaseOperationsRequest', + '.google.spanner.admin.database.v1.ListBackupOperationsRequest', ['parent'] ); request.parent = defaultValue1; @@ -3381,10 +4227,10 @@ describe('v1.DatabaseAdminClient', () => { generateSampleMessage(new protos.google.longrunning.Operation()), generateSampleMessage(new protos.google.longrunning.Operation()), ]; - client.innerApiCalls.listDatabaseOperations = + client.innerApiCalls.listBackupOperations = stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { - client.listDatabaseOperations( + client.listBackupOperations( request, ( err?: Error | null, @@ -3401,60 +4247,57 @@ describe('v1.DatabaseAdminClient', () => { const response = await promise; assert.deepStrictEqual(response, expectedResponse); const actualRequest = ( - client.innerApiCalls.listDatabaseOperations as SinonStub + client.innerApiCalls.listBackupOperations as SinonStub ).getCall(0).args[0]; assert.deepStrictEqual(actualRequest, request); const actualHeaderRequestParams = ( - client.innerApiCalls.listDatabaseOperations as SinonStub + client.innerApiCalls.listBackupOperations as SinonStub ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - it('invokes listDatabaseOperations with error', async () => { + it('invokes listBackupOperations with error', async () => { const client = new databaseadminModule.v1.DatabaseAdminClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.spanner.admin.database.v1.ListDatabaseOperationsRequest() + new protos.google.spanner.admin.database.v1.ListBackupOperationsRequest() ); const defaultValue1 = getTypeDefaultValue( - '.google.spanner.admin.database.v1.ListDatabaseOperationsRequest', + '.google.spanner.admin.database.v1.ListBackupOperationsRequest', ['parent'] ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); - client.innerApiCalls.listDatabaseOperations = stubSimpleCall( + client.innerApiCalls.listBackupOperations = stubSimpleCall( undefined, expectedError ); - await assert.rejects( - client.listDatabaseOperations(request), - expectedError - ); + await assert.rejects(client.listBackupOperations(request), expectedError); const actualRequest = ( - client.innerApiCalls.listDatabaseOperations as SinonStub + client.innerApiCalls.listBackupOperations as SinonStub ).getCall(0).args[0]; assert.deepStrictEqual(actualRequest, request); const actualHeaderRequestParams = ( - client.innerApiCalls.listDatabaseOperations as SinonStub + client.innerApiCalls.listBackupOperations as SinonStub ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - it('invokes listDatabaseOperationsStream without error', async () => { + it('invokes listBackupOperationsStream without error', async () => { const client = new databaseadminModule.v1.DatabaseAdminClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.spanner.admin.database.v1.ListDatabaseOperationsRequest() + new protos.google.spanner.admin.database.v1.ListBackupOperationsRequest() ); const defaultValue1 = getTypeDefaultValue( - '.google.spanner.admin.database.v1.ListDatabaseOperationsRequest', + '.google.spanner.admin.database.v1.ListBackupOperationsRequest', ['parent'] ); request.parent = defaultValue1; @@ -3464,9 +4307,9 @@ describe('v1.DatabaseAdminClient', () => { generateSampleMessage(new protos.google.longrunning.Operation()), generateSampleMessage(new protos.google.longrunning.Operation()), ]; - client.descriptors.page.listDatabaseOperations.createStream = + client.descriptors.page.listBackupOperations.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listDatabaseOperationsStream(request); + const stream = client.listBackupOperationsStream(request); const promise = new Promise((resolve, reject) => { const responses: protos.google.longrunning.Operation[] = []; stream.on('data', (response: protos.google.longrunning.Operation) => { @@ -3482,44 +4325,38 @@ describe('v1.DatabaseAdminClient', () => { const responses = await promise; assert.deepStrictEqual(responses, expectedResponse); assert( - ( - client.descriptors.page.listDatabaseOperations - .createStream as SinonStub - ) + (client.descriptors.page.listBackupOperations.createStream as SinonStub) .getCall(0) - .calledWith(client.innerApiCalls.listDatabaseOperations, request) + .calledWith(client.innerApiCalls.listBackupOperations, request) ); assert( - ( - client.descriptors.page.listDatabaseOperations - .createStream as SinonStub - ) + (client.descriptors.page.listBackupOperations.createStream as SinonStub) .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams) ); }); - it('invokes listDatabaseOperationsStream with error', async () => { + it('invokes listBackupOperationsStream with error', async () => { const client = new databaseadminModule.v1.DatabaseAdminClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.spanner.admin.database.v1.ListDatabaseOperationsRequest() + new protos.google.spanner.admin.database.v1.ListBackupOperationsRequest() ); const defaultValue1 = getTypeDefaultValue( - '.google.spanner.admin.database.v1.ListDatabaseOperationsRequest', + '.google.spanner.admin.database.v1.ListBackupOperationsRequest', ['parent'] ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); - client.descriptors.page.listDatabaseOperations.createStream = + client.descriptors.page.listBackupOperations.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listDatabaseOperationsStream(request); + const stream = client.listBackupOperationsStream(request); const promise = new Promise((resolve, reject) => { const responses: protos.google.longrunning.Operation[] = []; stream.on('data', (response: protos.google.longrunning.Operation) => { @@ -3534,36 +4371,30 @@ describe('v1.DatabaseAdminClient', () => { }); await assert.rejects(promise, expectedError); assert( - ( - client.descriptors.page.listDatabaseOperations - .createStream as SinonStub - ) + (client.descriptors.page.listBackupOperations.createStream as SinonStub) .getCall(0) - .calledWith(client.innerApiCalls.listDatabaseOperations, request) + .calledWith(client.innerApiCalls.listBackupOperations, request) ); assert( - ( - client.descriptors.page.listDatabaseOperations - .createStream as SinonStub - ) + (client.descriptors.page.listBackupOperations.createStream as SinonStub) .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams) ); }); - it('uses async iteration with listDatabaseOperations without error', async () => { + it('uses async iteration with listBackupOperations without error', async () => { const client = new databaseadminModule.v1.DatabaseAdminClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.spanner.admin.database.v1.ListDatabaseOperationsRequest() + new protos.google.spanner.admin.database.v1.ListBackupOperationsRequest() ); const defaultValue1 = getTypeDefaultValue( - '.google.spanner.admin.database.v1.ListDatabaseOperationsRequest', + '.google.spanner.admin.database.v1.ListBackupOperationsRequest', ['parent'] ); request.parent = defaultValue1; @@ -3573,52 +4404,48 @@ describe('v1.DatabaseAdminClient', () => { generateSampleMessage(new protos.google.longrunning.Operation()), generateSampleMessage(new protos.google.longrunning.Operation()), ]; - client.descriptors.page.listDatabaseOperations.asyncIterate = + client.descriptors.page.listBackupOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); const responses: protos.google.longrunning.IOperation[] = []; - const iterable = client.listDatabaseOperationsAsync(request); + const iterable = client.listBackupOperationsAsync(request); for await (const resource of iterable) { responses.push(resource!); } assert.deepStrictEqual(responses, expectedResponse); assert.deepStrictEqual( ( - client.descriptors.page.listDatabaseOperations - .asyncIterate as SinonStub + client.descriptors.page.listBackupOperations.asyncIterate as SinonStub ).getCall(0).args[1], request ); assert( - ( - client.descriptors.page.listDatabaseOperations - .asyncIterate as SinonStub - ) + (client.descriptors.page.listBackupOperations.asyncIterate as SinonStub) .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams) ); }); - it('uses async iteration with listDatabaseOperations with error', async () => { + it('uses async iteration with listBackupOperations with error', async () => { const client = new databaseadminModule.v1.DatabaseAdminClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.spanner.admin.database.v1.ListDatabaseOperationsRequest() + new protos.google.spanner.admin.database.v1.ListBackupOperationsRequest() ); const defaultValue1 = getTypeDefaultValue( - '.google.spanner.admin.database.v1.ListDatabaseOperationsRequest', + '.google.spanner.admin.database.v1.ListBackupOperationsRequest', ['parent'] ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); - client.descriptors.page.listDatabaseOperations.asyncIterate = + client.descriptors.page.listBackupOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listDatabaseOperationsAsync(request); + const iterable = client.listBackupOperationsAsync(request); await assert.rejects(async () => { const responses: protos.google.longrunning.IOperation[] = []; for await (const resource of iterable) { @@ -3627,87 +4454,96 @@ describe('v1.DatabaseAdminClient', () => { }); assert.deepStrictEqual( ( - client.descriptors.page.listDatabaseOperations - .asyncIterate as SinonStub + client.descriptors.page.listBackupOperations.asyncIterate as SinonStub ).getCall(0).args[1], request ); assert( - ( - client.descriptors.page.listDatabaseOperations - .asyncIterate as SinonStub - ) + (client.descriptors.page.listBackupOperations.asyncIterate as SinonStub) .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams) ); }); }); - describe('listBackupOperations', () => { - it('invokes listBackupOperations without error', async () => { + describe('listDatabaseRoles', () => { + it('invokes listDatabaseRoles without error', async () => { const client = new databaseadminModule.v1.DatabaseAdminClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.spanner.admin.database.v1.ListBackupOperationsRequest() + new protos.google.spanner.admin.database.v1.ListDatabaseRolesRequest() ); const defaultValue1 = getTypeDefaultValue( - '.google.spanner.admin.database.v1.ListBackupOperationsRequest', + '.google.spanner.admin.database.v1.ListDatabaseRolesRequest', ['parent'] ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ - generateSampleMessage(new protos.google.longrunning.Operation()), - generateSampleMessage(new protos.google.longrunning.Operation()), - generateSampleMessage(new protos.google.longrunning.Operation()), + generateSampleMessage( + new protos.google.spanner.admin.database.v1.DatabaseRole() + ), + generateSampleMessage( + new protos.google.spanner.admin.database.v1.DatabaseRole() + ), + generateSampleMessage( + new protos.google.spanner.admin.database.v1.DatabaseRole() + ), ]; - client.innerApiCalls.listBackupOperations = - stubSimpleCall(expectedResponse); - const [response] = await client.listBackupOperations(request); + client.innerApiCalls.listDatabaseRoles = stubSimpleCall(expectedResponse); + const [response] = await client.listDatabaseRoles(request); assert.deepStrictEqual(response, expectedResponse); const actualRequest = ( - client.innerApiCalls.listBackupOperations as SinonStub + client.innerApiCalls.listDatabaseRoles as SinonStub ).getCall(0).args[0]; assert.deepStrictEqual(actualRequest, request); const actualHeaderRequestParams = ( - client.innerApiCalls.listBackupOperations as SinonStub + client.innerApiCalls.listDatabaseRoles as SinonStub ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - it('invokes listBackupOperations without error using callback', async () => { + it('invokes listDatabaseRoles without error using callback', async () => { const client = new databaseadminModule.v1.DatabaseAdminClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.spanner.admin.database.v1.ListBackupOperationsRequest() + new protos.google.spanner.admin.database.v1.ListDatabaseRolesRequest() ); const defaultValue1 = getTypeDefaultValue( - '.google.spanner.admin.database.v1.ListBackupOperationsRequest', + '.google.spanner.admin.database.v1.ListDatabaseRolesRequest', ['parent'] ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ - generateSampleMessage(new protos.google.longrunning.Operation()), - generateSampleMessage(new protos.google.longrunning.Operation()), - generateSampleMessage(new protos.google.longrunning.Operation()), + generateSampleMessage( + new protos.google.spanner.admin.database.v1.DatabaseRole() + ), + generateSampleMessage( + new protos.google.spanner.admin.database.v1.DatabaseRole() + ), + generateSampleMessage( + new protos.google.spanner.admin.database.v1.DatabaseRole() + ), ]; - client.innerApiCalls.listBackupOperations = + client.innerApiCalls.listDatabaseRoles = stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { - client.listBackupOperations( + client.listDatabaseRoles( request, ( err?: Error | null, - result?: protos.google.longrunning.IOperation[] | null + result?: + | protos.google.spanner.admin.database.v1.IDatabaseRole[] + | null ) => { if (err) { reject(err); @@ -3720,74 +4556,84 @@ describe('v1.DatabaseAdminClient', () => { const response = await promise; assert.deepStrictEqual(response, expectedResponse); const actualRequest = ( - client.innerApiCalls.listBackupOperations as SinonStub + client.innerApiCalls.listDatabaseRoles as SinonStub ).getCall(0).args[0]; assert.deepStrictEqual(actualRequest, request); const actualHeaderRequestParams = ( - client.innerApiCalls.listBackupOperations as SinonStub + client.innerApiCalls.listDatabaseRoles as SinonStub ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - it('invokes listBackupOperations with error', async () => { + it('invokes listDatabaseRoles with error', async () => { const client = new databaseadminModule.v1.DatabaseAdminClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.spanner.admin.database.v1.ListBackupOperationsRequest() + new protos.google.spanner.admin.database.v1.ListDatabaseRolesRequest() ); const defaultValue1 = getTypeDefaultValue( - '.google.spanner.admin.database.v1.ListBackupOperationsRequest', + '.google.spanner.admin.database.v1.ListDatabaseRolesRequest', ['parent'] ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); - client.innerApiCalls.listBackupOperations = stubSimpleCall( + client.innerApiCalls.listDatabaseRoles = stubSimpleCall( undefined, expectedError ); - await assert.rejects(client.listBackupOperations(request), expectedError); + await assert.rejects(client.listDatabaseRoles(request), expectedError); const actualRequest = ( - client.innerApiCalls.listBackupOperations as SinonStub + client.innerApiCalls.listDatabaseRoles as SinonStub ).getCall(0).args[0]; assert.deepStrictEqual(actualRequest, request); const actualHeaderRequestParams = ( - client.innerApiCalls.listBackupOperations as SinonStub + client.innerApiCalls.listDatabaseRoles as SinonStub ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - it('invokes listBackupOperationsStream without error', async () => { + it('invokes listDatabaseRolesStream without error', async () => { const client = new databaseadminModule.v1.DatabaseAdminClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.spanner.admin.database.v1.ListBackupOperationsRequest() + new protos.google.spanner.admin.database.v1.ListDatabaseRolesRequest() ); const defaultValue1 = getTypeDefaultValue( - '.google.spanner.admin.database.v1.ListBackupOperationsRequest', + '.google.spanner.admin.database.v1.ListDatabaseRolesRequest', ['parent'] ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ - generateSampleMessage(new protos.google.longrunning.Operation()), - generateSampleMessage(new protos.google.longrunning.Operation()), - generateSampleMessage(new protos.google.longrunning.Operation()), + generateSampleMessage( + new protos.google.spanner.admin.database.v1.DatabaseRole() + ), + generateSampleMessage( + new protos.google.spanner.admin.database.v1.DatabaseRole() + ), + generateSampleMessage( + new protos.google.spanner.admin.database.v1.DatabaseRole() + ), ]; - client.descriptors.page.listBackupOperations.createStream = + client.descriptors.page.listDatabaseRoles.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listBackupOperationsStream(request); + const stream = client.listDatabaseRolesStream(request); const promise = new Promise((resolve, reject) => { - const responses: protos.google.longrunning.Operation[] = []; - stream.on('data', (response: protos.google.longrunning.Operation) => { - responses.push(response); - }); + const responses: protos.google.spanner.admin.database.v1.DatabaseRole[] = + []; + stream.on( + 'data', + (response: protos.google.spanner.admin.database.v1.DatabaseRole) => { + responses.push(response); + } + ); stream.on('end', () => { resolve(responses); }); @@ -3798,12 +4644,12 @@ describe('v1.DatabaseAdminClient', () => { const responses = await promise; assert.deepStrictEqual(responses, expectedResponse); assert( - (client.descriptors.page.listBackupOperations.createStream as SinonStub) + (client.descriptors.page.listDatabaseRoles.createStream as SinonStub) .getCall(0) - .calledWith(client.innerApiCalls.listBackupOperations, request) + .calledWith(client.innerApiCalls.listDatabaseRoles, request) ); assert( - (client.descriptors.page.listBackupOperations.createStream as SinonStub) + (client.descriptors.page.listDatabaseRoles.createStream as SinonStub) .getCall(0) .args[2].otherArgs.headers[ 'x-goog-request-params' @@ -3811,30 +4657,34 @@ describe('v1.DatabaseAdminClient', () => { ); }); - it('invokes listBackupOperationsStream with error', async () => { + it('invokes listDatabaseRolesStream with error', async () => { const client = new databaseadminModule.v1.DatabaseAdminClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.spanner.admin.database.v1.ListBackupOperationsRequest() + new protos.google.spanner.admin.database.v1.ListDatabaseRolesRequest() ); const defaultValue1 = getTypeDefaultValue( - '.google.spanner.admin.database.v1.ListBackupOperationsRequest', + '.google.spanner.admin.database.v1.ListDatabaseRolesRequest', ['parent'] ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); - client.descriptors.page.listBackupOperations.createStream = + client.descriptors.page.listDatabaseRoles.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listBackupOperationsStream(request); + const stream = client.listDatabaseRolesStream(request); const promise = new Promise((resolve, reject) => { - const responses: protos.google.longrunning.Operation[] = []; - stream.on('data', (response: protos.google.longrunning.Operation) => { - responses.push(response); - }); + const responses: protos.google.spanner.admin.database.v1.DatabaseRole[] = + []; + stream.on( + 'data', + (response: protos.google.spanner.admin.database.v1.DatabaseRole) => { + responses.push(response); + } + ); stream.on('end', () => { resolve(responses); }); @@ -3844,12 +4694,12 @@ describe('v1.DatabaseAdminClient', () => { }); await assert.rejects(promise, expectedError); assert( - (client.descriptors.page.listBackupOperations.createStream as SinonStub) + (client.descriptors.page.listDatabaseRoles.createStream as SinonStub) .getCall(0) - .calledWith(client.innerApiCalls.listBackupOperations, request) + .calledWith(client.innerApiCalls.listDatabaseRoles, request) ); assert( - (client.descriptors.page.listBackupOperations.createStream as SinonStub) + (client.descriptors.page.listDatabaseRoles.createStream as SinonStub) .getCall(0) .args[2].otherArgs.headers[ 'x-goog-request-params' @@ -3857,42 +4707,49 @@ describe('v1.DatabaseAdminClient', () => { ); }); - it('uses async iteration with listBackupOperations without error', async () => { + it('uses async iteration with listDatabaseRoles without error', async () => { const client = new databaseadminModule.v1.DatabaseAdminClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.spanner.admin.database.v1.ListBackupOperationsRequest() + new protos.google.spanner.admin.database.v1.ListDatabaseRolesRequest() ); const defaultValue1 = getTypeDefaultValue( - '.google.spanner.admin.database.v1.ListBackupOperationsRequest', + '.google.spanner.admin.database.v1.ListDatabaseRolesRequest', ['parent'] ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ - generateSampleMessage(new protos.google.longrunning.Operation()), - generateSampleMessage(new protos.google.longrunning.Operation()), - generateSampleMessage(new protos.google.longrunning.Operation()), + generateSampleMessage( + new protos.google.spanner.admin.database.v1.DatabaseRole() + ), + generateSampleMessage( + new protos.google.spanner.admin.database.v1.DatabaseRole() + ), + generateSampleMessage( + new protos.google.spanner.admin.database.v1.DatabaseRole() + ), ]; - client.descriptors.page.listBackupOperations.asyncIterate = + client.descriptors.page.listDatabaseRoles.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.longrunning.IOperation[] = []; - const iterable = client.listBackupOperationsAsync(request); + const responses: protos.google.spanner.admin.database.v1.IDatabaseRole[] = + []; + const iterable = client.listDatabaseRolesAsync(request); for await (const resource of iterable) { responses.push(resource!); } assert.deepStrictEqual(responses, expectedResponse); assert.deepStrictEqual( ( - client.descriptors.page.listBackupOperations.asyncIterate as SinonStub + client.descriptors.page.listDatabaseRoles.asyncIterate as SinonStub ).getCall(0).args[1], request ); assert( - (client.descriptors.page.listBackupOperations.asyncIterate as SinonStub) + (client.descriptors.page.listDatabaseRoles.asyncIterate as SinonStub) .getCall(0) .args[2].otherArgs.headers[ 'x-goog-request-params' @@ -3900,39 +4757,40 @@ describe('v1.DatabaseAdminClient', () => { ); }); - it('uses async iteration with listBackupOperations with error', async () => { + it('uses async iteration with listDatabaseRoles with error', async () => { const client = new databaseadminModule.v1.DatabaseAdminClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.spanner.admin.database.v1.ListBackupOperationsRequest() + new protos.google.spanner.admin.database.v1.ListDatabaseRolesRequest() ); const defaultValue1 = getTypeDefaultValue( - '.google.spanner.admin.database.v1.ListBackupOperationsRequest', + '.google.spanner.admin.database.v1.ListDatabaseRolesRequest', ['parent'] ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); - client.descriptors.page.listBackupOperations.asyncIterate = + client.descriptors.page.listDatabaseRoles.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listBackupOperationsAsync(request); + const iterable = client.listDatabaseRolesAsync(request); await assert.rejects(async () => { - const responses: protos.google.longrunning.IOperation[] = []; + const responses: protos.google.spanner.admin.database.v1.IDatabaseRole[] = + []; for await (const resource of iterable) { responses.push(resource!); } }); assert.deepStrictEqual( ( - client.descriptors.page.listBackupOperations.asyncIterate as SinonStub + client.descriptors.page.listDatabaseRoles.asyncIterate as SinonStub ).getCall(0).args[1], request ); assert( - (client.descriptors.page.listBackupOperations.asyncIterate as SinonStub) + (client.descriptors.page.listDatabaseRoles.asyncIterate as SinonStub) .getCall(0) .args[2].otherArgs.headers[ 'x-goog-request-params' @@ -3941,81 +4799,82 @@ describe('v1.DatabaseAdminClient', () => { }); }); - describe('listDatabaseRoles', () => { - it('invokes listDatabaseRoles without error', async () => { + describe('listBackupSchedules', () => { + it('invokes listBackupSchedules without error', async () => { const client = new databaseadminModule.v1.DatabaseAdminClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.spanner.admin.database.v1.ListDatabaseRolesRequest() + new protos.google.spanner.admin.database.v1.ListBackupSchedulesRequest() ); const defaultValue1 = getTypeDefaultValue( - '.google.spanner.admin.database.v1.ListDatabaseRolesRequest', + '.google.spanner.admin.database.v1.ListBackupSchedulesRequest', ['parent'] ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( - new protos.google.spanner.admin.database.v1.DatabaseRole() + new protos.google.spanner.admin.database.v1.BackupSchedule() ), generateSampleMessage( - new protos.google.spanner.admin.database.v1.DatabaseRole() + new protos.google.spanner.admin.database.v1.BackupSchedule() ), generateSampleMessage( - new protos.google.spanner.admin.database.v1.DatabaseRole() + new protos.google.spanner.admin.database.v1.BackupSchedule() ), ]; - client.innerApiCalls.listDatabaseRoles = stubSimpleCall(expectedResponse); - const [response] = await client.listDatabaseRoles(request); + client.innerApiCalls.listBackupSchedules = + stubSimpleCall(expectedResponse); + const [response] = await client.listBackupSchedules(request); assert.deepStrictEqual(response, expectedResponse); const actualRequest = ( - client.innerApiCalls.listDatabaseRoles as SinonStub + client.innerApiCalls.listBackupSchedules as SinonStub ).getCall(0).args[0]; assert.deepStrictEqual(actualRequest, request); const actualHeaderRequestParams = ( - client.innerApiCalls.listDatabaseRoles as SinonStub + client.innerApiCalls.listBackupSchedules as SinonStub ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - it('invokes listDatabaseRoles without error using callback', async () => { + it('invokes listBackupSchedules without error using callback', async () => { const client = new databaseadminModule.v1.DatabaseAdminClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.spanner.admin.database.v1.ListDatabaseRolesRequest() + new protos.google.spanner.admin.database.v1.ListBackupSchedulesRequest() ); const defaultValue1 = getTypeDefaultValue( - '.google.spanner.admin.database.v1.ListDatabaseRolesRequest', + '.google.spanner.admin.database.v1.ListBackupSchedulesRequest', ['parent'] ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( - new protos.google.spanner.admin.database.v1.DatabaseRole() + new protos.google.spanner.admin.database.v1.BackupSchedule() ), generateSampleMessage( - new protos.google.spanner.admin.database.v1.DatabaseRole() + new protos.google.spanner.admin.database.v1.BackupSchedule() ), generateSampleMessage( - new protos.google.spanner.admin.database.v1.DatabaseRole() + new protos.google.spanner.admin.database.v1.BackupSchedule() ), ]; - client.innerApiCalls.listDatabaseRoles = + client.innerApiCalls.listBackupSchedules = stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { - client.listDatabaseRoles( + client.listBackupSchedules( request, ( err?: Error | null, result?: - | protos.google.spanner.admin.database.v1.IDatabaseRole[] + | protos.google.spanner.admin.database.v1.IBackupSchedule[] | null ) => { if (err) { @@ -4029,81 +4888,83 @@ describe('v1.DatabaseAdminClient', () => { const response = await promise; assert.deepStrictEqual(response, expectedResponse); const actualRequest = ( - client.innerApiCalls.listDatabaseRoles as SinonStub + client.innerApiCalls.listBackupSchedules as SinonStub ).getCall(0).args[0]; assert.deepStrictEqual(actualRequest, request); const actualHeaderRequestParams = ( - client.innerApiCalls.listDatabaseRoles as SinonStub + client.innerApiCalls.listBackupSchedules as SinonStub ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - it('invokes listDatabaseRoles with error', async () => { + it('invokes listBackupSchedules with error', async () => { const client = new databaseadminModule.v1.DatabaseAdminClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.spanner.admin.database.v1.ListDatabaseRolesRequest() + new protos.google.spanner.admin.database.v1.ListBackupSchedulesRequest() ); const defaultValue1 = getTypeDefaultValue( - '.google.spanner.admin.database.v1.ListDatabaseRolesRequest', + '.google.spanner.admin.database.v1.ListBackupSchedulesRequest', ['parent'] ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); - client.innerApiCalls.listDatabaseRoles = stubSimpleCall( + client.innerApiCalls.listBackupSchedules = stubSimpleCall( undefined, expectedError ); - await assert.rejects(client.listDatabaseRoles(request), expectedError); + await assert.rejects(client.listBackupSchedules(request), expectedError); const actualRequest = ( - client.innerApiCalls.listDatabaseRoles as SinonStub + client.innerApiCalls.listBackupSchedules as SinonStub ).getCall(0).args[0]; assert.deepStrictEqual(actualRequest, request); const actualHeaderRequestParams = ( - client.innerApiCalls.listDatabaseRoles as SinonStub + client.innerApiCalls.listBackupSchedules as SinonStub ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - it('invokes listDatabaseRolesStream without error', async () => { + it('invokes listBackupSchedulesStream without error', async () => { const client = new databaseadminModule.v1.DatabaseAdminClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.spanner.admin.database.v1.ListDatabaseRolesRequest() + new protos.google.spanner.admin.database.v1.ListBackupSchedulesRequest() ); const defaultValue1 = getTypeDefaultValue( - '.google.spanner.admin.database.v1.ListDatabaseRolesRequest', + '.google.spanner.admin.database.v1.ListBackupSchedulesRequest', ['parent'] ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( - new protos.google.spanner.admin.database.v1.DatabaseRole() + new protos.google.spanner.admin.database.v1.BackupSchedule() ), generateSampleMessage( - new protos.google.spanner.admin.database.v1.DatabaseRole() + new protos.google.spanner.admin.database.v1.BackupSchedule() ), generateSampleMessage( - new protos.google.spanner.admin.database.v1.DatabaseRole() + new protos.google.spanner.admin.database.v1.BackupSchedule() ), ]; - client.descriptors.page.listDatabaseRoles.createStream = + client.descriptors.page.listBackupSchedules.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listDatabaseRolesStream(request); + const stream = client.listBackupSchedulesStream(request); const promise = new Promise((resolve, reject) => { - const responses: protos.google.spanner.admin.database.v1.DatabaseRole[] = + const responses: protos.google.spanner.admin.database.v1.BackupSchedule[] = []; stream.on( 'data', - (response: protos.google.spanner.admin.database.v1.DatabaseRole) => { + ( + response: protos.google.spanner.admin.database.v1.BackupSchedule + ) => { responses.push(response); } ); @@ -4117,12 +4978,12 @@ describe('v1.DatabaseAdminClient', () => { const responses = await promise; assert.deepStrictEqual(responses, expectedResponse); assert( - (client.descriptors.page.listDatabaseRoles.createStream as SinonStub) + (client.descriptors.page.listBackupSchedules.createStream as SinonStub) .getCall(0) - .calledWith(client.innerApiCalls.listDatabaseRoles, request) + .calledWith(client.innerApiCalls.listBackupSchedules, request) ); assert( - (client.descriptors.page.listDatabaseRoles.createStream as SinonStub) + (client.descriptors.page.listBackupSchedules.createStream as SinonStub) .getCall(0) .args[2].otherArgs.headers[ 'x-goog-request-params' @@ -4130,31 +4991,33 @@ describe('v1.DatabaseAdminClient', () => { ); }); - it('invokes listDatabaseRolesStream with error', async () => { + it('invokes listBackupSchedulesStream with error', async () => { const client = new databaseadminModule.v1.DatabaseAdminClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.spanner.admin.database.v1.ListDatabaseRolesRequest() + new protos.google.spanner.admin.database.v1.ListBackupSchedulesRequest() ); const defaultValue1 = getTypeDefaultValue( - '.google.spanner.admin.database.v1.ListDatabaseRolesRequest', + '.google.spanner.admin.database.v1.ListBackupSchedulesRequest', ['parent'] ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); - client.descriptors.page.listDatabaseRoles.createStream = + client.descriptors.page.listBackupSchedules.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listDatabaseRolesStream(request); + const stream = client.listBackupSchedulesStream(request); const promise = new Promise((resolve, reject) => { - const responses: protos.google.spanner.admin.database.v1.DatabaseRole[] = + const responses: protos.google.spanner.admin.database.v1.BackupSchedule[] = []; stream.on( 'data', - (response: protos.google.spanner.admin.database.v1.DatabaseRole) => { + ( + response: protos.google.spanner.admin.database.v1.BackupSchedule + ) => { responses.push(response); } ); @@ -4167,12 +5030,12 @@ describe('v1.DatabaseAdminClient', () => { }); await assert.rejects(promise, expectedError); assert( - (client.descriptors.page.listDatabaseRoles.createStream as SinonStub) + (client.descriptors.page.listBackupSchedules.createStream as SinonStub) .getCall(0) - .calledWith(client.innerApiCalls.listDatabaseRoles, request) + .calledWith(client.innerApiCalls.listBackupSchedules, request) ); assert( - (client.descriptors.page.listDatabaseRoles.createStream as SinonStub) + (client.descriptors.page.listBackupSchedules.createStream as SinonStub) .getCall(0) .args[2].otherArgs.headers[ 'x-goog-request-params' @@ -4180,49 +5043,49 @@ describe('v1.DatabaseAdminClient', () => { ); }); - it('uses async iteration with listDatabaseRoles without error', async () => { + it('uses async iteration with listBackupSchedules without error', async () => { const client = new databaseadminModule.v1.DatabaseAdminClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.spanner.admin.database.v1.ListDatabaseRolesRequest() + new protos.google.spanner.admin.database.v1.ListBackupSchedulesRequest() ); const defaultValue1 = getTypeDefaultValue( - '.google.spanner.admin.database.v1.ListDatabaseRolesRequest', + '.google.spanner.admin.database.v1.ListBackupSchedulesRequest', ['parent'] ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( - new protos.google.spanner.admin.database.v1.DatabaseRole() + new protos.google.spanner.admin.database.v1.BackupSchedule() ), generateSampleMessage( - new protos.google.spanner.admin.database.v1.DatabaseRole() + new protos.google.spanner.admin.database.v1.BackupSchedule() ), generateSampleMessage( - new protos.google.spanner.admin.database.v1.DatabaseRole() + new protos.google.spanner.admin.database.v1.BackupSchedule() ), ]; - client.descriptors.page.listDatabaseRoles.asyncIterate = + client.descriptors.page.listBackupSchedules.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.spanner.admin.database.v1.IDatabaseRole[] = + const responses: protos.google.spanner.admin.database.v1.IBackupSchedule[] = []; - const iterable = client.listDatabaseRolesAsync(request); + const iterable = client.listBackupSchedulesAsync(request); for await (const resource of iterable) { responses.push(resource!); } assert.deepStrictEqual(responses, expectedResponse); assert.deepStrictEqual( ( - client.descriptors.page.listDatabaseRoles.asyncIterate as SinonStub + client.descriptors.page.listBackupSchedules.asyncIterate as SinonStub ).getCall(0).args[1], request ); assert( - (client.descriptors.page.listDatabaseRoles.asyncIterate as SinonStub) + (client.descriptors.page.listBackupSchedules.asyncIterate as SinonStub) .getCall(0) .args[2].otherArgs.headers[ 'x-goog-request-params' @@ -4230,27 +5093,27 @@ describe('v1.DatabaseAdminClient', () => { ); }); - it('uses async iteration with listDatabaseRoles with error', async () => { + it('uses async iteration with listBackupSchedules with error', async () => { const client = new databaseadminModule.v1.DatabaseAdminClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.spanner.admin.database.v1.ListDatabaseRolesRequest() + new protos.google.spanner.admin.database.v1.ListBackupSchedulesRequest() ); const defaultValue1 = getTypeDefaultValue( - '.google.spanner.admin.database.v1.ListDatabaseRolesRequest', + '.google.spanner.admin.database.v1.ListBackupSchedulesRequest', ['parent'] ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); - client.descriptors.page.listDatabaseRoles.asyncIterate = + client.descriptors.page.listBackupSchedules.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listDatabaseRolesAsync(request); + const iterable = client.listBackupSchedulesAsync(request); await assert.rejects(async () => { - const responses: protos.google.spanner.admin.database.v1.IDatabaseRole[] = + const responses: protos.google.spanner.admin.database.v1.IBackupSchedule[] = []; for await (const resource of iterable) { responses.push(resource!); @@ -4258,12 +5121,12 @@ describe('v1.DatabaseAdminClient', () => { }); assert.deepStrictEqual( ( - client.descriptors.page.listDatabaseRoles.asyncIterate as SinonStub + client.descriptors.page.listBackupSchedules.asyncIterate as SinonStub ).getCall(0).args[1], request ); assert( - (client.descriptors.page.listDatabaseRoles.asyncIterate as SinonStub) + (client.descriptors.page.listBackupSchedules.asyncIterate as SinonStub) .getCall(0) .args[2].otherArgs.headers[ 'x-goog-request-params' @@ -4642,6 +5505,82 @@ describe('v1.DatabaseAdminClient', () => { }); }); + describe('backupSchedule', () => { + const fakePath = '/rendered/path/backupSchedule'; + const expectedParameters = { + project: 'projectValue', + instance: 'instanceValue', + database: 'databaseValue', + schedule: 'scheduleValue', + }; + const client = new databaseadminModule.v1.DatabaseAdminClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.backupSchedulePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.backupSchedulePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('backupSchedulePath', () => { + const result = client.backupSchedulePath( + 'projectValue', + 'instanceValue', + 'databaseValue', + 'scheduleValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.backupSchedulePathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromBackupScheduleName', () => { + const result = client.matchProjectFromBackupScheduleName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.backupSchedulePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchInstanceFromBackupScheduleName', () => { + const result = client.matchInstanceFromBackupScheduleName(fakePath); + assert.strictEqual(result, 'instanceValue'); + assert( + (client.pathTemplates.backupSchedulePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchDatabaseFromBackupScheduleName', () => { + const result = client.matchDatabaseFromBackupScheduleName(fakePath); + assert.strictEqual(result, 'databaseValue'); + assert( + (client.pathTemplates.backupSchedulePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchScheduleFromBackupScheduleName', () => { + const result = client.matchScheduleFromBackupScheduleName(fakePath); + assert.strictEqual(result, 'scheduleValue'); + assert( + (client.pathTemplates.backupSchedulePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + describe('cryptoKey', () => { const fakePath = '/rendered/path/cryptoKey'; const expectedParameters = { diff --git a/test/gapic_spanner_executor_proxy_v1.ts b/test/gapic_spanner_executor_proxy_v1.ts index 8d37af969..b2ad57cf1 100644 --- a/test/gapic_spanner_executor_proxy_v1.ts +++ b/test/gapic_spanner_executor_proxy_v1.ts @@ -424,6 +424,83 @@ describe('v1.SpannerExecutorProxyClient', () => { }); }); + describe('backupSchedule', () => { + const fakePath = '/rendered/path/backupSchedule'; + const expectedParameters = { + project: 'projectValue', + instance: 'instanceValue', + database: 'databaseValue', + schedule: 'scheduleValue', + }; + const client = + new spannerexecutorproxyModule.v1.SpannerExecutorProxyClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.backupSchedulePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.backupSchedulePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('backupSchedulePath', () => { + const result = client.backupSchedulePath( + 'projectValue', + 'instanceValue', + 'databaseValue', + 'scheduleValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.backupSchedulePathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromBackupScheduleName', () => { + const result = client.matchProjectFromBackupScheduleName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.backupSchedulePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchInstanceFromBackupScheduleName', () => { + const result = client.matchInstanceFromBackupScheduleName(fakePath); + assert.strictEqual(result, 'instanceValue'); + assert( + (client.pathTemplates.backupSchedulePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchDatabaseFromBackupScheduleName', () => { + const result = client.matchDatabaseFromBackupScheduleName(fakePath); + assert.strictEqual(result, 'databaseValue'); + assert( + (client.pathTemplates.backupSchedulePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchScheduleFromBackupScheduleName', () => { + const result = client.matchScheduleFromBackupScheduleName(fakePath); + assert.strictEqual(result, 'scheduleValue'); + assert( + (client.pathTemplates.backupSchedulePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + describe('database', () => { const fakePath = '/rendered/path/database'; const expectedParameters = { diff --git a/test/gapic_spanner_v1.ts b/test/gapic_spanner_v1.ts index 7f74df7ad..b98138a1a 100644 --- a/test/gapic_spanner_v1.ts +++ b/test/gapic_spanner_v1.ts @@ -1917,6 +1917,49 @@ describe('v1.SpannerClient', () => { assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); + it('invokes executeStreamingSql without error and gaxServerStreamingRetries enabled', async () => { + const client = new spannerModule.v1.SpannerClient({ + gaxServerStreamingRetries: true, + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.spanner.v1.ExecuteSqlRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.spanner.v1.ExecuteSqlRequest', + ['session'] + ); + request.session = defaultValue1; + const expectedHeaderRequestParams = `session=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.spanner.v1.PartialResultSet() + ); + client.innerApiCalls.executeStreamingSql = + stubServerStreamingCall(expectedResponse); + const stream = client.executeStreamingSql(request); + const promise = new Promise((resolve, reject) => { + stream.on( + 'data', + (response: protos.google.spanner.v1.PartialResultSet) => { + resolve(response); + } + ); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.executeStreamingSql as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.executeStreamingSql as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + it('invokes executeStreamingSql with error', async () => { const client = new spannerModule.v1.SpannerClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, @@ -1992,6 +2035,12 @@ describe('v1.SpannerClient', () => { }); await assert.rejects(promise, expectedError); }); + it('should create a client with gaxServerStreamingRetries enabled', () => { + const client = new spannerModule.v1.SpannerClient({ + gaxServerStreamingRetries: true, + }); + assert(client); + }); }); describe('streamingRead', () => { @@ -2039,6 +2088,49 @@ describe('v1.SpannerClient', () => { assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); + it('invokes streamingRead without error and gaxServerStreamingRetries enabled', async () => { + const client = new spannerModule.v1.SpannerClient({ + gaxServerStreamingRetries: true, + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.spanner.v1.ReadRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.spanner.v1.ReadRequest', + ['session'] + ); + request.session = defaultValue1; + const expectedHeaderRequestParams = `session=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.spanner.v1.PartialResultSet() + ); + client.innerApiCalls.streamingRead = + stubServerStreamingCall(expectedResponse); + const stream = client.streamingRead(request); + const promise = new Promise((resolve, reject) => { + stream.on( + 'data', + (response: protos.google.spanner.v1.PartialResultSet) => { + resolve(response); + } + ); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.streamingRead as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.streamingRead as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + it('invokes streamingRead with error', async () => { const client = new spannerModule.v1.SpannerClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, @@ -2114,6 +2206,12 @@ describe('v1.SpannerClient', () => { }); await assert.rejects(promise, expectedError); }); + it('should create a client with gaxServerStreamingRetries enabled', () => { + const client = new spannerModule.v1.SpannerClient({ + gaxServerStreamingRetries: true, + }); + assert(client); + }); }); describe('batchWrite', () => { @@ -2161,6 +2259,49 @@ describe('v1.SpannerClient', () => { assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); + it('invokes batchWrite without error and gaxServerStreamingRetries enabled', async () => { + const client = new spannerModule.v1.SpannerClient({ + gaxServerStreamingRetries: true, + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.spanner.v1.BatchWriteRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.spanner.v1.BatchWriteRequest', + ['session'] + ); + request.session = defaultValue1; + const expectedHeaderRequestParams = `session=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.spanner.v1.BatchWriteResponse() + ); + client.innerApiCalls.batchWrite = + stubServerStreamingCall(expectedResponse); + const stream = client.batchWrite(request); + const promise = new Promise((resolve, reject) => { + stream.on( + 'data', + (response: protos.google.spanner.v1.BatchWriteResponse) => { + resolve(response); + } + ); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.batchWrite as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchWrite as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + it('invokes batchWrite with error', async () => { const client = new spannerModule.v1.SpannerClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, @@ -2236,6 +2377,12 @@ describe('v1.SpannerClient', () => { }); await assert.rejects(promise, expectedError); }); + it('should create a client with gaxServerStreamingRetries enabled', () => { + const client = new spannerModule.v1.SpannerClient({ + gaxServerStreamingRetries: true, + }); + assert(client); + }); }); describe('listSessions', () => {