diff --git a/packages/google-cloud-bigquery-storage/protos/google/cloud/bigquery/storage/v1/stream.proto b/packages/google-cloud-bigquery-storage/protos/google/cloud/bigquery/storage/v1/stream.proto index dc62e8c00ca..0b0bc1ad05b 100644 --- a/packages/google-cloud-bigquery-storage/protos/google/cloud/bigquery/storage/v1/stream.proto +++ b/packages/google-cloud-bigquery-storage/protos/google/cloud/bigquery/storage/v1/stream.proto @@ -171,6 +171,16 @@ message WriteStream { BUFFERED = 3; } + // Mode enum of the stream. + enum WriteMode { + // Unknown type. + WRITE_MODE_UNSPECIFIED = 0; + + // Insert new records into the table. + // It is the default value if customers do not specify it. + INSERT = 1; + } + // Output only. Name of the stream, in the form // `projects/{project}/datasets/{dataset}/tables/{table}/streams/{stream}`. string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; @@ -193,4 +203,7 @@ message WriteStream { // compatible with this schema to send in initial `AppendRowsRequest`. // The table schema could go out of date during the life time of the stream. TableSchema table_schema = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Immutable. Mode of the stream. + WriteMode write_mode = 7 [(google.api.field_behavior) = IMMUTABLE]; } diff --git a/packages/google-cloud-bigquery-storage/protos/protos.d.ts b/packages/google-cloud-bigquery-storage/protos/protos.d.ts index ba247175654..a113f0d4da9 100644 --- a/packages/google-cloud-bigquery-storage/protos/protos.d.ts +++ b/packages/google-cloud-bigquery-storage/protos/protos.d.ts @@ -3447,6 +3447,9 @@ export namespace google { /** WriteStream tableSchema */ tableSchema?: (google.cloud.bigquery.storage.v1.ITableSchema|null); + + /** WriteStream writeMode */ + writeMode?: (google.cloud.bigquery.storage.v1.WriteStream.WriteMode|keyof typeof google.cloud.bigquery.storage.v1.WriteStream.WriteMode|null); } /** Represents a WriteStream. */ @@ -3473,6 +3476,9 @@ export namespace google { /** WriteStream tableSchema. */ public tableSchema?: (google.cloud.bigquery.storage.v1.ITableSchema|null); + /** WriteStream writeMode. */ + public writeMode: (google.cloud.bigquery.storage.v1.WriteStream.WriteMode|keyof typeof google.cloud.bigquery.storage.v1.WriteStream.WriteMode); + /** * Creates a new WriteStream instance using the specified properties. * @param [properties] Properties to set @@ -3553,6 +3559,12 @@ export namespace google { PENDING = 2, BUFFERED = 3 } + + /** WriteMode enum. */ + enum WriteMode { + WRITE_MODE_UNSPECIFIED = 0, + INSERT = 1 + } } /** Properties of a TableSchema. */ diff --git a/packages/google-cloud-bigquery-storage/protos/protos.js b/packages/google-cloud-bigquery-storage/protos/protos.js index e74a907a0bf..83ac3676d44 100644 --- a/packages/google-cloud-bigquery-storage/protos/protos.js +++ b/packages/google-cloud-bigquery-storage/protos/protos.js @@ -7913,6 +7913,7 @@ * @property {google.protobuf.ITimestamp|null} [createTime] WriteStream createTime * @property {google.protobuf.ITimestamp|null} [commitTime] WriteStream commitTime * @property {google.cloud.bigquery.storage.v1.ITableSchema|null} [tableSchema] WriteStream tableSchema + * @property {google.cloud.bigquery.storage.v1.WriteStream.WriteMode|null} [writeMode] WriteStream writeMode */ /** @@ -7970,6 +7971,14 @@ */ WriteStream.prototype.tableSchema = null; + /** + * WriteStream writeMode. + * @member {google.cloud.bigquery.storage.v1.WriteStream.WriteMode} writeMode + * @memberof google.cloud.bigquery.storage.v1.WriteStream + * @instance + */ + WriteStream.prototype.writeMode = 0; + /** * Creates a new WriteStream instance using the specified properties. * @function create @@ -8004,6 +8013,8 @@ $root.google.protobuf.Timestamp.encode(message.commitTime, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); if (message.tableSchema != null && Object.hasOwnProperty.call(message, "tableSchema")) $root.google.cloud.bigquery.storage.v1.TableSchema.encode(message.tableSchema, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.writeMode != null && Object.hasOwnProperty.call(message, "writeMode")) + writer.uint32(/* id 7, wireType 0 =*/56).int32(message.writeMode); return writer; }; @@ -8053,6 +8064,9 @@ case 5: message.tableSchema = $root.google.cloud.bigquery.storage.v1.TableSchema.decode(reader, reader.uint32()); break; + case 7: + message.writeMode = reader.int32(); + break; default: reader.skipType(tag & 7); break; @@ -8116,6 +8130,14 @@ if (error) return "tableSchema." + error; } + if (message.writeMode != null && message.hasOwnProperty("writeMode")) + switch (message.writeMode) { + default: + return "writeMode: enum value expected"; + case 0: + case 1: + break; + } return null; }; @@ -8166,6 +8188,16 @@ throw TypeError(".google.cloud.bigquery.storage.v1.WriteStream.tableSchema: object expected"); message.tableSchema = $root.google.cloud.bigquery.storage.v1.TableSchema.fromObject(object.tableSchema); } + switch (object.writeMode) { + case "WRITE_MODE_UNSPECIFIED": + case 0: + message.writeMode = 0; + break; + case "INSERT": + case 1: + message.writeMode = 1; + break; + } return message; }; @@ -8188,6 +8220,7 @@ object.createTime = null; object.commitTime = null; object.tableSchema = null; + object.writeMode = options.enums === String ? "WRITE_MODE_UNSPECIFIED" : 0; } if (message.name != null && message.hasOwnProperty("name")) object.name = message.name; @@ -8199,6 +8232,8 @@ object.commitTime = $root.google.protobuf.Timestamp.toObject(message.commitTime, options); if (message.tableSchema != null && message.hasOwnProperty("tableSchema")) object.tableSchema = $root.google.cloud.bigquery.storage.v1.TableSchema.toObject(message.tableSchema, options); + if (message.writeMode != null && message.hasOwnProperty("writeMode")) + object.writeMode = options.enums === String ? $root.google.cloud.bigquery.storage.v1.WriteStream.WriteMode[message.writeMode] : message.writeMode; return object; }; @@ -8231,6 +8266,20 @@ return values; })(); + /** + * WriteMode enum. + * @name google.cloud.bigquery.storage.v1.WriteStream.WriteMode + * @enum {number} + * @property {number} WRITE_MODE_UNSPECIFIED=0 WRITE_MODE_UNSPECIFIED value + * @property {number} INSERT=1 INSERT value + */ + WriteStream.WriteMode = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "WRITE_MODE_UNSPECIFIED"] = 0; + values[valuesById[1] = "INSERT"] = 1; + return values; + })(); + return WriteStream; })(); diff --git a/packages/google-cloud-bigquery-storage/protos/protos.json b/packages/google-cloud-bigquery-storage/protos/protos.json index 4feebdb2d72..651ae7e0329 100644 --- a/packages/google-cloud-bigquery-storage/protos/protos.json +++ b/packages/google-cloud-bigquery-storage/protos/protos.json @@ -835,6 +835,13 @@ "options": { "(google.api.field_behavior)": "OUTPUT_ONLY" } + }, + "writeMode": { + "type": "WriteMode", + "id": 7, + "options": { + "(google.api.field_behavior)": "IMMUTABLE" + } } }, "nested": { @@ -845,6 +852,12 @@ "PENDING": 2, "BUFFERED": 3 } + }, + "WriteMode": { + "values": { + "WRITE_MODE_UNSPECIFIED": 0, + "INSERT": 1 + } } } },