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

[FS-1310]Initialize the client library #6

Merged
merged 2 commits into from
Mar 14, 2024
Merged

Conversation

Alva8756
Copy link
Contributor

Initialize the client library interface

type Client interface {
	Version(context.Context) (string, error)
	GetServerComponents(context.Context, string) (ServerComponents, error)
	UpdateInbandInventory(context.Context, string, *common.Device) (string, error)
	UpdateOutOfbandInventory(context.Context, string, *common.Device) (string, error)
}

@Alva8756 Alva8756 changed the base branch from main to vc/query-api March 12, 2024 06:44
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.

Looks good so far. A few comments, some minor changes requested. You can go ahead and nolint:gocritic the lint failure.

pkg/api/client/client.go Outdated Show resolved Hide resolved
pkg/api/client/client.go Show resolved Hide resolved
return client, nil
}

func (c componentInventoryClient) GetServerComponents(ctx context.Context, serverID string) (ServerComponents, error) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is fine for the current iteration. I wonder if there is something in bmc-toolbox/common that would be better than rivets. I'll look into that today.

Copy link
Contributor Author

@Alva8756 Alva8756 Mar 14, 2024

Choose a reason for hiding this comment

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

Thanks!
It looks common.Device can also fit here. Do we want to discard rivets in favor of bmc-toolbox/common?
If this is the case, I will add an util library for converting fleetdb.ServerComponent to common.Device

pkg/api/client/errors.go Outdated Show resolved Hide resolved
pkg/api/client/httpdoer.go Outdated Show resolved Hide resolved
pkg/api/client/httpdoer.go Outdated Show resolved Hide resolved
pkg/api/routes/inventory.go Outdated Show resolved Hide resolved
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.

Awesome. Let's keep moving!

@@ -52,6 +52,11 @@ load-sandbox:
@cp helm/configmap.yaml "${SANDBOX_TEMPLATE_DIR}/cis-configmap.yaml"
@echo "Be sure to do a helm (re)load to get the service started"

## generate mock client
gen-client-mock:
Copy link
Collaborator

Choose a reason for hiding this comment

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

💯

pkg/api/routes/inventory.go Show resolved Hide resolved
@Alva8756 Alva8756 merged commit 87e1a1a into vc/query-api Mar 14, 2024
4 checks passed
@Alva8756 Alva8756 deleted the add-client-api branch March 14, 2024 18:04
@Alva8756 Alva8756 changed the title Initialize the client library [FS-1310]Initialize the client library Apr 2, 2024
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