This function takes JSON data as an input, uses the json and yaml modules to convert JSON data to YAML and then returns with the YAML. Deploy the function, as a Python 3.7 runtime, pasting the following code into the code field:
-
-
Google Cloud Function To Encrypt A JSON Document With An ECC Key
To use this function, create a Google Cloud Function that uses the encrypt_json() function in Google Cloud Console or the gcloud command-line tool. Once created the function, invoke it by sending a POST request to the function’s URL. The request body should contain the JSON document to encrypt. The response body will contain the encrypted JSON document. For example, to encrypt the JSON document my_data.json, you would use the following command: The response body will contain the encrypted JSON document. This function uses the Google Cloud KMS service to encrypt the JSON document. So make sure there’s a KMS key enabled in a project before using the function.