# NOT RUN {
# for unauthenticated apps create a HttpTarget
run_me <- HttpTarget(
uri = "https://public-ewjogewawq-ew.a.run.app/echo?msg=blah",
http_method = "GET"
)
cr_schedule("cloud-run-scheduled",
schedule = "16 4 * * *",
httpTarget = run_me
)
# for authenticated Cloud Run apps - create with allowUnauthenticated=FALSE
cr_deploy_run("my-app", allowUnauthenticated = TRUE)
# }
# NOT RUN {
# deploying via R will help create a service email called my-app-cloudrun-invoker
cr_run_email("my-app")
# }
# NOT RUN {
# use that email to schedule the Cloud Run private micro-service
# schedule the endpoint
my_run_name <- "my-app"
my_app <- cr_run_get(my_run_name)
email <- cr_run_email(my_run_name)
endpoint <- paste0(my_app$status$url, "/fetch_stuff")
app_sched <- cr_run_schedule_http(endpoint,
http_method = "GET",
email = email
)
cr_schedule("cloud-run-scheduled-1",
schedule = "4 16 * * *",
httpTarget = app_sched
)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab