I have a python cloud run function and I want to get the URL of another cloud run function programatically. I want to avoid hard coding the URL if possible. I need the URL so that I can create a task that has this other functions url as the HTTP url, and then send that task to a task queue.
I have a python cloud run function and I want to get the URL of another cloud run function programatically. I want to avoid hard coding the URL if possible. I need the URL so that I can create a task that has this other functions url as the HTTP url, and then send that task to a task queue.
Share Improve this question edited Mar 26 at 18:29 yambo asked Mar 26 at 6:49 yamboyambo 1,8503 gold badges22 silver badges42 bronze badges 1- Depending of your context... might not work your particular case, but can that 'another cloud function' URL be provided as an environment variable value during the deployment of your main cloud function? – al-dann Commented Mar 26 at 9:31
1 Answer
Reset to default 0Yes, it is possible to obtain the URL of another Cloud Run function from a Cloud Run function itself.
If you know the name of the Cloud Run function, you can use the Deterministic URL approach. This allows you to determine the URL of the function by simply filling in the necessary details. This information is available even before the function is created.
To get the URL programmatically, you can utilize the Cloud Functions Python library get_function to retrieve the details of another Cloud Run function. However, ensure that the Cloud Run function's identity service account has the Cloud Functions Viewer Role when making the request using this library, as it requires run.services.get
or cloudfunctions.functions.get
permissions.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744161000a4561089.html
评论列表(0条)