I am using oci go sdk to access the secrets in oci. I get the SecretBundleResponse object but I want to extract the "Content" field which is present in resp.SecretBundleContent. There are no apis available on that object to extract it. Any help? I am using https://docs.oracle.com/en-us/iaas/api/#/en/secretretrieval/20190301/SecretBundle/GetSecretBundle
req := secrets.GetSecretBundleRequest{
SecretId: common.String(secretID),
Stage: secrets.GetSecretBundleStageCurrent,
}
// Send the request using the service client
resp, err := client.GetSecretBundle(context.Background(), req)
if err != nil {
log.Println("Unable to get secrete bundle: ", err)
return ""
}
log.Println("secret bundle resp Secret Bundle content", resp.SecretBundleContent)
// secret bundle resp Secret Bundle content { Content=MyContent }
Received response from Oracle internal slack channel with the solution. It seems I need to cast SecretBundleContent using Base64SecretBundleContentDetails type to access it's fields.
var content string
base64Details, ok := resp.SecretBundleContent.(secrets.Base64SecretBundleContentDetails)
if ok {
log.Println("base64 content details", *base64Details.Content)
content = *base64Details.Content
}