0

使用秘密管理器时,响应是base64 编码的。如何解码它?

sendGridSend: 
   steps:    
   - getSecret:    
       call: http.get    
       args:    
           url: ${"https://secretmanager.googleapis.com/v1/projects/" + sys.get_env("GOOGLE_CLOUD_PROJECT_NUMBER") + "/secrets/" + secret + "/versions/latest:access"}    
           auth:    
               type: OAuth2    
       result: secretBase64Payload
4

1 回答 1

2

就像下面的代码片段一样,使用base64.decode. 由于该产品刚刚结束 alpha,因此还没有链接到可用功能的文档页面。

sendGridSend: 
   params: [secret, from, to, subject, content, contentType]    
   steps:    
   - getSecret:    
       call: http.get    
       args:    
           url: ${"https://secretmanager.googleapis.com/v1/projects/" + sys.get_env("GOOGLE_CLOUD_PROJECT_NUMBER") + "/secrets/" + secret + "/versions/latest:access"}    
           auth:    
               type: OAuth2    
       result: sendGridKey    
   - decodeSecrets:    
       assign:    
       - decodedKey: ${text.decode(base64.decode(sendGridKey.body.payload.data))}
于 2020-11-12T13:37:48.083 回答