From 8c5c06eaf921ebec17501792df790949e026d997 Mon Sep 17 00:00:00 2001 From: Josh Kayani Date: Thu, 30 Dec 2021 12:04:02 -0500 Subject: [PATCH] fix: IBM SM SDK removed CertificateSecretData struct --- pkg/backends/ibmsecretsmanager.go | 7 ++----- pkg/backends/ibmsecretsmanager_test.go | 4 ++-- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/pkg/backends/ibmsecretsmanager.go b/pkg/backends/ibmsecretsmanager.go index 55a29ccb..8860032b 100644 --- a/pkg/backends/ibmsecretsmanager.go +++ b/pkg/backends/ibmsecretsmanager.go @@ -1,7 +1,7 @@ package backends import ( - "encoding/json" + // "encoding/json" "fmt" "regexp" "sync" @@ -63,10 +63,7 @@ func (i *IBMSecretsManager) getSecretVersionedOrNot(secret *ibmsm.SecretResource return nil, fmt.Errorf("Could not retrieve secret %s after %d retries, statuscode %d", *secret.ID, types.IBMMaxRetries, httpResponse.GetStatusCode()) } - // Versioned certificate secret_data comes back in a special struct and we want a map - certData := (secretVersion.Resources[0].(*ibmsm.SecretVersion)).SecretData - certJson, _ := json.Marshal(&certData) - _ = json.Unmarshal(certJson, &result) + result = (secretVersion.Resources[0].(*ibmsm.SecretVersion)).SecretData.(map[string]interface{}) } else { secretRes, httpResponse, err := i.Client.GetSecret(&ibmsm.GetSecretOptions{ SecretType: secret.SecretType, diff --git a/pkg/backends/ibmsecretsmanager_test.go b/pkg/backends/ibmsecretsmanager_test.go index 58abb992..d22a73dd 100644 --- a/pkg/backends/ibmsecretsmanager_test.go +++ b/pkg/backends/ibmsecretsmanager_test.go @@ -150,8 +150,8 @@ func (m *MockIBMSMClient) GetSecretVersion(getSecretOptions *ibmsm.GetSecretVers Resources: []ibmsm.SecretVersionIntf{ &ibmsm.SecretVersion{ ID: &id, - SecretData: &ibmsm.CertificateSecretData{ - Certificate: &data, + SecretData: map[string]interface{}{ + "certificate": data, }, }, },