Skip to content
This repository has been archived by the owner on Jul 18, 2024. It is now read-only.

Forward Inventory to FleetDB #19

Merged
merged 2 commits into from
Apr 25, 2024
Merged

Forward Inventory to FleetDB #19

merged 2 commits into from
Apr 25, 2024

Conversation

Alva8756
Copy link
Contributor

What does this PR do

@Alva8756 Alva8756 requested a review from DoctorVin April 23, 2024 04:35
@Alva8756 Alva8756 marked this pull request as ready for review April 23, 2024 05:13
Copy link
Collaborator

@DoctorVin DoctorVin left a comment

Choose a reason for hiding this comment

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

My biggest criticism is that checking the types at runtime on each inventory. I think that will be more trouble than it's worth. It's OK for now, but when Joel lands that bmc-toolbox PR, we should use that instead. Getting the slug from the name is just a matter of down-casing.

@@ -31,13 +29,27 @@ func NewFleetDBClient(cfg *app.Configuration) (Client, error) {
client.SetToken(cfg.FleetDBToken)
}

slugs := make(map[string]*fleetdb.ServerComponentType)
serverComponentTypes, _, err := client.ListServerComponentTypes(ctx, nil)
Copy link
Collaborator

Choose a reason for hiding this comment

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

We're looking for component type names here, right? If so, we should probably get them from bmc-toolbox/common. Joel has a PR that should make this easier.

If you need the type-id I'd like to explore that a bit. I want to keep those sorts of details private to FleetDB.

internal/fleetdb/fleetdb.go Outdated Show resolved Hide resolved
internal/fleetdb/fleetdb.go Outdated Show resolved Hide resolved
internal/fleetdb/fleetdb.go Outdated Show resolved Hide resolved
internal/fleetdb/fleetdb.go Outdated Show resolved Hide resolved
}
}
}

func TestFetchServerComponents(t *testing.T) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think going to a compile-time list instead of a runtime one will make this a lot simpler.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi Vince,
Can you please help provide more details about it? I am not sure what I need to do here.
By the way, I have verified the latest version of this PR in sandbox(alloy -> CIS -> fleetdb)

@Alva8756 Alva8756 merged commit c7dd9b1 into vc/query-api Apr 25, 2024
4 checks passed
@Alva8756 Alva8756 deleted the fs-1376-2 branch April 25, 2024 05:19
DoctorVin added a commit that referenced this pull request May 1, 2024
* add README

* add a client API to fetch server components

* add inventory api placeholder functions

Add in API endpoints and the beginning of handler functions for
converting incoming common.Device objects into FleetDB server records.

* Initialize the client library (#6)

* initialize the client library

* refactor minor

* internal fleetdb outline (#9)

* Move types ownership to alloy (#11)

* fix panic when there's no response (#12)

* Convert Alloy Data to Rivets.Server (#16)

* type converter

* typo

* Forward Inventory to FleetDB (#19)

* forward inventory to fleetdb

* cleanup code

* rebase (#20)

* use bmc-toolbox component types (#21)

* update dependencies

---------

Co-authored-by: Alva Zhang <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants