Skip to content

Commit

Permalink
chore(python): Add example of using client_options for regional endpo…
Browse files Browse the repository at this point in the history
…ints (#316)

* Add example of using client_options for regional endpoints

* Add example of using client_options for regional endpoints

* Add example of using client_options for regional endpoints

* Add example of using client_options for regional endpoints

Co-authored-by: Aaron Gabriel Neyer <aarongabriel@google.com>
  • Loading branch information
2 people authored and dandhlee committed Nov 9, 2022
1 parent a02ffc2 commit b3e6200
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions cloudbuild/snippets/quickstart.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,19 @@ def quickstart():
print the in-progress status and print the completed status."""

# Authorize the client with Google defaults
# If you're using Private Pools, add a regional `api_endpoint` to `CloudBuildClient()`
# For example, '<YOUR_POOL_REGION>-cloudbuild.googleapis.com'
credentials, project_id = google.auth.default()
client = cloudbuild_v1.services.cloud_build.CloudBuildClient()

# If you're using Private Pools or a non-global default pool, add a regional
# `api_endpoint` to `CloudBuildClient()`
# For example, '<YOUR_POOL_REGION>-cloudbuild.googleapis.com'
#
# from google.api_core import client_options
# client_options = client_options.ClientOptions(
# api_endpoint="us-central1-cloudbuild.googleapis.com"
# )
# client = cloudbuild_v1.services.cloud_build.CloudBuildClient(client_options=client_options)

build = cloudbuild_v1.Build()

# The following build steps will output "hello world"
Expand Down

0 comments on commit b3e6200

Please sign in to comment.