diff --git a/protos/google/spanner/admin/instance/v1/spanner_instance_admin.proto b/protos/google/spanner/admin/instance/v1/spanner_instance_admin.proto index 0e6bf63fe..3bde51d99 100644 --- a/protos/google/spanner/admin/instance/v1/spanner_instance_admin.proto +++ b/protos/google/spanner/admin/instance/v1/spanner_instance_admin.proto @@ -1,4 +1,4 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -179,7 +179,7 @@ service InstanceAdmin { // [Instance][google.spanner.admin.instance.v1.Instance], if successful. // // Authorization requires `spanner.instances.update` permission on - // resource [name][google.spanner.admin.instance.v1.Instance.name]. + // the resource [name][google.spanner.admin.instance.v1.Instance.name]. rpc UpdateInstance(UpdateInstanceRequest) returns (google.longrunning.Operation) { option (google.api.http) = { patch: "/v1/{instance.name=projects/*/instances/*}" @@ -309,7 +309,7 @@ message InstanceConfig { // A unique identifier for the instance configuration. Values // are of the form - // `projects//instanceConfigs/[a-z][-a-z0-9]*` + // `projects//instanceConfigs/[a-z][-a-z0-9]*`. string name = 1; // The name of this instance configuration as it appears in UIs. @@ -319,7 +319,7 @@ message InstanceConfig { // replication properties. repeated ReplicaInfo replicas = 3; - // Allowed values of the “default_leader” schema option for databases in + // Allowed values of the "default_leader" schema option for databases in // instances that use this instance configuration. repeated string leader_options = 4; } @@ -367,17 +367,23 @@ message Instance { // Must be unique per project and between 4 and 30 characters in length. string display_name = 3 [(google.api.field_behavior) = REQUIRED]; - // Required. The number of nodes allocated to this instance. This may be zero - // in API responses for instances that are not yet in state `READY`. + // The number of nodes allocated to this instance. At most one of either + // node_count or processing_units should be present in the message. This + // may be zero in API responses for instances that are not yet in state + // `READY`. // // See [the - // documentation](https://cloud.google.com/spanner/docs/instances#node_count) - // for more information about nodes. + // documentation](https://cloud.google.com/spanner/docs/compute-capacity) + // for more information about nodes and processing units. int32 node_count = 5; // The number of processing units allocated to this instance. At most one of // processing_units or node_count should be present in the message. This may // be zero in API responses for instances that are not yet in state `READY`. + // + // See [the + // documentation](https://cloud.google.com/spanner/docs/compute-capacity) + // for more information about nodes and processing units. int32 processing_units = 9; // Output only. The current instance state. For @@ -395,9 +401,9 @@ message Instance { // firewall, load balancing, etc.). // // * Label keys must be between 1 and 63 characters long and must conform to - // the following regular expression: `[a-z]([-a-z0-9]*[a-z0-9])?`. + // the following regular expression: `[a-z][a-z0-9_-]{0,62}`. // * Label values must be between 0 and 63 characters long and must conform - // to the regular expression `([a-z]([-a-z0-9]*[a-z0-9])?)?`. + // to the regular expression `[a-z0-9_-]{0,63}`. // * No more than 64 labels can be associated with a given resource. // // See https://goo.gl/xmQnxf for more information on and examples of labels. @@ -412,6 +418,12 @@ message Instance { // Deprecated. This field is not populated. repeated string endpoint_uris = 8; + + // Output only. The time at which the instance was created. + google.protobuf.Timestamp create_time = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time at which the instance was most recently updated. + google.protobuf.Timestamp update_time = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; } // The request for [ListInstanceConfigs][google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigs]. diff --git a/protos/google/spanner/v1/commit_response.proto b/protos/google/spanner/v1/commit_response.proto index d43a83a32..69e073092 100644 --- a/protos/google/spanner/v1/commit_response.proto +++ b/protos/google/spanner/v1/commit_response.proto @@ -1,4 +1,4 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/protos/google/spanner/v1/keys.proto b/protos/google/spanner/v1/keys.proto index 12495a616..df3607aa4 100644 --- a/protos/google/spanner/v1/keys.proto +++ b/protos/google/spanner/v1/keys.proto @@ -1,4 +1,4 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/protos/google/spanner/v1/mutation.proto b/protos/google/spanner/v1/mutation.proto index ef7e75f8d..eae0af72d 100644 --- a/protos/google/spanner/v1/mutation.proto +++ b/protos/google/spanner/v1/mutation.proto @@ -1,4 +1,4 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/protos/google/spanner/v1/query_plan.proto b/protos/google/spanner/v1/query_plan.proto index f700014e2..9ea40fe4a 100644 --- a/protos/google/spanner/v1/query_plan.proto +++ b/protos/google/spanner/v1/query_plan.proto @@ -1,4 +1,4 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/protos/google/spanner/v1/result_set.proto b/protos/google/spanner/v1/result_set.proto index 89dfa2346..714d8bea9 100644 --- a/protos/google/spanner/v1/result_set.proto +++ b/protos/google/spanner/v1/result_set.proto @@ -1,4 +1,4 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -17,7 +17,6 @@ syntax = "proto3"; package google.spanner.v1; import "google/protobuf/struct.proto"; -import "google/spanner/v1/commit_response.proto"; import "google/spanner/v1/query_plan.proto"; import "google/spanner/v1/transaction.proto"; import "google/spanner/v1/type.proto"; diff --git a/protos/google/spanner/v1/spanner.proto b/protos/google/spanner/v1/spanner.proto index 41e2ad83f..ef772170b 100644 --- a/protos/google/spanner/v1/spanner.proto +++ b/protos/google/spanner/v1/spanner.proto @@ -1,4 +1,4 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -358,6 +358,9 @@ message Session { // Output only. The approximate timestamp when the session is last used. It is // typically earlier than the actual last use time. google.protobuf.Timestamp approximate_last_use_time = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The database role which created this session. + string creator_role = 5; } // The request for [GetSession][google.spanner.v1.Spanner.GetSession]. diff --git a/protos/google/spanner/v1/transaction.proto b/protos/google/spanner/v1/transaction.proto index 1e4c655ee..3577f797c 100644 --- a/protos/google/spanner/v1/transaction.proto +++ b/protos/google/spanner/v1/transaction.proto @@ -1,4 +1,4 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -35,7 +35,8 @@ option ruby_package = "Google::Cloud::Spanner::V1"; // completed, the session can immediately be re-used for the next transaction. // It is not necessary to create a new session for each transaction. // -// Transaction Modes: +// Transaction modes: +// // Cloud Spanner supports three transaction modes: // // 1. Locking read-write. This type of transaction is the only way @@ -44,11 +45,18 @@ option ruby_package = "Google::Cloud::Spanner::V1"; // Locking read-write transactions may abort, requiring the // application to retry. // -// 2. Snapshot read-only. This transaction type provides guaranteed -// consistency across several reads, but does not allow -// writes. Snapshot read-only transactions can be configured to -// read at timestamps in the past. Snapshot read-only -// transactions do not need to be committed. +// 2. Snapshot read-only. Snapshot read-only transactions provide guaranteed +// consistency across several reads, but do not allow +// writes. Snapshot read-only transactions can be configured to read at +// timestamps in the past, or configured to perform a strong read +// (where Spanner will select a timestamp such that the read is +// guaranteed to see the effects of all transactions that have committed +// before the start of the read). Snapshot read-only transactions do not +// need to be committed. +// +// Queries on change streams must be performed with the snapshot read-only +// transaction mode, specifying a strong read. Please see +// [TransactionOptions.ReadOnly.strong][google.spanner.v1.TransactionOptions.ReadOnly.strong] for more details. // // 3. Partitioned DML. This type of transaction is used to execute // a single Partitioned DML statement. Partitioned DML partitions @@ -63,11 +71,12 @@ option ruby_package = "Google::Cloud::Spanner::V1"; // not conflict with read-write transactions. As a consequence of not // taking locks, they also do not abort, so retry loops are not needed. // -// Transactions may only read/write data in a single database. They -// may, however, read/write data in different tables within that +// Transactions may only read-write data in a single database. They +// may, however, read-write data in different tables within that // database. // -// Locking Read-Write Transactions: +// Locking read-write transactions: +// // Locking transactions may be used to atomically read-modify-write // data anywhere in a database. This type of transaction is externally // consistent. @@ -78,7 +87,7 @@ option ruby_package = "Google::Cloud::Spanner::V1"; // active as long as the transaction continues to do reads, and the // transaction has not been terminated by // [Commit][google.spanner.v1.Spanner.Commit] or -// [Rollback][google.spanner.v1.Spanner.Rollback]. Long periods of +// [Rollback][google.spanner.v1.Spanner.Rollback]. Long periods of // inactivity at the client may cause Cloud Spanner to release a // transaction's locks and abort it. // @@ -90,6 +99,7 @@ option ruby_package = "Google::Cloud::Spanner::V1"; // transaction. // // Semantics: +// // Cloud Spanner can commit the transaction if all read locks it acquired // are still valid at commit time, and it is able to acquire write // locks for all writes. Cloud Spanner can abort the transaction for any @@ -101,7 +111,8 @@ option ruby_package = "Google::Cloud::Spanner::V1"; // use Cloud Spanner locks for any sort of mutual exclusion other than // between Cloud Spanner transactions themselves. // -// Retrying Aborted Transactions: +// Retrying aborted transactions: +// // When a transaction aborts, the application can choose to retry the // whole transaction again. To maximize the chances of successfully // committing the retry, the client should execute the retry in the @@ -116,7 +127,8 @@ option ruby_package = "Google::Cloud::Spanner::V1"; // instead, it is better to limit the total amount of time spent // retrying. // -// Idle Transactions: +// Idle transactions: +// // A transaction is considered idle if it has no outstanding reads or // SQL queries and has not started a read or SQL query within the last 10 // seconds. Idle transactions can be aborted by Cloud Spanner so that they @@ -127,7 +139,8 @@ option ruby_package = "Google::Cloud::Spanner::V1"; // SQL query in the transaction (for example, `SELECT 1`) prevents the // transaction from becoming idle. // -// Snapshot Read-Only Transactions: +// Snapshot read-only transactions: +// // Snapshot read-only transactions provides a simpler method than // locking read-write transactions for doing several consistent // reads. However, this type of transaction does not support writes. @@ -159,13 +172,12 @@ option ruby_package = "Google::Cloud::Spanner::V1"; // // If the Cloud Spanner database to be read is geographically distributed, // stale read-only transactions can execute more quickly than strong -// or read-write transaction, because they are able to execute far +// or read-write transactions, because they are able to execute far // from the leader replica. // // Each type of timestamp bound is discussed in detail below. // -// Strong: -// Strong reads are guaranteed to see the effects of all transactions +// Strong: Strong reads are guaranteed to see the effects of all transactions // that have committed before the start of the read. Furthermore, all // rows yielded by a single read are consistent with each other -- if // any part of the read observes a transaction, all parts of the read @@ -177,9 +189,13 @@ option ruby_package = "Google::Cloud::Spanner::V1"; // reads should be executed within a transaction or at an exact read // timestamp. // +// Queries on change streams (see below for more details) must also specify +// the strong read timestamp bound. +// // See [TransactionOptions.ReadOnly.strong][google.spanner.v1.TransactionOptions.ReadOnly.strong]. // -// Exact Staleness: +// Exact staleness: +// // These timestamp bounds execute reads at a user-specified // timestamp. Reads at a timestamp are guaranteed to see a consistent // prefix of the global transaction history: they observe @@ -200,7 +216,8 @@ option ruby_package = "Google::Cloud::Spanner::V1"; // See [TransactionOptions.ReadOnly.read_timestamp][google.spanner.v1.TransactionOptions.ReadOnly.read_timestamp] and // [TransactionOptions.ReadOnly.exact_staleness][google.spanner.v1.TransactionOptions.ReadOnly.exact_staleness]. // -// Bounded Staleness: +// Bounded staleness: +// // Bounded staleness modes allow Cloud Spanner to pick the read timestamp, // subject to a user-provided staleness bound. Cloud Spanner chooses the // newest timestamp within the staleness bound that allows execution @@ -229,7 +246,8 @@ option ruby_package = "Google::Cloud::Spanner::V1"; // See [TransactionOptions.ReadOnly.max_staleness][google.spanner.v1.TransactionOptions.ReadOnly.max_staleness] and // [TransactionOptions.ReadOnly.min_read_timestamp][google.spanner.v1.TransactionOptions.ReadOnly.min_read_timestamp]. // -// Old Read Timestamps and Garbage Collection: +// Old read timestamps and garbage collection: +// // Cloud Spanner continuously garbage collects deleted and overwritten data // in the background to reclaim storage space. This process is known // as "version GC". By default, version GC reclaims versions after they @@ -239,7 +257,41 @@ option ruby_package = "Google::Cloud::Spanner::V1"; // timestamp become too old while executing. Reads and SQL queries with // too-old read timestamps fail with the error `FAILED_PRECONDITION`. // -// Partitioned DML Transactions: +// You can configure and extend the `VERSION_RETENTION_PERIOD` of a +// database up to a period as long as one week, which allows Cloud Spanner +// to perform reads up to one week in the past. +// +// Querying change Streams: +// +// A Change Stream is a schema object that can be configured to watch data +// changes on the entire database, a set of tables, or a set of columns +// in a database. +// +// When a change stream is created, Spanner automatically defines a +// corresponding SQL Table-Valued Function (TVF) that can be used to query +// the change records in the associated change stream using the +// ExecuteStreamingSql API. The name of the TVF for a change stream is +// generated from the name of the change stream: READ_. +// +// All queries on change stream TVFs must be executed using the +// ExecuteStreamingSql API with a single-use read-only transaction with a +// strong read-only timestamp_bound. The change stream TVF allows users to +// specify the start_timestamp and end_timestamp for the time range of +// interest. All change records within the retention period is accessible +// using the strong read-only timestamp_bound. All other TransactionOptions +// are invalid for change stream queries. +// +// In addition, if TransactionOptions.read_only.return_read_timestamp is set +// to true, a special value of 2^63 - 2 will be returned in the +// [Transaction][google.spanner.v1.Transaction] message that describes the +// transaction, instead of a valid read timestamp. This special value should be +// discarded and not used for any subsequent queries. +// +// Please see https://cloud.google.com/spanner/docs/change-streams +// for more details on how to query the change stream TVFs. +// +// Partitioned DML transactions: +// // Partitioned DML transactions are used to execute DML statements with a // different execution strategy that provides different, and often better, // scalability properties for large, table-wide operations than DML in a diff --git a/protos/google/spanner/v1/type.proto b/protos/google/spanner/v1/type.proto index 3d28c3313..126e4a0c2 100644 --- a/protos/google/spanner/v1/type.proto +++ b/protos/google/spanner/v1/type.proto @@ -1,4 +1,4 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/protos/protos.d.ts b/protos/protos.d.ts index d5e378e35..6741347a2 100644 --- a/protos/protos.d.ts +++ b/protos/protos.d.ts @@ -10079,6 +10079,12 @@ export namespace google { /** Instance endpointUris */ endpointUris?: (string[]|null); + + /** Instance createTime */ + createTime?: (google.protobuf.ITimestamp|null); + + /** Instance updateTime */ + updateTime?: (google.protobuf.ITimestamp|null); } /** Represents an Instance. */ @@ -10114,6 +10120,12 @@ export namespace google { /** Instance endpointUris. */ public endpointUris: string[]; + /** Instance createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); + + /** Instance updateTime. */ + public updateTime?: (google.protobuf.ITimestamp|null); + /** * Creates a new Instance instance using the specified properties. * @param [properties] Properties to set @@ -14423,6 +14435,9 @@ export namespace google { /** Session approximateLastUseTime */ approximateLastUseTime?: (google.protobuf.ITimestamp|null); + + /** Session creatorRole */ + creatorRole?: (string|null); } /** Represents a Session. */ @@ -14446,6 +14461,9 @@ export namespace google { /** Session approximateLastUseTime. */ public approximateLastUseTime?: (google.protobuf.ITimestamp|null); + /** Session creatorRole. */ + public creatorRole: string; + /** * Creates a new Session instance using the specified properties. * @param [properties] Properties to set diff --git a/protos/protos.js b/protos/protos.js index 747111dcd..b65c0f521 100644 --- a/protos/protos.js +++ b/protos/protos.js @@ -24878,6 +24878,8 @@ * @property {google.spanner.admin.instance.v1.Instance.State|null} [state] Instance state * @property {Object.|null} [labels] Instance labels * @property {Array.|null} [endpointUris] Instance endpointUris + * @property {google.protobuf.ITimestamp|null} [createTime] Instance createTime + * @property {google.protobuf.ITimestamp|null} [updateTime] Instance updateTime */ /** @@ -24961,6 +24963,22 @@ */ Instance.prototype.endpointUris = $util.emptyArray; + /** + * Instance createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.spanner.admin.instance.v1.Instance + * @instance + */ + Instance.prototype.createTime = null; + + /** + * Instance updateTime. + * @member {google.protobuf.ITimestamp|null|undefined} updateTime + * @memberof google.spanner.admin.instance.v1.Instance + * @instance + */ + Instance.prototype.updateTime = null; + /** * Creates a new Instance instance using the specified properties. * @function create @@ -25003,6 +25021,10 @@ writer.uint32(/* id 8, wireType 2 =*/66).string(message.endpointUris[i]); if (message.processingUnits != null && Object.hasOwnProperty.call(message, "processingUnits")) writer.uint32(/* id 9, wireType 0 =*/72).int32(message.processingUnits); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); + if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) + $root.google.protobuf.Timestamp.encode(message.updateTime, writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); return writer; }; @@ -25082,6 +25104,12 @@ message.endpointUris = []; message.endpointUris.push(reader.string()); break; + case 11: + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 12: + message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; default: reader.skipType(tag & 7); break; @@ -25156,6 +25184,16 @@ if (!$util.isString(message.endpointUris[i])) return "endpointUris: string[] expected"; } + if (message.createTime != null && message.hasOwnProperty("createTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.createTime); + if (error) + return "createTime." + error; + } + if (message.updateTime != null && message.hasOwnProperty("updateTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.updateTime); + if (error) + return "updateTime." + error; + } return null; }; @@ -25209,6 +25247,16 @@ for (var i = 0; i < object.endpointUris.length; ++i) message.endpointUris[i] = String(object.endpointUris[i]); } + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.spanner.admin.instance.v1.Instance.createTime: object expected"); + message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); + } + if (object.updateTime != null) { + if (typeof object.updateTime !== "object") + throw TypeError(".google.spanner.admin.instance.v1.Instance.updateTime: object expected"); + message.updateTime = $root.google.protobuf.Timestamp.fromObject(object.updateTime); + } return message; }; @@ -25236,6 +25284,8 @@ object.nodeCount = 0; object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; object.processingUnits = 0; + object.createTime = null; + object.updateTime = null; } if (message.name != null && message.hasOwnProperty("name")) object.name = message.name; @@ -25260,6 +25310,10 @@ } if (message.processingUnits != null && message.hasOwnProperty("processingUnits")) object.processingUnits = message.processingUnits; + if (message.createTime != null && message.hasOwnProperty("createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); + if (message.updateTime != null && message.hasOwnProperty("updateTime")) + object.updateTime = $root.google.protobuf.Timestamp.toObject(message.updateTime, options); return object; }; @@ -35363,6 +35417,7 @@ * @property {Object.|null} [labels] Session labels * @property {google.protobuf.ITimestamp|null} [createTime] Session createTime * @property {google.protobuf.ITimestamp|null} [approximateLastUseTime] Session approximateLastUseTime + * @property {string|null} [creatorRole] Session creatorRole */ /** @@ -35413,6 +35468,14 @@ */ Session.prototype.approximateLastUseTime = null; + /** + * Session creatorRole. + * @member {string} creatorRole + * @memberof google.spanner.v1.Session + * @instance + */ + Session.prototype.creatorRole = ""; + /** * Creates a new Session instance using the specified properties. * @function create @@ -35446,6 +35509,8 @@ $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); if (message.approximateLastUseTime != null && Object.hasOwnProperty.call(message, "approximateLastUseTime")) $root.google.protobuf.Timestamp.encode(message.approximateLastUseTime, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.creatorRole != null && Object.hasOwnProperty.call(message, "creatorRole")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.creatorRole); return writer; }; @@ -35511,6 +35576,9 @@ case 4: message.approximateLastUseTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); break; + case 5: + message.creatorRole = reader.string(); + break; default: reader.skipType(tag & 7); break; @@ -35567,6 +35635,9 @@ if (error) return "approximateLastUseTime." + error; } + if (message.creatorRole != null && message.hasOwnProperty("creatorRole")) + if (!$util.isString(message.creatorRole)) + return "creatorRole: string expected"; return null; }; @@ -35601,6 +35672,8 @@ throw TypeError(".google.spanner.v1.Session.approximateLastUseTime: object expected"); message.approximateLastUseTime = $root.google.protobuf.Timestamp.fromObject(object.approximateLastUseTime); } + if (object.creatorRole != null) + message.creatorRole = String(object.creatorRole); return message; }; @@ -35623,6 +35696,7 @@ object.name = ""; object.createTime = null; object.approximateLastUseTime = null; + object.creatorRole = ""; } if (message.name != null && message.hasOwnProperty("name")) object.name = message.name; @@ -35636,6 +35710,8 @@ object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); if (message.approximateLastUseTime != null && message.hasOwnProperty("approximateLastUseTime")) object.approximateLastUseTime = $root.google.protobuf.Timestamp.toObject(message.approximateLastUseTime, options); + if (message.creatorRole != null && message.hasOwnProperty("creatorRole")) + object.creatorRole = message.creatorRole; return object; }; diff --git a/protos/protos.json b/protos/protos.json index c99587a9a..6f7657d9d 100644 --- a/protos/protos.json +++ b/protos/protos.json @@ -2942,6 +2942,20 @@ "rule": "repeated", "type": "string", "id": 8 + }, + "createTime": { + "type": "google.protobuf.Timestamp", + "id": 11, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "updateTime": { + "type": "google.protobuf.Timestamp", + "id": 12, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } } }, "nested": { @@ -4018,6 +4032,10 @@ "options": { "(google.api.field_behavior)": "OUTPUT_ONLY" } + }, + "creatorRole": { + "type": "string", + "id": 5 } } }, diff --git a/src/v1/database_admin_client.ts b/src/v1/database_admin_client.ts index 4aac08ab3..aa5127cab 100644 --- a/src/v1/database_admin_client.ts +++ b/src/v1/database_admin_client.ts @@ -23,6 +23,7 @@ import { CallOptions, Descriptors, ClientOptions, + GrpcClientOptions, LROperation, PaginationCallback, GaxCall, @@ -78,7 +79,7 @@ export class DatabaseAdminClient { * * @param {object} [options] - The configuration object. * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). * The common options are: * @param {object} [options.credentials] - Credentials object. * @param {string} [options.credentials.client_email] @@ -101,11 +102,10 @@ export class DatabaseAdminClient { * API remote host. * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP fallback mode. - * In fallback mode, a special browser-compatible transport implementation is used - * instead of gRPC transport. In browser context (if the `window` object is defined) - * the fallback mode is enabled automatically; set `options.fallback` to `false` - * if you need to override this behavior. + * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. */ constructor(opts?: ClientOptions) { // Ensure that options include all the required fields. @@ -213,16 +213,48 @@ export class DatabaseAdminClient { }; const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); - // This API contains "long-running operations", which return a // an Operation object that allows for tracking of the operation, // rather than holding a request open. - + const lroOptions: GrpcClientOptions = { + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, + }; + if (opts.fallback === 'rest') { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [ + { + selector: 'google.longrunning.Operations.GetOperation', + get: '/v1/{name=projects/*/instances/*/databases/*/operations/*}', + additional_bindings: [ + {get: '/v1/{name=projects/*/instances/*/operations/*}'}, + ], + }, + { + selector: 'google.longrunning.Operations.ListOperations', + get: '/v1/{name=projects/*/instances/*/databases/*/operations}', + additional_bindings: [ + {get: '/v1/{name=projects/*/instances/*/operations}'}, + ], + }, + { + selector: 'google.longrunning.Operations.CancelOperation', + post: '/v1/{name=projects/*/instances/*/databases/*/operations/*}:cancel', + additional_bindings: [ + {post: '/v1/{name=projects/*/instances/*/operations/*}:cancel'}, + ], + }, + { + selector: 'google.longrunning.Operations.DeleteOperation', + delete: '/v1/{name=projects/*/instances/*/databases/*/operations/*}', + additional_bindings: [ + {delete: '/v1/{name=projects/*/instances/*/operations/*}'}, + ], + }, + ]; + } this.operationsClient = this._gaxModule - .lro({ - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, - }) + .lro(lroOptions) .operationsClient(opts); const createDatabaseResponse = protoFilesRoot.lookup( '.google.spanner.admin.database.v1.Database' diff --git a/src/v1/instance_admin_client.ts b/src/v1/instance_admin_client.ts index 88ca8187d..c35456eb2 100644 --- a/src/v1/instance_admin_client.ts +++ b/src/v1/instance_admin_client.ts @@ -23,6 +23,7 @@ import { CallOptions, Descriptors, ClientOptions, + GrpcClientOptions, LROperation, PaginationCallback, GaxCall, @@ -92,7 +93,7 @@ export class InstanceAdminClient { * * @param {object} [options] - The configuration object. * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). * The common options are: * @param {object} [options.credentials] - Credentials object. * @param {string} [options.credentials.client_email] @@ -115,11 +116,10 @@ export class InstanceAdminClient { * API remote host. * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP fallback mode. - * In fallback mode, a special browser-compatible transport implementation is used - * instead of gRPC transport. In browser context (if the `window` object is defined) - * the fallback mode is enabled automatically; set `options.fallback` to `false` - * if you need to override this behavior. + * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. */ constructor(opts?: ClientOptions) { // Ensure that options include all the required fields. @@ -214,16 +214,48 @@ export class InstanceAdminClient { }; const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); - // This API contains "long-running operations", which return a // an Operation object that allows for tracking of the operation, // rather than holding a request open. - + const lroOptions: GrpcClientOptions = { + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, + }; + if (opts.fallback === 'rest') { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [ + { + selector: 'google.longrunning.Operations.GetOperation', + get: '/v1/{name=projects/*/instances/*/databases/*/operations/*}', + additional_bindings: [ + {get: '/v1/{name=projects/*/instances/*/operations/*}'}, + ], + }, + { + selector: 'google.longrunning.Operations.ListOperations', + get: '/v1/{name=projects/*/instances/*/databases/*/operations}', + additional_bindings: [ + {get: '/v1/{name=projects/*/instances/*/operations}'}, + ], + }, + { + selector: 'google.longrunning.Operations.CancelOperation', + post: '/v1/{name=projects/*/instances/*/databases/*/operations/*}:cancel', + additional_bindings: [ + {post: '/v1/{name=projects/*/instances/*/operations/*}:cancel'}, + ], + }, + { + selector: 'google.longrunning.Operations.DeleteOperation', + delete: '/v1/{name=projects/*/instances/*/databases/*/operations/*}', + additional_bindings: [ + {delete: '/v1/{name=projects/*/instances/*/operations/*}'}, + ], + }, + ]; + } this.operationsClient = this._gaxModule - .lro({ - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, - }) + .lro(lroOptions) .operationsClient(opts); const createInstanceResponse = protoFilesRoot.lookup( '.google.spanner.admin.instance.v1.Instance' @@ -1204,7 +1236,7 @@ export class InstanceAdminClient { * {@link google.spanner.admin.instance.v1.Instance|Instance}, if successful. * * Authorization requires `spanner.instances.update` permission on - * resource {@link google.spanner.admin.instance.v1.Instance.name|name}. + * the resource {@link google.spanner.admin.instance.v1.Instance.name|name}. * * @param {Object} request * The request object that will be sent. diff --git a/src/v1/spanner_client.ts b/src/v1/spanner_client.ts index a0389ee83..6a7c93112 100644 --- a/src/v1/spanner_client.ts +++ b/src/v1/spanner_client.ts @@ -75,7 +75,7 @@ export class SpannerClient { * * @param {object} [options] - The configuration object. * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). * The common options are: * @param {object} [options.credentials] - Credentials object. * @param {string} [options.credentials.client_email] @@ -98,11 +98,10 @@ export class SpannerClient { * API remote host. * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP fallback mode. - * In fallback mode, a special browser-compatible transport implementation is used - * instead of gRPC transport. In browser context (if the `window` object is defined) - * the fallback mode is enabled automatically; set `options.fallback` to `false` - * if you need to override this behavior. + * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. */ constructor(opts?: ClientOptions) { // Ensure that options include all the required fields.