From 54dae461b9424b8e3667a0db6ada65ee15ab9dfe Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Wed, 20 Mar 2024 16:28:03 +0100 Subject: [PATCH 1/7] chore(deps): update dependency @types/execa to v2 (#1899) --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b30ccadaa..f9bd0fc7a 100644 --- a/package.json +++ b/package.json @@ -67,7 +67,7 @@ "devDependencies": { "@grpc/proto-loader": "^0.7.0", "@opentelemetry/tracing": "^0.24.0", - "@types/execa": "^0.9.0", + "@types/execa": "^2.0.0", "@types/extend": "^3.0.0", "@types/lodash.snakecase": "^4.1.6", "@types/mocha": "^9.0.0", From 099d687329403bbf3e7495146935f99d9168f49d Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Wed, 20 Mar 2024 16:48:16 +0100 Subject: [PATCH 2/7] chore(deps): update dependency @types/rimraf to v4 (#1900) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | @​types/rimraf | [`^3.0.0` -> `^4.0.0`](https://renovatebot.com/diffs/npm/@types%2frimraf/3.0.2/4.0.5) | [![age](https://developer.mend.io/api/mc/badges/age/npm/@types%2frimraf/4.0.5?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@types%2frimraf/4.0.5?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@types%2frimraf/3.0.2/4.0.5?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@types%2frimraf/3.0.2/4.0.5?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Configuration 📅 **Schedule**: Branch creation - "after 9am and before 3pm" (UTC), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. â™» **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/googleapis/nodejs-pubsub). --- samples/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/package.json b/samples/package.json index d97bff74a..72365710e 100644 --- a/samples/package.json +++ b/samples/package.json @@ -31,7 +31,7 @@ "devDependencies": { "@google-cloud/bigquery": "^7.0.0", "@types/chai": "^4.2.16", - "@types/rimraf": "^3.0.0", + "@types/rimraf": "^4.0.0", "chai": "^4.2.0", "gts": "^5.0.0", "mocha": "^9.2.2", From d13d395341efacf926a126bf756873922f6bbab7 Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Thu, 21 Mar 2024 22:12:11 +0100 Subject: [PATCH 3/7] fix(deps): update dependency @types/long to v5 (#1901) --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f9bd0fc7a..987c6d64e 100644 --- a/package.json +++ b/package.json @@ -54,7 +54,7 @@ "@opentelemetry/api": "^1.6.0", "@opentelemetry/semantic-conventions": "~1.21.0", "@types/duplexify": "^3.6.0", - "@types/long": "^4.0.0", + "@types/long": "^5.0.0", "arrify": "^2.0.0", "extend": "^3.0.2", "google-auth-library": "^9.3.0", From 9589e9f1b65265cff588bb5577720c0de17a4b89 Mon Sep 17 00:00:00 2001 From: Megan Potter <57276408+feywind@users.noreply.github.com> Date: Fri, 22 Mar 2024 15:04:16 -0400 Subject: [PATCH 4/7] samples: add samples for AWS Kinesis ingestion (#1896) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * samples: add samples for AWS Kinesis ingestion * samples: add topic type update sample for kinesis ingestion * tests: add system tests for kinesis samples * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * tests:remove incorrect test for new sample * samples: simplify parameter names --------- Co-authored-by: Owl Bot --- README.md | 2 + samples/README.md | 40 ++++++++ samples/createTopicWithKinesisIngestion.js | 91 +++++++++++++++++++ samples/system-test/topics.test.ts | 37 ++++++++ .../createTopicWithKinesisIngestion.ts | 87 ++++++++++++++++++ .../typescript/updateTopicIngestionType.ts | 87 ++++++++++++++++++ samples/updateTopicIngestionType.js | 91 +++++++++++++++++++ 7 files changed, 435 insertions(+) create mode 100644 samples/createTopicWithKinesisIngestion.js create mode 100644 samples/typescript/createTopicWithKinesisIngestion.ts create mode 100644 samples/typescript/updateTopicIngestionType.ts create mode 100644 samples/updateTopicIngestionType.js diff --git a/README.md b/README.md index 9267ec11e..175f24bbb 100644 --- a/README.md +++ b/README.md @@ -137,6 +137,7 @@ Samples are in the [`samples/`](https://github.com/googleapis/nodejs-pubsub/tree | Create Subscription with ordering enabled | [source code](https://github.com/googleapis/nodejs-pubsub/blob/main/samples/createSubscriptionWithOrdering.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-pubsub&page=editor&open_in_editor=samples/createSubscriptionWithOrdering.js,samples/README.md) | | Create Subscription With Retry Policy | [source code](https://github.com/googleapis/nodejs-pubsub/blob/main/samples/createSubscriptionWithRetryPolicy.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-pubsub&page=editor&open_in_editor=samples/createSubscriptionWithRetryPolicy.js,samples/README.md) | | Create Topic | [source code](https://github.com/googleapis/nodejs-pubsub/blob/main/samples/createTopic.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-pubsub&page=editor&open_in_editor=samples/createTopic.js,samples/README.md) | +| Create Topic With Kinesis Ingestion | [source code](https://github.com/googleapis/nodejs-pubsub/blob/main/samples/createTopicWithKinesisIngestion.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-pubsub&page=editor&open_in_editor=samples/createTopicWithKinesisIngestion.js,samples/README.md) | | Create Topic With Schema | [source code](https://github.com/googleapis/nodejs-pubsub/blob/main/samples/createTopicWithSchema.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-pubsub&page=editor&open_in_editor=samples/createTopicWithSchema.js,samples/README.md) | | Create Topic With Schema Revisions | [source code](https://github.com/googleapis/nodejs-pubsub/blob/main/samples/createTopicWithSchemaRevisions.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-pubsub&page=editor&open_in_editor=samples/createTopicWithSchemaRevisions.js,samples/README.md) | | Delete a previously created schema | [source code](https://github.com/googleapis/nodejs-pubsub/blob/main/samples/deleteSchema.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-pubsub&page=editor&open_in_editor=samples/deleteSchema.js,samples/README.md) | @@ -184,6 +185,7 @@ Samples are in the [`samples/`](https://github.com/googleapis/nodejs-pubsub/tree | Test Subscription Permissions | [source code](https://github.com/googleapis/nodejs-pubsub/blob/main/samples/testSubscriptionPermissions.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-pubsub&page=editor&open_in_editor=samples/testSubscriptionPermissions.js,samples/README.md) | | Test Topic Permissions | [source code](https://github.com/googleapis/nodejs-pubsub/blob/main/samples/testTopicPermissions.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-pubsub&page=editor&open_in_editor=samples/testTopicPermissions.js,samples/README.md) | | Update Dead Letter Policy | [source code](https://github.com/googleapis/nodejs-pubsub/blob/main/samples/updateDeadLetterPolicy.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-pubsub&page=editor&open_in_editor=samples/updateDeadLetterPolicy.js,samples/README.md) | +| Update Topic Ingestion Type | [source code](https://github.com/googleapis/nodejs-pubsub/blob/main/samples/updateTopicIngestionType.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-pubsub&page=editor&open_in_editor=samples/updateTopicIngestionType.js,samples/README.md) | | Update Topic Schema | [source code](https://github.com/googleapis/nodejs-pubsub/blob/main/samples/updateTopicSchema.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-pubsub&page=editor&open_in_editor=samples/updateTopicSchema.js,samples/README.md) | | Validate a schema definition | [source code](https://github.com/googleapis/nodejs-pubsub/blob/main/samples/validateSchema.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-pubsub&page=editor&open_in_editor=samples/validateSchema.js,samples/README.md) | diff --git a/samples/README.md b/samples/README.md index d8fa96fa0..b1b445b2a 100644 --- a/samples/README.md +++ b/samples/README.md @@ -34,6 +34,7 @@ guides. * [Create Subscription with ordering enabled](#create-subscription-with-ordering-enabled) * [Create Subscription With Retry Policy](#create-subscription-with-retry-policy) * [Create Topic](#create-topic) + * [Create Topic With Kinesis Ingestion](#create-topic-with-kinesis-ingestion) * [Create Topic With Schema](#create-topic-with-schema) * [Create Topic With Schema Revisions](#create-topic-with-schema-revisions) * [Delete a previously created schema](#delete-a-previously-created-schema) @@ -81,6 +82,7 @@ guides. * [Test Subscription Permissions](#test-subscription-permissions) * [Test Topic Permissions](#test-topic-permissions) * [Update Dead Letter Policy](#update-dead-letter-policy) + * [Update Topic Ingestion Type](#update-topic-ingestion-type) * [Update Topic Schema](#update-topic-schema) * [Validate a schema definition](#validate-a-schema-definition) @@ -365,6 +367,25 @@ __Usage:__ +### Create Topic With Kinesis Ingestion + +Creates a new topic, with Kinesis ingestion enabled. + +View the [source code](https://github.com/googleapis/nodejs-pubsub/blob/main/samples/createTopicWithKinesisIngestion.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-pubsub&page=editor&open_in_editor=samples/createTopicWithKinesisIngestion.js,samples/README.md) + +__Usage:__ + + +`node createTopicWithKinesisIngestion.js ` + + +----- + + + + ### Create Topic With Schema Creates a new topic, with a schema definition. @@ -1258,6 +1279,25 @@ __Usage:__ +### Update Topic Ingestion Type + +Update the ingestion type on a topic. + +View the [source code](https://github.com/googleapis/nodejs-pubsub/blob/main/samples/updateTopicIngestionType.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-pubsub&page=editor&open_in_editor=samples/updateTopicIngestionType.js,samples/README.md) + +__Usage:__ + + +`node updateTopicIngestionType.js ` + + +----- + + + + ### Update Topic Schema Update the schema on a topic. diff --git a/samples/createTopicWithKinesisIngestion.js b/samples/createTopicWithKinesisIngestion.js new file mode 100644 index 000000000..3a77dcfa6 --- /dev/null +++ b/samples/createTopicWithKinesisIngestion.js @@ -0,0 +1,91 @@ +// 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 +// +// https://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. + +// This is a generated sample, using the typeless sample bot. Please +// look for the source TypeScript sample (.ts) for modifications. +'use strict'; + +/** + * This sample demonstrates how to perform basic operations on topics with + * the Google Cloud Pub/Sub API. + * + * For more information, see the README.md under /pubsub and the documentation + * at https://cloud.google.com/pubsub/docs. + */ + +// sample-metadata: +// title: Create Topic With Kinesis Ingestion +// description: Creates a new topic, with Kinesis ingestion enabled. +// usage: node createTopicWithKinesisIngestion.js + +// [START pubsub_create_topic_with_kinesis_ingestion] +/** + * TODO(developer): Uncomment these variables before running the sample. + */ +// const topicNameOrId = 'YOUR_TOPIC_NAME_OR_ID'; +// const roleArn = 'arn:aws:iam:...'; +// const gcpServiceAccount = 'ingestion-account@...'; +// const streamArn = 'arn:aws:kinesis:...'; +// const consumerArn = 'arn:aws:kinesis:...'; + +// Imports the Google Cloud client library +const {PubSub} = require('@google-cloud/pubsub'); + +// Creates a client; cache this for further use +const pubSubClient = new PubSub(); + +async function createTopicWithKinesisIngestion( + topicNameOrId, + awsRoleArn, + gcpServiceAccount, + streamArn, + consumerArn +) { + // Creates a new topic with a schema. Note that you might also + // pass Encodings.Json or Encodings.Binary here. + await pubSubClient.createTopic({ + name: topicNameOrId, + ingestionDataSourceSettings: { + awsKinesis: { + awsRoleArn, + gcpServiceAccount, + streamArn, + consumerArn, + }, + }, + }); + console.log(`Topic ${topicNameOrId} created with AWS Kinesis ingestion.`); +} +// [END pubsub_create_topic_with_kinesis_ingestion] + +function main( + topicNameOrId = 'YOUR_TOPIC_NAME_OR_ID', + roleArn = 'arn:aws:iam:...', + gcpServiceAccount = 'ingestion-account@...', + streamArn = 'arn:aws:kinesis:...', + consumerArn = 'arn:aws:kinesis:...' +) { + createTopicWithKinesisIngestion( + topicNameOrId, + roleArn, + gcpServiceAccount, + streamArn, + consumerArn + ).catch(err => { + console.error(err.message); + process.exitCode = 1; + }); +} + +main(...process.argv.slice(2)); diff --git a/samples/system-test/topics.test.ts b/samples/system-test/topics.test.ts index e1a142e9c..de31c71f3 100644 --- a/samples/system-test/topics.test.ts +++ b/samples/system-test/topics.test.ts @@ -96,6 +96,43 @@ describe('topics', () => { assert.ok(exists, 'Topic was created'); }); + const kinesisFakeArns = { + roleArn: 'arn:aws:iam::111111111111:role/fake-role-name', + gcpServiceAccount: + 'fake-service-account@fake-gcp-project.iam.gserviceaccount.com', + streamArn: 'arn:aws:kinesis:us-west-2:111111111111:stream/fake-stream-name', + consumerArn: + 'arn:aws:kinesis:us-west-2:111111111111:stream/fake-stream-name/consumer/consumer-1:1111111111', + }; + + it('should create a topic with kinesis ingestion', async () => { + const name = topicName('create-kinesis'); + + const output = execSync( + `${commandFor('createTopicWithKinesisIngestion')} ${name} ${ + kinesisFakeArns.roleArn + } ${kinesisFakeArns.gcpServiceAccount} ${kinesisFakeArns.streamArn} ${ + kinesisFakeArns.consumerArn + }` + ); + assert.include(output, `Topic ${name} created with AWS Kinesis ingestion.`); + const [topics] = await pubsub.getTopics(); + const exists = topics.some(t => t.name === fullTopicName(name)); + assert.ok(exists, 'Topic was created'); + }); + + it('should update a topic with kinesis integration', async () => { + const pair = await createPair('update-kinesis'); + const output = execSync( + `${commandFor('updateTopicIngestionType')} ${pair.t.name} ${ + kinesisFakeArns.roleArn + } ${kinesisFakeArns.gcpServiceAccount} ${kinesisFakeArns.streamArn} ${ + kinesisFakeArns.consumerArn + }` + ); + assert.include(output, 'Topic updated with Kinesis source successfully.'); + }); + it('should list topics', async () => { const pair = await createPair('list'); const output = execSync(`${commandFor('listAllTopics')}`); diff --git a/samples/typescript/createTopicWithKinesisIngestion.ts b/samples/typescript/createTopicWithKinesisIngestion.ts new file mode 100644 index 000000000..7c225b227 --- /dev/null +++ b/samples/typescript/createTopicWithKinesisIngestion.ts @@ -0,0 +1,87 @@ +// 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 +// +// https://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. + +/** + * This sample demonstrates how to perform basic operations on topics with + * the Google Cloud Pub/Sub API. + * + * For more information, see the README.md under /pubsub and the documentation + * at https://cloud.google.com/pubsub/docs. + */ + +// sample-metadata: +// title: Create Topic With Kinesis Ingestion +// description: Creates a new topic, with Kinesis ingestion enabled. +// usage: node createTopicWithKinesisIngestion.js + +// [START pubsub_create_topic_with_kinesis_ingestion] +/** + * TODO(developer): Uncomment these variables before running the sample. + */ +// const topicNameOrId = 'YOUR_TOPIC_NAME_OR_ID'; +// const roleArn = 'arn:aws:iam:...'; +// const gcpServiceAccount = 'ingestion-account@...'; +// const streamArn = 'arn:aws:kinesis:...'; +// const consumerArn = 'arn:aws:kinesis:...'; + +// Imports the Google Cloud client library +import {PubSub} from '@google-cloud/pubsub'; + +// Creates a client; cache this for further use +const pubSubClient = new PubSub(); + +async function createTopicWithKinesisIngestion( + topicNameOrId: string, + awsRoleArn: string, + gcpServiceAccount: string, + streamArn: string, + consumerArn: string +) { + // Creates a new topic with a schema. Note that you might also + // pass Encodings.Json or Encodings.Binary here. + await pubSubClient.createTopic({ + name: topicNameOrId, + ingestionDataSourceSettings: { + awsKinesis: { + awsRoleArn, + gcpServiceAccount, + streamArn, + consumerArn, + }, + }, + }); + console.log(`Topic ${topicNameOrId} created with AWS Kinesis ingestion.`); +} +// [END pubsub_create_topic_with_kinesis_ingestion] + +function main( + topicNameOrId = 'YOUR_TOPIC_NAME_OR_ID', + roleArn = 'arn:aws:iam:...', + gcpServiceAccount = 'ingestion-account@...', + streamArn = 'arn:aws:kinesis:...', + consumerArn = 'arn:aws:kinesis:...' +) { + createTopicWithKinesisIngestion( + topicNameOrId, + roleArn, + gcpServiceAccount, + streamArn, + consumerArn + ).catch(err => { + console.error(err.message); + process.exitCode = 1; + }); +} + +main(...process.argv.slice(2)); diff --git a/samples/typescript/updateTopicIngestionType.ts b/samples/typescript/updateTopicIngestionType.ts new file mode 100644 index 000000000..10b4f733f --- /dev/null +++ b/samples/typescript/updateTopicIngestionType.ts @@ -0,0 +1,87 @@ +// 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. + +/** + * This sample demonstrates how to perform basic operations on + * subscriptions with the Google Cloud Pub/Sub API. + * + * For more information, see the README.md under /pubsub and the documentation + * at https://cloud.google.com/pubsub/docs. + */ + +// sample-metadata: +// title: Update Topic Ingestion Type +// description: Update the ingestion type on a topic. +// usage: node updateTopicIngestionType.js + +// [START pubsub_update_topic_type] +/** + * TODO(developer): Uncomment these variables before running the sample. + */ +// const topicNameOrId = 'YOUR_TOPIC_NAME_OR_ID'; +// const awsRoleArn = 'arn:aws:iam:...'; +// const gcpServiceAccount = 'ingestion-account@...'; +// const streamArn = 'arn:aws:kinesis:...'; +// const consumerArn = 'arn:aws:kinesis:...'; + +// Imports the Google Cloud client library +import {PubSub, TopicMetadata} from '@google-cloud/pubsub'; + +// Creates a client; cache this for further use +const pubSubClient = new PubSub(); + +async function updateTopicIngestionType( + topicNameOrId: string, + awsRoleArn: string, + gcpServiceAccount: string, + streamArn: string, + consumerArn: string +) { + const metadata: TopicMetadata = { + ingestionDataSourceSettings: { + awsKinesis: { + awsRoleArn, + gcpServiceAccount, + streamArn, + consumerArn, + }, + }, + }; + + await pubSubClient.topic(topicNameOrId).setMetadata(metadata); + + console.log('Topic updated with Kinesis source successfully.'); +} +// [END pubsub_update_topic_type] + +function main( + topicNameOrId = 'YOUR_TOPIC_NAME_OR_ID', + roleArn = 'arn:aws:iam:...', + gcpServiceAccount = 'ingestion-account@...', + streamArn = 'arn:aws:kinesis:...', + consumerArn = 'arn:aws:kinesis:...' +) { + updateTopicIngestionType( + topicNameOrId, + roleArn, + gcpServiceAccount, + streamArn, + consumerArn + ).catch(err => { + console.error(err.message); + process.exitCode = 1; + }); +} + +main(...process.argv.slice(2)); diff --git a/samples/updateTopicIngestionType.js b/samples/updateTopicIngestionType.js new file mode 100644 index 000000000..16a5baf30 --- /dev/null +++ b/samples/updateTopicIngestionType.js @@ -0,0 +1,91 @@ +// 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. + +// This is a generated sample, using the typeless sample bot. Please +// look for the source TypeScript sample (.ts) for modifications. +'use strict'; + +/** + * This sample demonstrates how to perform basic operations on + * subscriptions with the Google Cloud Pub/Sub API. + * + * For more information, see the README.md under /pubsub and the documentation + * at https://cloud.google.com/pubsub/docs. + */ + +// sample-metadata: +// title: Update Topic Ingestion Type +// description: Update the ingestion type on a topic. +// usage: node updateTopicIngestionType.js + +// [START pubsub_update_topic_type] +/** + * TODO(developer): Uncomment these variables before running the sample. + */ +// const topicNameOrId = 'YOUR_TOPIC_NAME_OR_ID'; +// const awsRoleArn = 'arn:aws:iam:...'; +// const gcpServiceAccount = 'ingestion-account@...'; +// const streamArn = 'arn:aws:kinesis:...'; +// const consumerArn = 'arn:aws:kinesis:...'; + +// Imports the Google Cloud client library +const {PubSub} = require('@google-cloud/pubsub'); + +// Creates a client; cache this for further use +const pubSubClient = new PubSub(); + +async function updateTopicIngestionType( + topicNameOrId, + awsRoleArn, + gcpServiceAccount, + streamArn, + consumerArn +) { + const metadata = { + ingestionDataSourceSettings: { + awsKinesis: { + awsRoleArn, + gcpServiceAccount, + streamArn, + consumerArn, + }, + }, + }; + + await pubSubClient.topic(topicNameOrId).setMetadata(metadata); + + console.log('Topic updated with Kinesis source successfully.'); +} +// [END pubsub_update_topic_type] + +function main( + topicNameOrId = 'YOUR_TOPIC_NAME_OR_ID', + roleArn = 'arn:aws:iam:...', + gcpServiceAccount = 'ingestion-account@...', + streamArn = 'arn:aws:kinesis:...', + consumerArn = 'arn:aws:kinesis:...' +) { + updateTopicIngestionType( + topicNameOrId, + roleArn, + gcpServiceAccount, + streamArn, + consumerArn + ).catch(err => { + console.error(err.message); + process.exitCode = 1; + }); +} + +main(...process.argv.slice(2)); From aba9aee0c8ecc840c150aa077892b7bb88f18eca Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 2 Apr 2024 10:00:55 -0400 Subject: [PATCH 5/7] feat: add several fields to manage state of database encryption update (#1904) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: add custom datetime format for Cloud Storage subscriptions PiperOrigin-RevId: 619178723 Source-Link: https://github.com/googleapis/googleapis/commit/811a857dd5e5a500127d0470f16c2caca366435d Source-Link: https://github.com/googleapis/googleapis-gen/commit/768fb44d4daaea946a291f6795a50af26a515488 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNzY4ZmI0NGQ0ZGFhZWE5NDZhMjkxZjY3OTVhNTBhZjI2YTUxNTQ4OCJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * feat: add several fields to manage state of database encryption update PiperOrigin-RevId: 619289281 Source-Link: https://github.com/googleapis/googleapis/commit/3a7c33486ca758b180c6d11dd4705fa9a22e8576 Source-Link: https://github.com/googleapis/googleapis-gen/commit/6a8c733062d833d11c5245eda50f5108e0e55324 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNmE4YzczMzA2MmQ4MzNkMTFjNTI0NWVkYTUwZjUxMDhlMGU1NTMyNCJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot --- protos/google/pubsub/v1/pubsub.proto | 7 +++++- protos/protos.d.ts | 6 +++++ protos/protos.js | 23 +++++++++++++++++++ protos/protos.json | 7 ++++++ src/v1/publisher_client.ts | 15 ++++++++---- src/v1/schema_service_client.ts | 15 ++++++++---- src/v1/subscriber_client.ts | 15 ++++++++---- test/gapic_publisher_v1.ts | 34 +++++++++++++++++++++++++++- test/gapic_schema_service_v1.ts | 34 +++++++++++++++++++++++++++- test/gapic_subscriber_v1.ts | 34 +++++++++++++++++++++++++++- 10 files changed, 174 insertions(+), 16 deletions(-) diff --git a/protos/google/pubsub/v1/pubsub.proto b/protos/google/pubsub/v1/pubsub.proto index 93e1e84a7..c3a90cd40 100644 --- a/protos/google/pubsub/v1/pubsub.proto +++ b/protos/google/pubsub/v1/pubsub.proto @@ -203,7 +203,7 @@ message IngestionDataSourceSettings { KINESIS_PERMISSION_DENIED = 2; // Permission denied encountered while publishing to the topic. This can - // happen due to Pub/Sub SA has not been granted the [appropriate publish + // happen if the Pub/Sub SA has not been granted the [appropriate publish // permissions](https://cloud.google.com/pubsub/docs/access-control#pubsub.publisher) PUBLISH_PERMISSION_DENIED = 3; @@ -1197,6 +1197,11 @@ message CloudStorageConfig { // Must not end in "/". string filename_suffix = 3 [(google.api.field_behavior) = OPTIONAL]; + // Optional. User-provided format string specifying how to represent datetimes + // in Cloud Storage filenames. See the [datetime format + // guidance](https://cloud.google.com/pubsub/docs/create-cloudstorage-subscription#file_names). + string filename_datetime_format = 10 [(google.api.field_behavior) = OPTIONAL]; + // Defaults to text format. oneof output_format { // Optional. If set, message data will be written to Cloud Storage in text diff --git a/protos/protos.d.ts b/protos/protos.d.ts index dda11424e..9346f23a8 100644 --- a/protos/protos.d.ts +++ b/protos/protos.d.ts @@ -3733,6 +3733,9 @@ export namespace google { /** CloudStorageConfig filenameSuffix */ filenameSuffix?: (string|null); + /** CloudStorageConfig filenameDatetimeFormat */ + filenameDatetimeFormat?: (string|null); + /** CloudStorageConfig textConfig */ textConfig?: (google.pubsub.v1.CloudStorageConfig.ITextConfig|null); @@ -3767,6 +3770,9 @@ export namespace google { /** CloudStorageConfig filenameSuffix. */ public filenameSuffix: string; + /** CloudStorageConfig filenameDatetimeFormat. */ + public filenameDatetimeFormat: string; + /** CloudStorageConfig textConfig. */ public textConfig?: (google.pubsub.v1.CloudStorageConfig.ITextConfig|null); diff --git a/protos/protos.js b/protos/protos.js index fa620f8e5..29e7fa666 100644 --- a/protos/protos.js +++ b/protos/protos.js @@ -8644,6 +8644,7 @@ * @property {string|null} [bucket] CloudStorageConfig bucket * @property {string|null} [filenamePrefix] CloudStorageConfig filenamePrefix * @property {string|null} [filenameSuffix] CloudStorageConfig filenameSuffix + * @property {string|null} [filenameDatetimeFormat] CloudStorageConfig filenameDatetimeFormat * @property {google.pubsub.v1.CloudStorageConfig.ITextConfig|null} [textConfig] CloudStorageConfig textConfig * @property {google.pubsub.v1.CloudStorageConfig.IAvroConfig|null} [avroConfig] CloudStorageConfig avroConfig * @property {google.protobuf.IDuration|null} [maxDuration] CloudStorageConfig maxDuration @@ -8690,6 +8691,14 @@ */ CloudStorageConfig.prototype.filenameSuffix = ""; + /** + * CloudStorageConfig filenameDatetimeFormat. + * @member {string} filenameDatetimeFormat + * @memberof google.pubsub.v1.CloudStorageConfig + * @instance + */ + CloudStorageConfig.prototype.filenameDatetimeFormat = ""; + /** * CloudStorageConfig textConfig. * @member {google.pubsub.v1.CloudStorageConfig.ITextConfig|null|undefined} textConfig @@ -8784,6 +8793,8 @@ writer.uint32(/* id 7, wireType 0 =*/56).int64(message.maxBytes); if (message.state != null && Object.hasOwnProperty.call(message, "state")) writer.uint32(/* id 9, wireType 0 =*/72).int32(message.state); + if (message.filenameDatetimeFormat != null && Object.hasOwnProperty.call(message, "filenameDatetimeFormat")) + writer.uint32(/* id 10, wireType 2 =*/82).string(message.filenameDatetimeFormat); return writer; }; @@ -8830,6 +8841,10 @@ message.filenameSuffix = reader.string(); break; } + case 10: { + message.filenameDatetimeFormat = reader.string(); + break; + } case 4: { message.textConfig = $root.google.pubsub.v1.CloudStorageConfig.TextConfig.decode(reader, reader.uint32()); break; @@ -8895,6 +8910,9 @@ if (message.filenameSuffix != null && message.hasOwnProperty("filenameSuffix")) if (!$util.isString(message.filenameSuffix)) return "filenameSuffix: string expected"; + if (message.filenameDatetimeFormat != null && message.hasOwnProperty("filenameDatetimeFormat")) + if (!$util.isString(message.filenameDatetimeFormat)) + return "filenameDatetimeFormat: string expected"; if (message.textConfig != null && message.hasOwnProperty("textConfig")) { properties.outputFormat = 1; { @@ -8953,6 +8971,8 @@ message.filenamePrefix = String(object.filenamePrefix); if (object.filenameSuffix != null) message.filenameSuffix = String(object.filenameSuffix); + if (object.filenameDatetimeFormat != null) + message.filenameDatetimeFormat = String(object.filenameDatetimeFormat); if (object.textConfig != null) { if (typeof object.textConfig !== "object") throw TypeError(".google.pubsub.v1.CloudStorageConfig.textConfig: object expected"); @@ -9032,6 +9052,7 @@ } else object.maxBytes = options.longs === String ? "0" : 0; object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; + object.filenameDatetimeFormat = ""; } if (message.bucket != null && message.hasOwnProperty("bucket")) object.bucket = message.bucket; @@ -9058,6 +9079,8 @@ object.maxBytes = options.longs === String ? $util.Long.prototype.toString.call(message.maxBytes) : options.longs === Number ? new $util.LongBits(message.maxBytes.low >>> 0, message.maxBytes.high >>> 0).toNumber() : message.maxBytes; if (message.state != null && message.hasOwnProperty("state")) object.state = options.enums === String ? $root.google.pubsub.v1.CloudStorageConfig.State[message.state] === undefined ? message.state : $root.google.pubsub.v1.CloudStorageConfig.State[message.state] : message.state; + if (message.filenameDatetimeFormat != null && message.hasOwnProperty("filenameDatetimeFormat")) + object.filenameDatetimeFormat = message.filenameDatetimeFormat; return object; }; diff --git a/protos/protos.json b/protos/protos.json index 9fecd46b3..04ec87360 100644 --- a/protos/protos.json +++ b/protos/protos.json @@ -1320,6 +1320,13 @@ "(google.api.field_behavior)": "OPTIONAL" } }, + "filenameDatetimeFormat": { + "type": "string", + "id": 10, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, "textConfig": { "type": "TextConfig", "id": 4, diff --git a/src/v1/publisher_client.ts b/src/v1/publisher_client.ts index d12bf10cc..d281e1f0e 100644 --- a/src/v1/publisher_client.ts +++ b/src/v1/publisher_client.ts @@ -123,8 +123,15 @@ export class PublisherClient { 'Please set either universe_domain or universeDomain, but not both.' ); } + const universeDomainEnvVar = + typeof process === 'object' && typeof process.env === 'object' + ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] + : undefined; this._universeDomain = - opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com'; + opts?.universeDomain ?? + opts?.universe_domain ?? + universeDomainEnvVar ?? + 'googleapis.com'; this._servicePath = 'pubsub.' + this._universeDomain; const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; @@ -177,7 +184,7 @@ export class PublisherClient { // Determine the client header string. const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; - if (typeof process !== 'undefined' && 'versions' in process) { + if (typeof process === 'object' && 'versions' in process) { clientHeader.push(`gl-node/${process.versions.node}`); } else { clientHeader.push(`gl-web/${this._gaxModule.version}`); @@ -350,7 +357,7 @@ export class PublisherClient { */ static get servicePath() { if ( - typeof process !== undefined && + typeof process === 'object' && typeof process.emitWarning === 'function' ) { process.emitWarning( @@ -368,7 +375,7 @@ export class PublisherClient { */ static get apiEndpoint() { if ( - typeof process !== undefined && + typeof process === 'object' && typeof process.emitWarning === 'function' ) { process.emitWarning( diff --git a/src/v1/schema_service_client.ts b/src/v1/schema_service_client.ts index 2e42e4633..068b0a247 100644 --- a/src/v1/schema_service_client.ts +++ b/src/v1/schema_service_client.ts @@ -122,8 +122,15 @@ export class SchemaServiceClient { 'Please set either universe_domain or universeDomain, but not both.' ); } + const universeDomainEnvVar = + typeof process === 'object' && typeof process.env === 'object' + ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] + : undefined; this._universeDomain = - opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com'; + opts?.universeDomain ?? + opts?.universe_domain ?? + universeDomainEnvVar ?? + 'googleapis.com'; this._servicePath = 'pubsub.' + this._universeDomain; const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; @@ -176,7 +183,7 @@ export class SchemaServiceClient { // Determine the client header string. const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; - if (typeof process !== 'undefined' && 'versions' in process) { + if (typeof process === 'object' && 'versions' in process) { clientHeader.push(`gl-node/${process.versions.node}`); } else { clientHeader.push(`gl-web/${this._gaxModule.version}`); @@ -326,7 +333,7 @@ export class SchemaServiceClient { */ static get servicePath() { if ( - typeof process !== undefined && + typeof process === 'object' && typeof process.emitWarning === 'function' ) { process.emitWarning( @@ -344,7 +351,7 @@ export class SchemaServiceClient { */ static get apiEndpoint() { if ( - typeof process !== undefined && + typeof process === 'object' && typeof process.emitWarning === 'function' ) { process.emitWarning( diff --git a/src/v1/subscriber_client.ts b/src/v1/subscriber_client.ts index 09b8aee5c..2c0e820f7 100644 --- a/src/v1/subscriber_client.ts +++ b/src/v1/subscriber_client.ts @@ -124,8 +124,15 @@ export class SubscriberClient { 'Please set either universe_domain or universeDomain, but not both.' ); } + const universeDomainEnvVar = + typeof process === 'object' && typeof process.env === 'object' + ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] + : undefined; this._universeDomain = - opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com'; + opts?.universeDomain ?? + opts?.universe_domain ?? + universeDomainEnvVar ?? + 'googleapis.com'; this._servicePath = 'pubsub.' + this._universeDomain; const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; @@ -178,7 +185,7 @@ export class SubscriberClient { // Determine the client header string. const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; - if (typeof process !== 'undefined' && 'versions' in process) { + if (typeof process === 'object' && 'versions' in process) { clientHeader.push(`gl-node/${process.versions.node}`); } else { clientHeader.push(`gl-web/${this._gaxModule.version}`); @@ -359,7 +366,7 @@ export class SubscriberClient { */ static get servicePath() { if ( - typeof process !== undefined && + typeof process === 'object' && typeof process.emitWarning === 'function' ) { process.emitWarning( @@ -377,7 +384,7 @@ export class SubscriberClient { */ static get apiEndpoint() { if ( - typeof process !== undefined && + typeof process === 'object' && typeof process.emitWarning === 'function' ) { process.emitWarning( diff --git a/test/gapic_publisher_v1.ts b/test/gapic_publisher_v1.ts index d1ded0f7f..f2254a188 100644 --- a/test/gapic_publisher_v1.ts +++ b/test/gapic_publisher_v1.ts @@ -142,7 +142,7 @@ describe('v1.PublisherClient', () => { }); if ( - typeof process !== 'undefined' && + typeof process === 'object' && typeof process.emitWarning === 'function' ) { it('throws DeprecationWarning if static servicePath is used', () => { @@ -176,6 +176,38 @@ describe('v1.PublisherClient', () => { const servicePath = client.apiEndpoint; assert.strictEqual(servicePath, 'pubsub.example.com'); }); + + if (typeof process === 'object' && 'env' in process) { + describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { + it('sets apiEndpoint from environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = new publisherModule.v1.PublisherClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'pubsub.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + + it('value configured in code has priority over environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = new publisherModule.v1.PublisherClient({ + universeDomain: 'configured.example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'pubsub.configured.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + }); + } it('does not allow setting both universeDomain and universe_domain', () => { assert.throws(() => { new publisherModule.v1.PublisherClient({ diff --git a/test/gapic_schema_service_v1.ts b/test/gapic_schema_service_v1.ts index cf463b46c..cd96d3d23 100644 --- a/test/gapic_schema_service_v1.ts +++ b/test/gapic_schema_service_v1.ts @@ -142,7 +142,7 @@ describe('v1.SchemaServiceClient', () => { }); if ( - typeof process !== 'undefined' && + typeof process === 'object' && typeof process.emitWarning === 'function' ) { it('throws DeprecationWarning if static servicePath is used', () => { @@ -178,6 +178,38 @@ describe('v1.SchemaServiceClient', () => { const servicePath = client.apiEndpoint; assert.strictEqual(servicePath, 'pubsub.example.com'); }); + + if (typeof process === 'object' && 'env' in process) { + describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { + it('sets apiEndpoint from environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = new schemaserviceModule.v1.SchemaServiceClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'pubsub.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + + it('value configured in code has priority over environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = new schemaserviceModule.v1.SchemaServiceClient({ + universeDomain: 'configured.example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'pubsub.configured.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + }); + } it('does not allow setting both universeDomain and universe_domain', () => { assert.throws(() => { new schemaserviceModule.v1.SchemaServiceClient({ diff --git a/test/gapic_subscriber_v1.ts b/test/gapic_subscriber_v1.ts index a266bc046..18c097733 100644 --- a/test/gapic_subscriber_v1.ts +++ b/test/gapic_subscriber_v1.ts @@ -156,7 +156,7 @@ describe('v1.SubscriberClient', () => { }); if ( - typeof process !== 'undefined' && + typeof process === 'object' && typeof process.emitWarning === 'function' ) { it('throws DeprecationWarning if static servicePath is used', () => { @@ -190,6 +190,38 @@ describe('v1.SubscriberClient', () => { const servicePath = client.apiEndpoint; assert.strictEqual(servicePath, 'pubsub.example.com'); }); + + if (typeof process === 'object' && 'env' in process) { + describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { + it('sets apiEndpoint from environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = new subscriberModule.v1.SubscriberClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'pubsub.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + + it('value configured in code has priority over environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = new subscriberModule.v1.SubscriberClient({ + universeDomain: 'configured.example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'pubsub.configured.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + }); + } it('does not allow setting both universeDomain and universe_domain', () => { assert.throws(() => { new subscriberModule.v1.SubscriberClient({ From c3e3113c4e13c55bc4999edc2231b507587ffb07 Mon Sep 17 00:00:00 2001 From: Megan Potter <57276408+feywind@users.noreply.github.com> Date: Fri, 3 May 2024 12:23:39 -0400 Subject: [PATCH 6/7] build: remove some unneeded typings and shuffle others (#1918) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * build: remove some unneeded typings and shuffle others * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot --- package.json | 4 +--- protos/protos.d.ts | 9 ++++++++ protos/protos.js | 53 +++++++++++++++++++++++++++++++++++++++++----- protos/protos.json | 26 ++++++++++++++++++++++- 4 files changed, 83 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index 987c6d64e..39f311ac9 100644 --- a/package.json +++ b/package.json @@ -53,8 +53,6 @@ "@google-cloud/promisify": "^4.0.0", "@opentelemetry/api": "^1.6.0", "@opentelemetry/semantic-conventions": "~1.21.0", - "@types/duplexify": "^3.6.0", - "@types/long": "^5.0.0", "arrify": "^2.0.0", "extend": "^3.0.2", "google-auth-library": "^9.3.0", @@ -67,7 +65,7 @@ "devDependencies": { "@grpc/proto-loader": "^0.7.0", "@opentelemetry/tracing": "^0.24.0", - "@types/execa": "^2.0.0", + "@types/duplexify": "^3.6.4", "@types/extend": "^3.0.0", "@types/lodash.snakecase": "^4.1.6", "@types/mocha": "^9.0.0", diff --git a/protos/protos.d.ts b/protos/protos.d.ts index 9346f23a8..e4f105872 100644 --- a/protos/protos.d.ts +++ b/protos/protos.d.ts @@ -9227,6 +9227,9 @@ export namespace google { /** Publishing protoReferenceDocumentationUri */ protoReferenceDocumentationUri?: (string|null); + + /** Publishing restReferenceDocumentationUri */ + restReferenceDocumentationUri?: (string|null); } /** Represents a Publishing. */ @@ -9268,6 +9271,9 @@ export namespace google { /** Publishing protoReferenceDocumentationUri. */ public protoReferenceDocumentationUri: string; + /** Publishing restReferenceDocumentationUri. */ + public restReferenceDocumentationUri: string; + /** * Creates a new Publishing instance using the specified properties. * @param [properties] Properties to set @@ -13485,6 +13491,9 @@ export namespace google { /** ServiceOptions .google.api.oauthScopes */ ".google.api.oauthScopes"?: (string|null); + + /** ServiceOptions .google.api.apiVersion */ + ".google.api.apiVersion"?: (string|null); } /** Represents a ServiceOptions. */ diff --git a/protos/protos.js b/protos/protos.js index 29e7fa666..1bb3b1694 100644 --- a/protos/protos.js +++ b/protos/protos.js @@ -21899,6 +21899,7 @@ * @property {google.api.ClientLibraryOrganization|null} [organization] Publishing organization * @property {Array.|null} [librarySettings] Publishing librarySettings * @property {string|null} [protoReferenceDocumentationUri] Publishing protoReferenceDocumentationUri + * @property {string|null} [restReferenceDocumentationUri] Publishing restReferenceDocumentationUri */ /** @@ -21999,6 +22000,14 @@ */ Publishing.prototype.protoReferenceDocumentationUri = ""; + /** + * Publishing restReferenceDocumentationUri. + * @member {string} restReferenceDocumentationUri + * @memberof google.api.Publishing + * @instance + */ + Publishing.prototype.restReferenceDocumentationUri = ""; + /** * Creates a new Publishing instance using the specified properties. * @function create @@ -22046,6 +22055,8 @@ $root.google.api.ClientLibrarySettings.encode(message.librarySettings[i], writer.uint32(/* id 109, wireType 2 =*/874).fork()).ldelim(); if (message.protoReferenceDocumentationUri != null && Object.hasOwnProperty.call(message, "protoReferenceDocumentationUri")) writer.uint32(/* id 110, wireType 2 =*/882).string(message.protoReferenceDocumentationUri); + if (message.restReferenceDocumentationUri != null && Object.hasOwnProperty.call(message, "restReferenceDocumentationUri")) + writer.uint32(/* id 111, wireType 2 =*/890).string(message.restReferenceDocumentationUri); return writer; }; @@ -22126,6 +22137,10 @@ message.protoReferenceDocumentationUri = reader.string(); break; } + case 111: { + message.restReferenceDocumentationUri = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -22218,6 +22233,9 @@ if (message.protoReferenceDocumentationUri != null && message.hasOwnProperty("protoReferenceDocumentationUri")) if (!$util.isString(message.protoReferenceDocumentationUri)) return "protoReferenceDocumentationUri: string expected"; + if (message.restReferenceDocumentationUri != null && message.hasOwnProperty("restReferenceDocumentationUri")) + if (!$util.isString(message.restReferenceDocumentationUri)) + return "restReferenceDocumentationUri: string expected"; return null; }; @@ -22312,6 +22330,8 @@ } if (object.protoReferenceDocumentationUri != null) message.protoReferenceDocumentationUri = String(object.protoReferenceDocumentationUri); + if (object.restReferenceDocumentationUri != null) + message.restReferenceDocumentationUri = String(object.restReferenceDocumentationUri); return message; }; @@ -22341,6 +22361,7 @@ object.docTagPrefix = ""; object.organization = options.enums === String ? "CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED" : 0; object.protoReferenceDocumentationUri = ""; + object.restReferenceDocumentationUri = ""; } if (message.methodSettings && message.methodSettings.length) { object.methodSettings = []; @@ -22371,6 +22392,8 @@ } if (message.protoReferenceDocumentationUri != null && message.hasOwnProperty("protoReferenceDocumentationUri")) object.protoReferenceDocumentationUri = message.protoReferenceDocumentationUri; + if (message.restReferenceDocumentationUri != null && message.hasOwnProperty("restReferenceDocumentationUri")) + object.restReferenceDocumentationUri = message.restReferenceDocumentationUri; return object; }; @@ -32094,12 +32117,9 @@ if (message.uninterpretedOption != null && message.uninterpretedOption.length) for (var i = 0; i < message.uninterpretedOption.length; ++i) $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); - if (message[".google.api.fieldBehavior"] != null && message[".google.api.fieldBehavior"].length) { - writer.uint32(/* id 1052, wireType 2 =*/8418).fork(); + if (message[".google.api.fieldBehavior"] != null && message[".google.api.fieldBehavior"].length) for (var i = 0; i < message[".google.api.fieldBehavior"].length; ++i) - writer.int32(message[".google.api.fieldBehavior"][i]); - writer.ldelim(); - } + writer.uint32(/* id 1052, wireType 0 =*/8416).int32(message[".google.api.fieldBehavior"][i]); if (message[".google.api.resourceReference"] != null && Object.hasOwnProperty.call(message, ".google.api.resourceReference")) $root.google.api.ResourceReference.encode(message[".google.api.resourceReference"], writer.uint32(/* id 1055, wireType 2 =*/8442).fork()).ldelim(); return writer; @@ -33945,6 +33965,7 @@ * @property {Array.|null} [uninterpretedOption] ServiceOptions uninterpretedOption * @property {string|null} [".google.api.defaultHost"] ServiceOptions .google.api.defaultHost * @property {string|null} [".google.api.oauthScopes"] ServiceOptions .google.api.oauthScopes + * @property {string|null} [".google.api.apiVersion"] ServiceOptions .google.api.apiVersion */ /** @@ -34003,6 +34024,14 @@ */ ServiceOptions.prototype[".google.api.oauthScopes"] = ""; + /** + * ServiceOptions .google.api.apiVersion. + * @member {string} .google.api.apiVersion + * @memberof google.protobuf.ServiceOptions + * @instance + */ + ServiceOptions.prototype[".google.api.apiVersion"] = ""; + /** * Creates a new ServiceOptions instance using the specified properties. * @function create @@ -34038,6 +34067,8 @@ writer.uint32(/* id 1049, wireType 2 =*/8394).string(message[".google.api.defaultHost"]); if (message[".google.api.oauthScopes"] != null && Object.hasOwnProperty.call(message, ".google.api.oauthScopes")) writer.uint32(/* id 1050, wireType 2 =*/8402).string(message[".google.api.oauthScopes"]); + if (message[".google.api.apiVersion"] != null && Object.hasOwnProperty.call(message, ".google.api.apiVersion")) + writer.uint32(/* id 525000001, wireType 2 =*/4200000010).string(message[".google.api.apiVersion"]); return writer; }; @@ -34094,6 +34125,10 @@ message[".google.api.oauthScopes"] = reader.string(); break; } + case 525000001: { + message[".google.api.apiVersion"] = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -34152,6 +34187,9 @@ if (message[".google.api.oauthScopes"] != null && message.hasOwnProperty(".google.api.oauthScopes")) if (!$util.isString(message[".google.api.oauthScopes"])) return ".google.api.oauthScopes: string expected"; + if (message[".google.api.apiVersion"] != null && message.hasOwnProperty(".google.api.apiVersion")) + if (!$util.isString(message[".google.api.apiVersion"])) + return ".google.api.apiVersion: string expected"; return null; }; @@ -34188,6 +34226,8 @@ message[".google.api.defaultHost"] = String(object[".google.api.defaultHost"]); if (object[".google.api.oauthScopes"] != null) message[".google.api.oauthScopes"] = String(object[".google.api.oauthScopes"]); + if (object[".google.api.apiVersion"] != null) + message[".google.api.apiVersion"] = String(object[".google.api.apiVersion"]); return message; }; @@ -34211,6 +34251,7 @@ object.features = null; object[".google.api.defaultHost"] = ""; object[".google.api.oauthScopes"] = ""; + object[".google.api.apiVersion"] = ""; } if (message.deprecated != null && message.hasOwnProperty("deprecated")) object.deprecated = message.deprecated; @@ -34225,6 +34266,8 @@ object[".google.api.defaultHost"] = message[".google.api.defaultHost"]; if (message[".google.api.oauthScopes"] != null && message.hasOwnProperty(".google.api.oauthScopes")) object[".google.api.oauthScopes"] = message[".google.api.oauthScopes"]; + if (message[".google.api.apiVersion"] != null && message.hasOwnProperty(".google.api.apiVersion")) + object[".google.api.apiVersion"] = message[".google.api.apiVersion"]; return object; }; diff --git a/protos/protos.json b/protos/protos.json index 04ec87360..f63d0e5e7 100644 --- a/protos/protos.json +++ b/protos/protos.json @@ -2596,6 +2596,11 @@ "id": 1050, "extend": "google.protobuf.ServiceOptions" }, + "apiVersion": { + "type": "string", + "id": 525000001, + "extend": "google.protobuf.ServiceOptions" + }, "CommonLanguageSettings": { "fields": { "referenceDocsUri": { @@ -2704,6 +2709,10 @@ "protoReferenceDocumentationUri": { "type": "string", "id": 110 + }, + "restReferenceDocumentationUri": { + "type": "string", + "id": 111 } } }, @@ -2879,7 +2888,10 @@ "rule": "repeated", "type": "google.api.FieldBehavior", "id": 1052, - "extend": "google.protobuf.FieldOptions" + "extend": "google.protobuf.FieldOptions", + "options": { + "packed": false + } }, "FieldBehavior": { "values": { @@ -4077,9 +4089,21 @@ 1001, 1001 ], + [ + 1002, + 1002 + ], + [ + 9990, + 9990 + ], [ 9995, 9999 + ], + [ + 10000, + 10000 ] ], "reserved": [ From c9d0363f69df304140e7ee1bee3af8833d83b6de Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Mon, 6 May 2024 13:22:32 -0400 Subject: [PATCH 7/7] chore(main): release 4.4.0 (#1902) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- CHANGELOG.md | 12 ++++++++++++ package.json | 2 +- samples/package.json | 2 +- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4b81185ee..cb30f75e0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,18 @@ [1]: https://www.npmjs.com/package/@google-cloud/pubsub?activeTab=versions +## [4.4.0](https://github.com/googleapis/nodejs-pubsub/compare/v4.3.3...v4.4.0) (2024-05-03) + + +### Features + +* Add several fields to manage state of database encryption update ([#1904](https://github.com/googleapis/nodejs-pubsub/issues/1904)) ([aba9aee](https://github.com/googleapis/nodejs-pubsub/commit/aba9aee0c8ecc840c150aa077892b7bb88f18eca)) + + +### Bug Fixes + +* **deps:** Update dependency @types/long to v5 ([#1901](https://github.com/googleapis/nodejs-pubsub/issues/1901)) ([d13d395](https://github.com/googleapis/nodejs-pubsub/commit/d13d395341efacf926a126bf756873922f6bbab7)) + ## [4.3.3](https://github.com/googleapis/nodejs-pubsub/compare/v4.3.2...v4.3.3) (2024-03-03) diff --git a/package.json b/package.json index 39f311ac9..950b9bf5e 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@google-cloud/pubsub", "description": "Cloud Pub/Sub Client Library for Node.js", - "version": "4.3.3", + "version": "4.4.0", "license": "Apache-2.0", "author": "Google Inc.", "engines": { diff --git a/samples/package.json b/samples/package.json index 72365710e..dfd64b4e7 100644 --- a/samples/package.json +++ b/samples/package.json @@ -21,7 +21,7 @@ "precompile": "npm run clean" }, "dependencies": { - "@google-cloud/pubsub": "^4.3.3", + "@google-cloud/pubsub": "^4.4.0", "@opentelemetry/api": "^1.6.0", "@opentelemetry/tracing": "^0.24.0", "avro-js": "^1.11.3",