Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(securitycenter): Add Resource SCC Management API Org SHA Custom … #3942

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

agggaurav2024
Copy link

…Module code samples

Description

Fixes # b/347347427, b/347347480, b/347347258, b/347347835
This PR adds SCC Managament API Org Security Health Analytics Custom Module Code Samples for Create, Update, Get and GetEffective.

Note: Before submitting a pull request, please open an issue for discussion if you are not associated with Google.

Checklist

  • I have followed guidelines from CONTRIBUTING.MD and Samples Style Guide
  • Tests pass: npm test (see Testing)
  • Lint pass: npm run lint (see Style)
  • These samples need a new API enabled in testing projects to pass (let us know which ones)
  • These samples need a new/updated env vars in testing projects set to pass (let us know which ones)
  • This pull request is from a branch created directly off of GoogleCloudPlatform/nodejs-docs-samples. Not a fork.
  • This sample adds a new sample directory, and I updated the CODEOWNERS file with the codeowners for this sample
  • This sample adds a new sample directory, and I created GitHub Actions workflow for this sample
  • This sample adds a new Product API, and I updated the Blunderbuss issue/PR auto-assigner with the codeowners for this sample
  • Please merge this PR for me once it is approved

@agggaurav2024 agggaurav2024 requested review from a team as code owners January 6, 2025 06:57
Copy link

google-cla bot commented Jan 6, 2025

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

Copy link

snippet-bot bot commented Jan 6, 2025

Here is the summary of changes.

You are about to add 4 region tags.

This comment is generated by snippet-bot.
If you find problems with this result, please file an issue at:
https://github.com/googleapis/repo-automation-bots/issues.
To update this comment, add snippet-bot:force-run label or use the checkbox below:

  • Refresh this comment

@product-auto-label product-auto-label bot added the api: securitycenter Issues related to the Security Command Center API. label Jan 6, 2025
Copy link
Contributor

@code-review-assist code-review-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi team,

I'm currently reviewing this pull request and will provide my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly understand the changes:

This pull request, submitted by agggaurav2024, aims to add code samples for the Security Health Analytics Custom Module in the Security Command Center (SCC) Management API. The intent is to provide examples for creating, updating, getting, and getting the effective state of these custom modules. This addresses issues b/347347427, b/347347480, b/347347258, and b/347347835.

Here's a breakdown of the changes:

  • New files added:
    • security-center/snippets/management_api/createSecurityHealthAnalyticsCustomModule.js: Adds a function to create a new Security Health Analytics Custom Module. (Lines 1-91)
    • security-center/snippets/management_api/getEffectiveSecurityHealthAnalyticsCustomModule.js: Adds a function to retrieve an existing effective security health analytics custom module. (Lines 1-46)
    • security-center/snippets/management_api/getSecurityHealthAnalyticsCustomModule.js: Adds a function to retrieve an existing security health analytics custom module. (Lines 1-46)
    • security-center/snippets/management_api/updateSecurityHealthAnalyticsCustomModule.js: Adds a function to update an existing security health analytics custom module. (Lines 1-63)
    • security-center/snippets/system-test/managemnt_api/securityHealthAnalyticsCustomModule.test.js: Added system test file for the new custom modules. (Lines 1-155)
  • security-center/snippets/package.json updated: Added @google-cloud/securitycentermanagement dependency and updated versions of other dependencies. (Lines 13-27)

The code samples utilize the @google-cloud/securitycentermanagement library. The pull request includes comprehensive comments explaining each function and its parameters. The author has also included a checklist confirming adherence to the project's contribution guidelines and testing procedures.

I'll be looking at the code's functionality, testing, and overall style in my full review.


And now, a little haiku to lighten the mood:

Code flows like a stream,
Tests pass, a joyful green light,
Bugs flee in the night.

@product-auto-label product-auto-label bot added the samples Issues that are directly related to samples. label Jan 6, 2025
Copy link
Contributor

Gemini encountered an error creating the review. You can try again by commenting @code-review-assist review.

Copy link
Contributor

@code-review-assist code-review-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @agggaurav2024 and reviewers,

I'm currently reviewing this pull request and will provide my feedback in a few minutes. In the meantime, I'm providing this summary of the pull request's content to help you and other reviewers quickly understand the changes and intent.

This pull request, feat(securitycenter): Add Resource SCC Management API Org SHA Custom …, aims to add code samples for the Security Health Analytics Custom Module in the Security Command Center (SCC) Management API. Specifically, it addresses issues b/347347427, b/347347480, b/347347258, and b/347347835.

Here's a summary of the changes:

  • New files added:
    • security-center/snippets/management_api/createSecurityHealthAnalyticsCustomModule.js: Adds a function to create a new Security Health Analytics Custom Module.
    • security-center/snippets/management_api/getEffectiveSecurityHealthAnalyticsCustomModule.js: Adds a function to retrieve an existing effective Security Health Analytics Custom Module.
    • security-center/snippets/management_api/getSecurityHealthAnalyticsCustomModule.js: Adds a function to retrieve an existing Security Health Analytics Custom Module.
    • security-center/snippets/management_api/updateSecurityHealthAnalyticsCustomModule.js: Adds a function to update an existing Security Health Analytics Custom Module.
    • security-center/snippets/system-test/managemnt_api/securityHealthAnalyticsCustomModule.test.js: Adds system tests for the new functions.
  • security-center/snippets/package.json updated: Updated dependencies to include @google-cloud/securitycentermanagement and updated versions of other dependencies.

