gcloud supports scripting with --format
option and gcloud services enable --async
returns a command that could be used to wait till the operation is completed.
E.g. the following call gcloud services disable servicenetworking.googleapis.com --async
may return smth like:
Asynchronous operation is in progress... Use the following command to wait for its completion:
gcloud beta services operations wait operations/acf.<UID>
The problem here is that the output is returned as 2 rows and is not that easy to include into automated scripts. The first idea is to use the --format
option with smth like --format=json
and use jq
afterward, but the --format=json
just does nothing for the gcloud services enable/disable
, it always returns []
.