Using gcloud alpha services It's now perfectly possible to generate keys programatically:
gcloud alpha services api-keys create
I can then enable the Maps JavaScript API using
gcloud services enable maps-backend.googleapis.com
At this point I need to set some HTTP referrer restrictions on that key but the services api-keys update
command only updates an API key's metadata.
How do I proceed?
It looks (haven't tried the API) as though you can do this at
create
andupdate
with--allowed-referrers
:https://cloud.google.com/sdk/gcloud/reference/alpha/services/api-keys/create
https://cloud.google.com/sdk/gcloud/reference/alpha/services/api-keys/update