Files
wehub-resource-sync 4b6817381b
CI (OpenClaw E2E) / openclaw test (push) Has been cancelled
CI / coverage-report (push) Has been cancelled
CI / test-kubernetes (push) Has been cancelled
CI / should-run-thorough (push) Has been cancelled
CI / test-thorough (cloudwatch-demo) (push) Has been cancelled
CI / test-thorough (flink-ecs) (push) Has been cancelled
CI / test-thorough (upstream-lambda) (push) Has been cancelled
CI / test-thorough (prefect-ecs-fargate) (push) Has been cancelled
Release / build-binaries (zip, opensre.exe, onefile, windows-latest, windows-x64) (push) Has been cancelled
Benchmark image — build + push to ECR (any adapter) / build + push (push) Has been cancelled
CI / quality (ubuntu-latest) (push) Has been cancelled
CI / test (tools-runtime) (push) Has been cancelled
CI / test (e2e-general) (push) Has been cancelled
CI / test (cli-runtime) (push) Has been cancelled
CI / test (e2e-provider-and-openclaw) (push) Has been cancelled
CI / test (integrations-and-misc) (push) Has been cancelled
Release / verify (push) Has been cancelled
Release / build-python-dist (push) Has been cancelled
Release / build-binaries (tar.gz, opensre, onedir, macos-15-intel, darwin-x64) (push) Has been cancelled
Release / build-binaries (tar.gz, opensre, onedir, macos-latest, darwin-arm64) (push) Has been cancelled
Release / build-binaries (tar.gz, opensre, onedir, ubuntu-22.04, linux-x64) (push) Has been cancelled
Release / publish-release (push) Has been cancelled
Release / publish-main-release (push) Has been cancelled
Interactive Shell Live (PR + post-merge) / turn-checks (no-LLM) (push) Has been cancelled
CodeQL / Analyze (python) (push) Has been cancelled
Interactive Shell Live (PR + post-merge) / turn-live shard ${{ matrix.shard_index }} (push) Has been cancelled
Release / prepare (push) Has been cancelled
Release / build-binaries (tar.gz, opensre, onedir, ubuntu-22.04-arm, linux-arm64) (push) Has been cancelled
Synthetic Deterministic Tests / Synthetic offline (deterministic) (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 13:10:45 +08:00

86 lines
2.9 KiB
Python

"""AWS SDK generic operation tool."""
from __future__ import annotations
from typing import Any
from core.tool_framework.tool_decorator import tool
from integrations.aws.aws_sdk_client import execute_aws_sdk_call
def _aws_operation_never_auto_available(_sources: dict[str, dict]) -> bool:
# Disabled for automatic planning until service/operation can be safely derived from context.
return False
@tool(
name="execute_aws_operation",
source="aws_sdk",
description="Execute any read-only AWS SDK operation for investigation.",
use_cases=[
"Checking ECS task status and health (ecs.describe_tasks)",
"Inspecting RDS database configuration (rds.describe_db_instances)",
"Reviewing VPC networking setup (ec2.describe_vpcs)",
"Examining IAM role permissions (iam.get_role)",
"Investigating EC2 instance state (ec2.describe_instances)",
"Querying CloudFormation stack details (cloudformation.describe_stacks)",
"Checking EFS mount targets (efs.describe_mount_targets)",
"Reviewing Systems Manager parameters (ssm.get_parameter)",
"Inspecting Step Functions executions (stepfunctions.describe_execution)",
"Checking Secrets Manager secrets metadata (secretsmanager.describe_secret)",
],
requires=["service", "operation"],
input_schema={
"type": "object",
"properties": {
"service": {
"type": "string",
"description": "AWS service name (e.g., 'ecs', 'rds', 'ec2', 'lambda')",
},
"operation": {
"type": "string",
"description": "Operation name (e.g., 'describe_tasks', 'get_role')",
},
"parameters": {"type": "object", "description": "Operation parameters as dict"},
},
"required": ["service", "operation"],
},
is_available=_aws_operation_never_auto_available,
)
def execute_aws_operation(
service: str,
operation: str,
parameters: dict[str, Any] | None = None,
) -> dict:
"""Execute any read-only AWS SDK operation for investigation."""
if not service or not operation:
return {
"found": False,
"error": "service and operation are required",
"service": service,
"operation": operation,
}
result = execute_aws_sdk_call(
service_name=service,
operation_name=operation,
parameters=parameters,
)
if not result.get("success"):
return {
"found": False,
"service": service,
"operation": operation,
"error": result.get("error", "Unknown error"),
"metadata": result.get("metadata", {}),
}
return {
"found": True,
"service": service,
"operation": operation,
"result": result.get("data", {}),
"metadata": result.get("metadata", {}),
}