Skip to content

Commit

Permalink
fix: IBM SM SDK removed CertificateSecretData struct
Browse files Browse the repository at this point in the history
  • Loading branch information
jkayani committed Dec 30, 2021
1 parent 39b3788 commit 8c5c06e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
7 changes: 2 additions & 5 deletions pkg/backends/ibmsecretsmanager.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package backends

import (
"encoding/json"
// "encoding/json"
"fmt"
"regexp"
"sync"
Expand Down Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions pkg/backends/ibmsecretsmanager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
},
},
Expand Down

0 comments on commit 8c5c06e

Please sign in to comment.