【发布时间】:2022-06-14 01:11:46
【问题描述】:
我有一个 GCP 服务帐户 JSON 密钥,需要将其转换为 Dataform Credentials Template,如下所述。基本上,换行符必须转换为 \n ,以及更多的转换。有没有简单的方法可以做到这一点?
{
"projectId": "prj-dfad-4curtool-d-c818",
"credentials": "{
"type": "service_account",
"project_id": "prj-xxxx-xxx-x-xxx",
"private_key_id": "35cf...27b",
"private_key": "-----BEGIN PRIVATE KEY-----\nMIIE...ZNwub\n-----END PRIVATE KEY-----\n",
"client_email": "xxx@prj-x-xxx-xxx.iam.gserviceaccount.com",
"client_id": "102742287670708666429",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/xxx@prj-x-xxx-xxx.iam.gserviceaccount.com"
}",
"location": "US"
}
到这样的数据表单凭据
{
"projectId": "prj-dfad-4curtool-d-c818",
"credentials": "{\r\n \"type\": \"service_account\",\r\n \"project_id\": \"prj-xxxx-xxx-x-xxx\",\r\n \"private_key_id\": \"35cf...27b\",\r\n \"private_key\": \"-----BEGIN PRIVATE KEY-----\\nMIIE...ZNwub\\n-----END PRIVATE KEY-----\\n\",\r\n \"client_email\": \"xxx@prj-x-xxx-xxx.iam.gserviceaccount.com\",\r\n \"client_id\": \"102742287670708666429\",\r\n \"auth_uri\": \"https://accounts.google.com/o/oauth2/auth\",\r\n \"token_uri\": \"https://oauth2.googleapis.com/token\",\r\n \"auth_provider_x509_cert_url\": \"https://www.googleapis.com/oauth2/v1/certs\",\r\n \"client_x509_cert_url\": \"https://www.googleapis.com/robot/v1/metadata/x509/xxx@prj-x-xxx-xxx.iam.gserviceaccount.com\"\r\n}\r\n\r\n",
"location": "US"
}
【问题讨论】:
-
不合规?你的错误是什么?
标签: string google-cloud-platform dataform