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

fix: reduce component API usage #1542

Merged
merged 1 commit into from
Feb 20, 2024

Conversation

jon-stewart
Copy link
Contributor

Summary

Every lacework component list makes N+1 API calls: API list all components, and for N components API list all versions.

This PR proposes to fix this by only calling the list all versions API endpoint when a users runs lacework component show. This means that lacework component list is a single API call, and lacework component show is 2 API calls.

The catch is that a user will only see the Tainted status after they run lacework component show. Until they run that command, the version will be Update Available.

How did you test this change?

> bin/lacework component list
       STATUS                 NAME             VERSION                  DESCRIPTION
-------------------+-------------------------+---------+--------------------------------------------
  Update Available   component-example         0.6.0     Component description

> bin/lacework component show component-example
          STATUS                  NAME          VERSION        DESCRIPTION
--------------------------+-------------------+---------+------------------------
  Tainted (Please update)   component-example   0.6.0     Component description

The following versions of this component are available to install:
 - 0.8.0
 - 0.8.1
 - 0.8.2

The currently installed version 0.6.0 is no longer available to install.

> bin/lacework component list
          STATUS                     NAME             VERSION                  DESCRIPTION
--------------------------+-------------------------+---------+--------------------------------------------
  Tainted (Please update)   component-example         0.6.0     Component description

Issue

https://lacework.atlassian.net/browse/GROW-2771

@jon-stewart jon-stewart self-assigned this Feb 20, 2024
@jon-stewart jon-stewart requested a review from a team as a code owner February 20, 2024 11:54
@jon-stewart jon-stewart changed the title fix(GROW-2771): reduce component API usage fix: reduce component API usage Feb 20, 2024
@jon-stewart jon-stewart force-pushed the jon-stewart/GROW-2771/cdk-reduce-api-calls branch from 8161d9e to 00118de Compare February 20, 2024 12:08
@jon-stewart jon-stewart merged commit 5455e17 into main Feb 20, 2024
7 checks passed
@jon-stewart jon-stewart deleted the jon-stewart/GROW-2771/cdk-reduce-api-calls branch February 20, 2024 14:49
@lacework-releng lacework-releng mentioned this pull request Feb 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants