From c965c21ba481ae71a8e28f59d93899bceff016ab Mon Sep 17 00:00:00 2001 From: Mahesh N Date: Mon, 4 Nov 2024 16:58:17 +0530 Subject: [PATCH] update morpheus datastore --- internal/cmp/helper.go | 14 +++++++++----- internal/cmp/morpheus_datasource_broker.go | 2 +- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/internal/cmp/helper.go b/internal/cmp/helper.go index ad192da9..381f6185 100644 --- a/internal/cmp/helper.go +++ b/internal/cmp/helper.go @@ -4,19 +4,23 @@ package cmp import ( "context" + "log" "strconv" "strings" "github.com/HewlettPackard/hpegl-vmaas-cmp-go-sdk/pkg/client" + "github.com/HewlettPackard/hpegl-vmaas-terraform-resources/pkg/auth" ) func setMeta(meta interface{}, apiClient client.APIClientHandler) { - // Not needed when not using wrapper + // Not needed while using cmp directly - // err := apiClient.SetMeta(meta, auth.SetScmClientToken) - // if err != nil { - // log.Printf("[ERROR] error while setting meta information for cmp-sdk, error: %v", err) - // } +} +func setMetaHpegl(meta interface{}, apiClient client.APIClientHandler) { + err := apiClient.SetMeta(meta, auth.SetScmClientToken) + if err != nil { + log.Printf("[ERROR] error while setting meta information for cmp-sdk, error: %v", err) + } } func ParseVersion(version string) (int, error) { diff --git a/internal/cmp/morpheus_datasource_broker.go b/internal/cmp/morpheus_datasource_broker.go index f7319d56..bef005bc 100644 --- a/internal/cmp/morpheus_datasource_broker.go +++ b/internal/cmp/morpheus_datasource_broker.go @@ -23,7 +23,7 @@ func newMorpheusBroker(bClient *client.BrokerAPIService) *morpheusBroker { // Read reads the morpheus details using the Broker API func (m *morpheusBroker) Read(ctx context.Context, d *utils.Data, meta interface{}) error { - setMeta(meta, m.bClient.Client) + setMetaHpegl(meta, m.bClient.Client) // Get Morpheus Tokens and URL morpheusDetails, err := m.bClient.GetMorpheusDetails(ctx)