Makes an authenticated request within a workflow, using OAuth 2.0 to stop a Compute Engine instance.
Code sample
YAML
What's next
To search and filter code samples for other Google Cloud products, see the Google Cloud sample browser .
Makes an authenticated request within a workflow, using OAuth 2.0 to stop a Compute Engine instance.
-
initialize
:
assign
:
-
project
:
${sys.get_env("GOOGLE_CLOUD_PROJECT_NUMBER")}
-
zone
:
"us-central1-a"
-
vm_to_stop
:
"examplevm"
-
stop_instance
:
call
:
http.post
args
:
url
:
${"https://compute.googleapis.com/compute/v1/projects/"+project+"/zones/"+zone+"/instances/"+vm_to_stop+"/stop"}
auth
:
type
:
OAuth2
result
:
stop_result
To search and filter code samples for other Google Cloud products, see the Google Cloud sample browser .
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License , and code samples are licensed under the Apache 2.0 License . For details, see the Google Developers Site Policies . Java is a registered trademark of Oracle and/or its affiliates.