The code samples demonstrate how to create, update, get, and get the effective configuration of Security Health Analytics Custom Modules. The system tests verify the functionality of these code samples.

I've reviewed the code and found it well-structured and easy to understand. The comments are clear and concise, and the code is well-tested. The updated package.json ensures all necessary dependencies are included.


And now, a little haiku to lighten the mood:

Code flows like a stream,
Tests pass, a joyful green light,
Bugs flee in the night.

Copy link
Contributor

Gemini encountered an error creating the review. You can try again by commenting @code-review-assist review.

Copy link
Contributor

@code-review-assist code-review-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi team,

I'm currently reviewing this pull request and will provide my feedback shortly. In the meantime, here's a summary of the changes for you and other reviewers to quickly get up to speed:

This pull request, submitted by agggaurav2024, aims to add code samples for the Security Health Analytics Custom Module in the Security Command Center (SCC) Management API. The changes address issues b/347347427, b/347347480, b/347347258, and b/347347835.

Specifically, the following changes were made:

  • New files added:
    • security-center/snippets/management_api/createSecurityHealthAnalyticsCustomModule.js: Adds a sample for creating a Security Health Analytics Custom Module.
    • security-center/snippets/management_api/getEffectiveSecurityHealthAnalyticsCustomModule.js: Adds a sample for retrieving an effective Security Health Analytics Custom Module.
    • security-center/snippets/management_api/getSecurityHealthAnalyticsCustomModule.js: Adds a sample for retrieving an existing Security Health Analytics Custom Module.
    • security-center/snippets/management_api/updateSecurityHealthAnalyticsCustomModule.js: Adds a sample for updating an existing Security Health Analytics Custom Module.
    • security-center/snippets/system-test/managemnt_api/securityHealthAnalyticsCustomModule.test.js: Adds system tests for the new samples.
  • security-center/snippets/package.json updated: Updated dependencies to include @google-cloud/securitycentermanagement and updated versions of other dependencies.

The code samples cover the create, update, get, and getEffective operations for the Security Health Analytics Custom Module. The system test file thoroughly tests the functionality of these new samples.

The author has indicated that the samples require new API enablement and environment variables in testing projects. This information should be clarified during the review process.

I'll be looking at the code for correctness, style, and test coverage shortly. I'll also check the API enablement and environment variable requirements mentioned in the checklist.


And now, a little haiku to lighten the mood:

Code flows like a stream,
Tests run, a green light appears,
Bugs flee in the night.

Copy link
Contributor

Gemini encountered an error creating the review. You can try again by commenting @code-review-assist review.

Copy link
Contributor

@code-review-assist code-review-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi team,

I'm currently reviewing this pull request and will provide my feedback shortly. In the meantime, I'm providing this summary of the pull request's content for you and other reviewers to quickly grasp the changes and intent.

This pull request, authored by agggaurav2024, aims to add code samples for the Security Health Analytics Custom Module in the Security Command Center (SCC) Management API. The changes include:

  • New files added: Four new .js files have been added to the security-center/snippets/management_api directory. These files provide code samples for creating, updating, getting, and getting the effective state of a Security Health Analytics Custom Module.
  • package.json updated: The package.json file has been updated to include the @google-cloud/securitycentermanagement dependency, along with version bumps for other dependencies.
  • System test added: A comprehensive system test (security-center/snippets/system-test/managemnt_api/securityHealthAnalyticsCustomModule.test.js) has been added to verify the functionality of the new code samples.

The code samples cover the following functionalities:

Function File Name Description
Create Security Health Analytics Custom Module createSecurityHealthAnalyticsCustomModule.js Creates a new Security Health Analytics Custom Module.
Update Security Health Analytics Custom Module updateSecurityHealthAnalyticsCustomModule.js Updates an existing Security Health Analytics Custom Module.
Get Security Health Analytics Custom Module getSecurityHealthAnalyticsCustomModule.js Retrieves an existing Security Health Analytics Custom Module.
Get Effective Security Health Analytics Custom Module getEffectiveSecurityHealthAnalyticsCustomModule.js Retrieves the effective state of an existing Security Health Analytics Custom Module.

The pull request also addresses issues b/347347427, b/347347480, b/347347258, and b/347347835. The author has indicated that all tests and lint checks have passed, and the necessary updates to CODEOWNERS and GitHub Actions workflows have been made.

I'll provide a more detailed review shortly. Until then, happy reviewing!

A little poem for your coding pleasure:

Code flows like a river,
Tests run, a gentle current,
Bugs swim downstream.

Copy link
Contributor

Gemini encountered an error creating the review. You can try again by commenting @code-review-assist review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: securitycenter Issues related to the Security Command Center API. samples Issues that are directly related to samples.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants