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 authored and werne2j committed Jan 4, 2022
1 parent 6dafe06 commit 87ae722
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
6 changes: 1 addition & 5 deletions pkg/backends/ibmsecretsmanager.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package backends

import (
"encoding/json"
"fmt"
"regexp"
"sync"
Expand Down Expand Up @@ -63,10 +62,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 87ae722

Please sign in to comment.