Skip to content

Commit 3d5dde6

Browse files
Merge branch 'main' into hivanalejandro-features-bigquery-2
2 parents e38bb02 + 4c03eb2 commit 3d5dde6

12 files changed

Lines changed: 47 additions & 22 deletions

secret-manager/createSecret.js

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,18 @@
1414

1515
'use strict';
1616

17-
async function main(parent = 'projects/my-project', secretId = 'my-secret') {
17+
async function main(
18+
parent = 'projects/my-project',
19+
secretId = 'my-secret',
20+
ttl = undefined
21+
) {
1822
// [START secretmanager_create_secret]
1923
/**
2024
* TODO(developer): Uncomment these variables before running the sample.
2125
*/
2226
// const parent = 'projects/my-project';
2327
// const secretId = 'my-secret';
28+
// const ttl = undefined // Optional: Specify TTL in seconds (e.g., '900s' for 15 minutes).
2429

2530
// Imports the Secret Manager library
2631
const {SecretManagerServiceClient} = require('@google-cloud/secret-manager');
@@ -29,14 +34,24 @@ async function main(parent = 'projects/my-project', secretId = 'my-secret') {
2934
const client = new SecretManagerServiceClient();
3035

3136
async function createSecret() {
37+
const secretConfig = {
38+
replication: {
39+
automatic: {},
40+
},
41+
};
42+
43+
// Add TTL to the secret configuration if provided
44+
if (ttl) {
45+
secretConfig.ttl = {
46+
seconds: parseInt(ttl.replace('s', ''), 10),
47+
};
48+
console.log(`Secret TTL set to ${ttl}`);
49+
}
50+
3251
const [secret] = await client.createSecret({
3352
parent: parent,
3453
secretId: secretId,
35-
secret: {
36-
replication: {
37-
automatic: {},
38-
},
39-
},
54+
secret: secretConfig,
4055
});
4156

4257
console.log(`Created secret ${secret.name}`);

secret-manager/test/secretmanager.test.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,11 +245,21 @@ describe('Secret Manager samples', () => {
245245
assert.match(stdout, new RegExp('Payload: bar'));
246246
});
247247

248-
it('creates a secret', async () => {
248+
it('creates a secret with TTL', async () => {
249+
const ttl = '900s';
249250
const output = execSync(
250-
`node createSecret.js projects/${projectId} ${secretId}-2`
251+
`node createSecret.js projects/${projectId} ${secretId}-2 ${ttl}`
251252
);
252253
assert.match(output, new RegExp('Created secret'));
254+
assert.match(output, new RegExp(`Secret TTL set to ${ttl}`));
255+
});
256+
257+
it('creates a secret without TTL', async () => {
258+
const output = execSync(
259+
`node createSecret.js projects/${projectId} ${secretId}-7`
260+
);
261+
assert.match(output, new RegExp('Created secret'));
262+
assert.notMatch(output, new RegExp('Secret TTL set to'));
253263
});
254264

255265
it('creates a regional secret', async () => {

tpu/createStartupScriptVM.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,11 @@ async function main(tpuClient) {
5050
// The accelerator type that specifies the version and size of the Cloud TPU you want to create.
5151
// For more information about supported accelerator types for each TPU version,
5252
// see https://cloud.google.com/tpu/docs/system-architecture-tpu-vm#versions.
53-
const tpuType = 'v2-8';
53+
const tpuType = 'v5litepod-4';
5454

5555
// Software version that specifies the version of the TPU runtime to install. For more information,
5656
// see https://cloud.google.com/tpu/docs/runtimes
57-
const tpuSoftwareVersion = 'tpu-vm-tf-2.17.0-pod-pjrt';
57+
const tpuSoftwareVersion = 'v2-tpuv5-litepod';
5858

5959
async function callCreateTpuVMStartupScript() {
6060
// Create a node

tpu/createTopologyVM.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ async function main(tpuClient) {
5151

5252
// Software version that specifies the version of the TPU runtime to install. For more information,
5353
// see https://cloud.google.com/tpu/docs/runtimes
54-
const tpuSoftwareVersion = 'tpu-vm-tf-2.17.0-pod-pjrt';
54+
const tpuSoftwareVersion = 'v2-tpuv5-litepod';
5555

5656
// The version of the Cloud TPU you want to create.
5757
// Available options: TYPE_UNSPECIFIED = 0, V2 = 2, V3 = 4, V4 = 7

tpu/createVM.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,11 @@ async function main(tpuClient) {
4949
// The accelerator type that specifies the version and size of the Cloud TPU you want to create.
5050
// For more information about supported accelerator types for each TPU version,
5151
// see https://cloud.google.com/tpu/docs/system-architecture-tpu-vm#versions.
52-
const tpuType = 'v2-8';
52+
const tpuType = 'v5litepod-4';
5353

5454
// Software version that specifies the version of the TPU runtime to install. For more information,
5555
// see https://cloud.google.com/tpu/docs/runtimes
56-
const tpuSoftwareVersion = 'tpu-vm-tf-2.14.1';
56+
const tpuSoftwareVersion = 'v2-tpuv5-litepod';
5757

5858
async function callCreateTpuVM() {
5959
// Create a node

tpu/queuedResources/createQueuedResource.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,16 +49,16 @@ async function main(tpuClient) {
4949
// The zone in which to create the node.
5050
// For more information about supported TPU types for specific zones,
5151
// see https://cloud.google.com/tpu/docs/regions-zones
52-
const zone = `${region}-f`;
52+
const zone = `${region}-a`;
5353

5454
// The accelerator type that specifies the version and size of the node you want to create.
5555
// For more information about supported accelerator types for each TPU version,
5656
// see https://cloud.google.com/tpu/docs/system-architecture-tpu-vm#versions.
57-
const tpuType = 'v2-8';
57+
const tpuType = 'v5litepod-4';
5858

5959
// Software version that specifies the version of the node runtime to install. For more information,
6060
// see https://cloud.google.com/tpu/docs/runtimes
61-
const tpuSoftwareVersion = 'tpu-vm-tf-2.14.1';
61+
const tpuSoftwareVersion = 'v2-tpuv5-litepod';
6262

6363
async function callCreateQueuedResource() {
6464
// Create a node

tpu/queuedResources/deleteQueuedResource.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ async function main(tpuClient) {
3636
const queuedResourceName = 'queued-resource-1';
3737

3838
// The zone of your queued resource.
39-
const zone = 'us-central1-f';
39+
const zone = 'us-central1-a';
4040

4141
async function callDeleteTpuVM(nodeName) {
4242
const request = {

tpu/queuedResources/forceDeleteQueuedResource.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ async function main(tpuClient) {
3636
const queuedResourceName = 'queued-resource-1';
3737

3838
// The zone of your queued resource.
39-
const zone = 'us-central1-f';
39+
const zone = 'us-central1-a';
4040

4141
async function callForceDeleteQueuedResource() {
4242
const request = {

tpu/queuedResources/getQueuedResource.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ async function main(tpuClient) {
3636
const queuedResourceName = 'queued-resource-1';
3737

3838
// The zone of your queued resource.
39-
const zone = 'us-central1-f';
39+
const zone = 'us-central1-a';
4040

4141
async function callGetQueuedResource() {
4242
const request = {

tpu/queuedResources/getQueuedResourcesList.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ async function main(tpuClient) {
3333
const projectId = await tpuClient.getProjectId();
3434

3535
// The zone from which the Queued Resources are retrived.
36-
const zone = 'us-central1-f';
36+
const zone = 'us-central1-a';
3737

3838
async function callGetQueuedResourcesList() {
3939
const request = {

0 commit comments

Comments
 (0)