Skip to content

Commit e833995

Browse files
wukathcopybara-github
authored andcommitted
fix: Update expressmode api call to include default api key param
Express mode API was updated to require "get_default_api_key: True" for returning api key Co-authored-by: Kathy Wu <wukathy@google.com> PiperOrigin-RevId: 912153767
1 parent 0bc767e commit e833995

2 files changed

Lines changed: 14 additions & 2 deletions

File tree

src/google/adk/cli/utils/gcp_utils.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,11 @@ def sign_up_express(
139139
"POST",
140140
":signUp",
141141
location=location,
142-
data={"region": location, "tos_accepted": True},
142+
data={
143+
"region": location,
144+
"tos_accepted": True,
145+
"get_default_api_key": True,
146+
},
143147
)
144148
return {
145149
"project_id": project.get("projectId"),

tests/unittests/cli/utils/test_gcp_utils.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,11 +126,19 @@ def test_sign_up_express(self, mock_auth_default, mock_session_cls):
126126
result = gcp_utils.sign_up_express()
127127
self.assertEqual(result["project_id"], "new-project")
128128
self.assertEqual(result["api_key"], "new-api-key")
129-
args, _ = mock_session.post.call_args
129+
args, kwargs = mock_session.post.call_args
130130
self.assertEqual(
131131
args[0],
132132
"https://us-central1-aiplatform.googleapis.com/v1beta1/vertexExpress:signUp",
133133
)
134+
self.assertEqual(
135+
kwargs["json"],
136+
{
137+
"region": "us-central1",
138+
"tos_accepted": True,
139+
"get_default_api_key": True,
140+
},
141+
)
134142

135143
@mock.patch(
136144
"google.adk.cli.utils.gcp_utils.resourcemanager_v3.ProjectsClient"

0 commit comments

Comments
 (0)