Skip to content

Conversation

@abhay-nutanix
Copy link
Contributor

@abhay-nutanix abhay-nutanix commented Dec 31, 2025

refactor: migration nutanix API to v4

abhay-nutanix and others added 2 commits December 31, 2025 14:48
…m Central version

- Replace GetCurrentLoggedInUser() with ValidateCredentials() using Users.List()
- Replace V3 GetPrismCentral() with DomainManager.GetPrismCentralVersion()
- Remove V3 client dependency from newClient()
- Update tests to use new ValidateCredentials interface
@@ -0,0 +1,32 @@
package nutanix
Copy link
Contributor

Choose a reason for hiding this comment

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

🚫 [golangci-lint] reported by reviewdog 🐶
: # github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/webhook/preflight/nutanix [github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/webhook/preflight/nutanix.test]

ValidateCredentialsFunc: func(ctx context.Context) error {
// Use Users.List() as a lightweight API call to validate credentials.
// This is available to all users and serves the same purpose as V3's GetCurrentLoggedInUser.
_, err := convergedc.Users.List(ctx, converged.WithLimit(1))
Copy link
Contributor

Choose a reason for hiding this comment

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

🚫 [golangci-lint] reported by reviewdog 🐶
convergedc.Users undefined (type *"github.com/nutanix-cloud-native/prism-go-client/converged/v4".Client has no field or method Users)

GetPrismCentralVersionFunc: func(ctx context.Context) (string, error) {
pcInfo, err := v3c.V3.GetPrismCentral(ctx)
// Use DomainManager.GetPrismCentralVersion() as V4 equivalent to V3's GetPrismCentral().
return convergedc.DomainManager.GetPrismCentralVersion(ctx)
Copy link
Contributor

Choose a reason for hiding this comment

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

🚫 [golangci-lint] reported by reviewdog 🐶
convergedc.DomainManager undefined (type *"github.com/nutanix-cloud-native/prism-go-client/converged/v4".Client has no field or method DomainManager) (typecheck)

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.

3 participants