Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
0d2bd4d
feat(genai): Adding tools samples (#4153)
Guiners Oct 22, 2025
081678e
Feat(genai): October tools samples (#4188)
Guiners Oct 22, 2025
ab30342
feat(storagecontrol): Add samples for Storage Anywhere Cache
thiyaguk09 Sep 3, 2025
d5ec75f
add testcase
thiyaguk09 Sep 3, 2025
3b805ea
lint fix
thiyaguk09 Sep 3, 2025
46ee0b2
fix: test case
thiyaguk09 Sep 3, 2025
a39cd56
fix: remove cacheName
thiyaguk09 Sep 4, 2025
6afd1d2
skip test case
thiyaguk09 Sep 4, 2025
e3c1483
test case remove projectId
thiyaguk09 Sep 5, 2025
a0abee8
addressing review comments
thiyaguk09 Sep 9, 2025
4056e10
index on anywhere-cache-samples: e83ba77b addressing review comments
thiyaguk09 Oct 8, 2025
76a7024
feat(storage-control): Improve Anywhere Cache API samples
thiyaguk09 Oct 8, 2025
2c026b1
test(storagecontrol): Enhance Anywhere Cache test assertions and cove…
thiyaguk09 Oct 8, 2025
41e2ade
Fix: Remove duplicate call to disableAnywhereCache
thiyaguk09 Oct 22, 2025
5fe1ec4
feat(genai): live samples part2 (#4189)
Guiners Oct 27, 2025
13967e9
Merge branch 'main' into anywhere-cache-samples
thiyaguk09 Oct 28, 2025
f25b80c
feat(genai): nano-banana-samples (#4184)
Guiners Oct 28, 2025
f19d350
feat(genai): live samples part1 (#4190)
Guiners Nov 3, 2025
bf3beb0
feature(appengine): Update quickstart samples to Nodejs24 (#4192)
srinjoyray Nov 4, 2025
7b3d9d2
Merge branch 'main' into anywhere-cache-samples
glasnt Nov 4, 2025
62dbb27
ci(ai-platform): skip tests for imagetext@001 samples (#4191)
glasnt Nov 11, 2025
9fa9e73
Merge branch 'main' into anywhere-cache-samples
thiyaguk09 Nov 18, 2025
b2d2bd0
feat(genai): updating SDK version to 1.30.0 (#4199)
Guiners Dec 2, 2025
228b467
Merge branch 'main' into anywhere-cache-samples
thiyaguk09 Dec 10, 2025
ae325ef
feat(genai): Bounding Box (#4198)
Guiners Dec 11, 2025
f6a44c5
fix(markdown-preview): Upgrade 'got' library and migrate to ES Module…
angelcaamal Dec 13, 2025
b8c845d
feat: Documenting custom credential suppliers (#4194)
vverman Dec 17, 2025
b2c188e
feat(genai): Adding count token samples (#4200)
Guiners Dec 18, 2025
2db5b9d
feat(genai): Adding videogen samples (#4197)
Guiners Dec 18, 2025
9d1b80e
ci(genai): Update `genai` directory to run tests in specific director…
holtskinner Dec 18, 2025
77b05d8
feat(genai): Sample/batch prediction (#4181)
Guiners Dec 18, 2025
abc11a6
feat(genai): Adding imggen samples (#4193)
Guiners Dec 18, 2025
15023fb
feat(genai): Add samples for Embeddings, Provisioned Throughput, Safe…
Guiners Dec 18, 2025
8deb05a
Merge branch 'main' into anywhere-cache-samples
iennae Dec 19, 2025
9febceb
Revert "feat(genai): Adding count token samples (#4200)" (#4206)
holtskinner Dec 25, 2025
455d71e
fix(vision): Improve logo detection (#4209)
amcolin Jan 7, 2026
2e110ef
Merge branch 'main' into anywhere-cache-samples
iennae Jan 7, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"node/no-unsupported-features/es-syntax": ["off"]
},
"parserOptions": {
"ecmaVersion": 2020,
"sourceType": "module"
}
}
1 change: 1 addition & 0 deletions .github/config/nodejs-dev.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@
"functions/v2/tips/retry",
"functions/v2/typed/googlechatbot",
"functions/v2/typed/greeting",
"genai", // parent directory
"generative-ai/snippets",
"healthcare/consent",
"healthcare/datasets",
Expand Down
1 change: 1 addition & 0 deletions .github/config/nodejs.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
"functions/http/uploadFile", // no tests exist
"functions/log", // parent directory
"functions/pubsub", // parent directory
"genai", // parent directory
"memorystore/redis", // parent directory
"recaptcha_enterprise/demosite/app", // no tests exist

Expand Down
3 changes: 2 additions & 1 deletion ai-platform/snippets/test/imagen.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ describe('AI platform edit image using Imagen inpainting and outpainting', () =>
});
});

describe('AI platform get image captions and responses using Imagen', () => {
// b/452720552
describe.skip('AI platform get image captions and responses using Imagen', () => {
it('should get short form captions for an image', async () => {
const stdout = execSync('node ./imagen-get-short-form-image-captions.js', {
cwd,
Expand Down
2 changes: 1 addition & 1 deletion appengine/building-an-app/build/app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@
# limitations under the License.

# [START gae_build_app_yaml_node]
runtime: nodejs20
runtime: nodejs24
# [END gae_build_app_yaml_node]
2 changes: 1 addition & 1 deletion appengine/building-an-app/build/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"url": "https://github.com/GoogleCloudPlatform/nodejs-docs-samples.git"
},
"engines": {
"node": "20.x.x"
"node": "24.x.x"
},
"author": "Google Inc.",
"license": "Apache-2.0",
Expand Down
2 changes: 1 addition & 1 deletion appengine/hello-world/flexible/app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
runtime: nodejs
env: flex
runtime_config:
operating_system: ubuntu22
operating_system: ubuntu24
# This sample incurs costs to run on the App Engine flexible environment.
# The settings below are to reduce costs during testing and are not appropriate
# for production use. For more information, see:
Expand Down
6 changes: 6 additions & 0 deletions auth/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"extends": "../.eslintrc.json",
"rules": {
"no-unused-vars": "off"
}
}
2 changes: 1 addition & 1 deletion auth/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,4 @@ information](https://developers.google.com/identity/protocols/application-defaul

For more information on downscoped credentials you can visit:

> https://github.com/googleapis/google-auth-library-nodejs
> https://github.com/googleapis/google-auth-library-nodejs
15 changes: 15 additions & 0 deletions auth/customcredentials/aws/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM node:20-slim

WORKDIR /app

COPY package*.json ./

RUN npm install --omit=dev

RUN useradd -m appuser

COPY --chown=appuser:appuser . .

USER appuser

CMD [ "node", "customCredentialSupplierAws.js" ]
121 changes: 121 additions & 0 deletions auth/customcredentials/aws/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
# Running the Custom AWS Credential Supplier Sample (Node.js)

This sample demonstrates how to use a custom AWS security credential supplier to authenticate with Google Cloud using AWS as an external identity provider. It uses the **AWS SDK for JavaScript (v3)** to fetch credentials from sources like Amazon Elastic Kubernetes Service (EKS) with IAM Roles for Service Accounts (IRSA), Elastic Container Service (ECS), or Fargate.

## Prerequisites

* An AWS account.
* A Google Cloud project with the IAM API enabled.
* A GCS bucket.
* **Node.js 16** or later installed.
* **npm** installed.

If you want to use AWS security credentials that cannot be retrieved using methods supported natively by the Google Auth library, a custom `AwsSecurityCredentialsSupplier` implementation may be specified. The supplier must return valid, unexpired AWS security credentials when called by the Google Cloud Auth library.

## Running Locally

For local development, you can provide credentials and configuration in a JSON file.

### Install Dependencies

Ensure you have Node.js installed, then install the required libraries:

```bash
npm install
```

### Configure Credentials for Local Development

1. Copy the example secrets file to a new file named `custom-credentials-aws-secrets.json` in the project root:
```bash
cp custom-credentials-aws-secrets.json.example custom-credentials-aws-secrets.json
```
2. Open `custom-credentials-aws-secrets.json` and fill in the required values for your AWS and Google Cloud configuration. Do not check your `custom-credentials-aws-secrets.json` file into version control.


### Run the Application

Execute the script using node:

```bash
node customCredentialSupplierAws.js
```

When run locally, the application will detect the `custom-credentials-aws-secrets.json` file and use it to configure the necessary environment variables for the AWS SDK.

## Running in a Containerized Environment (EKS)

This section provides a brief overview of how to run the sample in an Amazon EKS cluster.

### EKS Cluster Setup

First, you need an EKS cluster. You can create one using `eksctl` or the AWS Management Console. For detailed instructions, refer to the [Amazon EKS documentation](https://docs.aws.amazon.com/eks/latest/userguide/create-cluster.html).

### Configure IAM Roles for Service Accounts (IRSA)

IRSA enables you to associate an IAM role with a Kubernetes service account. This provides a secure way for your pods to access AWS services without hardcoding long-lived credentials.

Run the following command to create the IAM role and bind it to a Kubernetes Service Account:

```bash
eksctl create iamserviceaccount \
--name your-k8s-service-account \
--namespace default \
--cluster your-cluster-name \
--region your-aws-region \
--role-name your-role-name \
--attach-policy-arn arn:aws:iam::aws:policy/AmazonS3ReadOnlyAccess \
--approve
```

> **Note**: The `--attach-policy-arn` flag is used here to demonstrate attaching permissions. Update this with the specific AWS policy ARN your application requires.

For a deep dive into how this works without using `eksctl`, refer to the [IAM Roles for Service Accounts](https://docs.aws.amazon.com/eks/latest/userguide/iam-roles-for-service-accounts.html) documentation.

### Configure Google Cloud to Trust the AWS Role

To allow your AWS role to authenticate as a Google Cloud service account, you need to configure Workload Identity Federation. This process involves these key steps:

1. **Create a Workload Identity Pool and an AWS Provider:** The pool holds the configuration, and the provider is set up to trust your AWS account.

2. **Create or select a Google Cloud Service Account:** This service account will be impersonated by your AWS role.

3. **Bind the AWS Role to the Google Cloud Service Account:** Create an IAM policy binding that gives your AWS role the `Workload Identity User` (`roles/iam.workloadIdentityUser`) role on the Google Cloud service account.

For more detailed information, see the documentation on [Configuring Workload Identity Federation](https://cloud.google.com/iam/docs/workload-identity-federation-with-other-clouds).

### Containerize and Package the Application

Create a `Dockerfile` for the Node.js application and push the image to a container registry (for example Amazon ECR) that your EKS cluster can access.

**Note:** The provided [`Dockerfile`](Dockerfile) is an example and may need modification for your specific needs.

Build and push the image:
```bash
docker build -t your-container-image:latest .
docker push your-container-image:latest
```

### Deploy to EKS

Create a Kubernetes deployment manifest to deploy your application to the EKS cluster. See the [`pod.yaml`](pod.yaml) file for an example.

**Note:** The provided [`pod.yaml`](pod.yaml) is an example and may need to be modified for your specific needs.

Deploy the pod:

```bash
kubectl apply -f pod.yaml
```

### Clean Up

To clean up the resources, delete the EKS cluster and any other AWS and Google Cloud resources you created.

```bash
eksctl delete cluster --name your-cluster-name
```

## Testing

This sample is not continuously tested. It is provided for instructional purposes and may require modifications to work in your environment.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"aws_access_key_id": "YOUR_AWS_ACCESS_KEY_ID",
"aws_secret_access_key": "YOUR_AWS_SECRET_ACCESS_KEY",
"aws_region": "YOUR_AWS_REGION",
"gcp_workload_audience": "YOUR_GCP_WORKLOAD_AUDIENCE",
"gcs_bucket_name": "YOUR_GCS_BUCKET_NAME",
"gcp_service_account_impersonation_url": "YOUR_GCP_SERVICE_ACCOUNT_IMPERSONATION_URL"
}
Loading