From 3f19a63fc121ab3ba94661755f62a3f9ae855913 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 3 Dec 2021 13:10:22 -0800 Subject: [PATCH] feat: Add WriteDisposition to BigQuery Export API (#80) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: Add WriteDisposition to BigQuery Export API PiperOrigin-RevId: 413945427 Source-Link: https://github.com/googleapis/googleapis/commit/6230f6eaf6c6c58f0a472434159d8b6abc10084b Source-Link: https://github.com/googleapis/googleapis-gen/commit/00cdef308d6d6ba4c75354de491da484f642bd80 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMDBjZGVmMzA4ZDZkNmJhNGM3NTM1NGRlNDkxZGE0ODRmNjQyYmQ4MCJ9 * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot --- .../v1/contact_center_insights.proto | 16 ++++++ protos/protos.d.ts | 13 +++++ protos/protos.js | 56 +++++++++++++++++++ protos/protos.json | 11 ++++ ...ct_center_insights.export_insights_data.js | 4 ++ src/v1/contact_center_insights_client.ts | 2 + 6 files changed, 102 insertions(+) diff --git a/protos/google/cloud/contactcenterinsights/v1/contact_center_insights.proto b/protos/google/cloud/contactcenterinsights/v1/contact_center_insights.proto index e8153a1..922219b 100644 --- a/protos/google/cloud/contactcenterinsights/v1/contact_center_insights.proto +++ b/protos/google/cloud/contactcenterinsights/v1/contact_center_insights.proto @@ -607,6 +607,19 @@ message ExportInsightsDataRequest { string table = 2; } + // Specifies the action that occurs if the destination table already exists. + enum WriteDisposition { + // Write disposition is not specified. Defaults to WRITE_TRUNCATE. + WRITE_DISPOSITION_UNSPECIFIED = 0; + + // If the table already exists, BigQuery will overwrite the table data and + // use the schema from the load. + WRITE_TRUNCATE = 1; + + // If the table already exists, BigQuery will append data to the table. + WRITE_APPEND = 2; + } + // Exporter destination. oneof destination { // Specified if sink is a BigQuery table. @@ -629,6 +642,9 @@ message ExportInsightsDataRequest { // Format: // projects/{project}/locations/{location}/keyRings/{keyring}/cryptoKeys/{key}/cryptoKeyVersions/{version} string kms_key = 4; + + // Options for what to do if the destination table already exists. + WriteDisposition write_disposition = 5; } // Metadata for an export insights operation. diff --git a/protos/protos.d.ts b/protos/protos.d.ts index 0807c63..6b8989d 100644 --- a/protos/protos.d.ts +++ b/protos/protos.d.ts @@ -2288,6 +2288,9 @@ export namespace google { /** ExportInsightsDataRequest kmsKey */ kmsKey?: (string|null); + + /** ExportInsightsDataRequest writeDisposition */ + writeDisposition?: (google.cloud.contactcenterinsights.v1.ExportInsightsDataRequest.WriteDisposition|keyof typeof google.cloud.contactcenterinsights.v1.ExportInsightsDataRequest.WriteDisposition|null); } /** Represents an ExportInsightsDataRequest. */ @@ -2311,6 +2314,9 @@ export namespace google { /** ExportInsightsDataRequest kmsKey. */ public kmsKey: string; + /** ExportInsightsDataRequest writeDisposition. */ + public writeDisposition: (google.cloud.contactcenterinsights.v1.ExportInsightsDataRequest.WriteDisposition|keyof typeof google.cloud.contactcenterinsights.v1.ExportInsightsDataRequest.WriteDisposition); + /** ExportInsightsDataRequest destination. */ public destination?: "bigQueryDestination"; @@ -2488,6 +2494,13 @@ export namespace google { */ public toJSON(): { [k: string]: any }; } + + /** WriteDisposition enum. */ + enum WriteDisposition { + WRITE_DISPOSITION_UNSPECIFIED = 0, + WRITE_TRUNCATE = 1, + WRITE_APPEND = 2 + } } /** Properties of an ExportInsightsDataMetadata. */ diff --git a/protos/protos.js b/protos/protos.js index d8143b7..7e3949f 100644 --- a/protos/protos.js +++ b/protos/protos.js @@ -4979,6 +4979,7 @@ * @property {string|null} [parent] ExportInsightsDataRequest parent * @property {string|null} [filter] ExportInsightsDataRequest filter * @property {string|null} [kmsKey] ExportInsightsDataRequest kmsKey + * @property {google.cloud.contactcenterinsights.v1.ExportInsightsDataRequest.WriteDisposition|null} [writeDisposition] ExportInsightsDataRequest writeDisposition */ /** @@ -5028,6 +5029,14 @@ */ ExportInsightsDataRequest.prototype.kmsKey = ""; + /** + * ExportInsightsDataRequest writeDisposition. + * @member {google.cloud.contactcenterinsights.v1.ExportInsightsDataRequest.WriteDisposition} writeDisposition + * @memberof google.cloud.contactcenterinsights.v1.ExportInsightsDataRequest + * @instance + */ + ExportInsightsDataRequest.prototype.writeDisposition = 0; + // OneOf field names bound to virtual getters and setters var $oneOfFields; @@ -5074,6 +5083,8 @@ writer.uint32(/* id 3, wireType 2 =*/26).string(message.filter); if (message.kmsKey != null && Object.hasOwnProperty.call(message, "kmsKey")) writer.uint32(/* id 4, wireType 2 =*/34).string(message.kmsKey); + if (message.writeDisposition != null && Object.hasOwnProperty.call(message, "writeDisposition")) + writer.uint32(/* id 5, wireType 0 =*/40).int32(message.writeDisposition); return writer; }; @@ -5120,6 +5131,9 @@ case 4: message.kmsKey = reader.string(); break; + case 5: + message.writeDisposition = reader.int32(); + break; default: reader.skipType(tag & 7); break; @@ -5173,6 +5187,15 @@ if (message.kmsKey != null && message.hasOwnProperty("kmsKey")) if (!$util.isString(message.kmsKey)) return "kmsKey: string expected"; + if (message.writeDisposition != null && message.hasOwnProperty("writeDisposition")) + switch (message.writeDisposition) { + default: + return "writeDisposition: enum value expected"; + case 0: + case 1: + case 2: + break; + } return null; }; @@ -5199,6 +5222,20 @@ message.filter = String(object.filter); if (object.kmsKey != null) message.kmsKey = String(object.kmsKey); + switch (object.writeDisposition) { + case "WRITE_DISPOSITION_UNSPECIFIED": + case 0: + message.writeDisposition = 0; + break; + case "WRITE_TRUNCATE": + case 1: + message.writeDisposition = 1; + break; + case "WRITE_APPEND": + case 2: + message.writeDisposition = 2; + break; + } return message; }; @@ -5219,6 +5256,7 @@ object.parent = ""; object.filter = ""; object.kmsKey = ""; + object.writeDisposition = options.enums === String ? "WRITE_DISPOSITION_UNSPECIFIED" : 0; } if (message.parent != null && message.hasOwnProperty("parent")) object.parent = message.parent; @@ -5231,6 +5269,8 @@ object.filter = message.filter; if (message.kmsKey != null && message.hasOwnProperty("kmsKey")) object.kmsKey = message.kmsKey; + if (message.writeDisposition != null && message.hasOwnProperty("writeDisposition")) + object.writeDisposition = options.enums === String ? $root.google.cloud.contactcenterinsights.v1.ExportInsightsDataRequest.WriteDisposition[message.writeDisposition] : message.writeDisposition; return object; }; @@ -5477,6 +5517,22 @@ return BigQueryDestination; })(); + /** + * WriteDisposition enum. + * @name google.cloud.contactcenterinsights.v1.ExportInsightsDataRequest.WriteDisposition + * @enum {number} + * @property {number} WRITE_DISPOSITION_UNSPECIFIED=0 WRITE_DISPOSITION_UNSPECIFIED value + * @property {number} WRITE_TRUNCATE=1 WRITE_TRUNCATE value + * @property {number} WRITE_APPEND=2 WRITE_APPEND value + */ + ExportInsightsDataRequest.WriteDisposition = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "WRITE_DISPOSITION_UNSPECIFIED"] = 0; + values[valuesById[1] = "WRITE_TRUNCATE"] = 1; + values[valuesById[2] = "WRITE_APPEND"] = 2; + return values; + })(); + return ExportInsightsDataRequest; })(); diff --git a/protos/protos.json b/protos/protos.json index a2c01a0..b625a3d 100644 --- a/protos/protos.json +++ b/protos/protos.json @@ -961,6 +961,10 @@ "kmsKey": { "type": "string", "id": 4 + }, + "writeDisposition": { + "type": "WriteDisposition", + "id": 5 } }, "nested": { @@ -982,6 +986,13 @@ "id": 2 } } + }, + "WriteDisposition": { + "values": { + "WRITE_DISPOSITION_UNSPECIFIED": 0, + "WRITE_TRUNCATE": 1, + "WRITE_APPEND": 2 + } } } }, diff --git a/samples/generated/v1/contact_center_insights.export_insights_data.js b/samples/generated/v1/contact_center_insights.export_insights_data.js index fb50e9f..c51c492 100644 --- a/samples/generated/v1/contact_center_insights.export_insights_data.js +++ b/samples/generated/v1/contact_center_insights.export_insights_data.js @@ -38,6 +38,10 @@ function main(parent) { * projects/{project}/locations/{location}/keyRings/{keyring}/cryptoKeys/{key}/cryptoKeyVersions/{version} */ // const kmsKey = 'abc123' + /** + * Options for what to do if the destination table already exists. + */ + // const writeDisposition = {} // Imports the Contactcenterinsights library const {ContactCenterInsightsClient} = diff --git a/src/v1/contact_center_insights_client.ts b/src/v1/contact_center_insights_client.ts index 4536ee2..392fca1 100644 --- a/src/v1/contact_center_insights_client.ts +++ b/src/v1/contact_center_insights_client.ts @@ -2586,6 +2586,8 @@ export class ContactCenterInsightsClient { * A fully qualified KMS key name for BigQuery tables protected by CMEK. * Format: * projects/{project}/locations/{location}/keyRings/{keyring}/cryptoKeys/{key}/cryptoKeyVersions/{version} + * @param {google.cloud.contactcenterinsights.v1.ExportInsightsDataRequest.WriteDisposition} request.writeDisposition + * Options for what to do if the destination table already exists. * @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.