MCPcopy Index your code
hub / github.com/google/adk-python / _validate_gcloud_extra_args

Function _validate_gcloud_extra_args

src/google/adk/cli/cli_deploy.py:408–451  ·  view source on GitHub ↗

Validates that extra gcloud args don't conflict with ADK-managed args. This function dynamically checks for conflicts based on the actual args that ADK will set, rather than using a hardcoded list. Args: extra_gcloud_args: User-provided extra arguments for gcloud. adk_managed_args: S

(
    extra_gcloud_args: Optional[tuple[str, ...]], adk_managed_args: set[str]
)

Source from the content-addressed store, hash-verified

406
407
408def _validate_gcloud_extra_args(
409 extra_gcloud_args: Optional[tuple[str, ...]], adk_managed_args: set[str]
410) -> None:
411 """Validates that extra gcloud args don't conflict with ADK-managed args.
412
413 This function dynamically checks for conflicts based on the actual args
414 that ADK will set, rather than using a hardcoded list.
415
416 Args:
417 extra_gcloud_args: User-provided extra arguments for gcloud.
418 adk_managed_args: Set of argument names that ADK will set automatically.
419 Should include '--' prefix (e.g., '--project').
420
421 Raises:
422 click.ClickException: If any conflicts are found.
423 """
424 if not extra_gcloud_args:
425 return
426
427 # Parse user arguments into a set of argument names for faster lookup
428 user_arg_names = set()
429 for arg in extra_gcloud_args:
430 if arg.startswith('--'):
431 # Handle both '--arg=value' and '--arg value' formats
432 arg_name = arg.split('=')[0]
433 user_arg_names.add(arg_name)
434
435 # Check for conflicts with ADK-managed args
436 conflicts = user_arg_names.intersection(adk_managed_args)
437
438 if conflicts:
439 conflict_list = ', '.join(f"'{arg}'" for arg in sorted(conflicts))
440 if len(conflicts) == 1:
441 raise click.ClickException(
442 f"The argument {conflict_list} conflicts with ADK's automatic"
443 ' configuration. ADK will set this argument automatically, so please'
444 ' remove it from your command.'
445 )
446 else:
447 raise click.ClickException(
448 f"The arguments {conflict_list} conflict with ADK's automatic"
449 ' configuration. ADK will set these arguments automatically, so'
450 ' please remove them from your command.'
451 )
452
453
454def _validate_agent_import(

Callers 2

_mock_to_cloud_runFunction · 0.90
to_cloud_runFunction · 0.85

Calls 4

setFunction · 0.85
splitMethod · 0.80
addMethod · 0.45
joinMethod · 0.45

Tested by 1

_mock_to_cloud_runFunction · 0.72