Use this skill to manage Google Cloud Workload Manager evaluations, rules, scanned resources, and validation results by using public client libraries and the RE
复制下面这句话,粘贴给 Claude Code、Codex、Cursor 等 AI 编程工具,它会读取安装说明并在你确认后完成安装。
请阅读 https://ai.atlankj.com/install/asset/gh-workload-manager-basics-3466020a4a1f ,按照其中的说明把「workload-manager-basics」安装到你(当前 AI 工具)中。执行前先告诉我将运行的命令和写入的位置,等我确认。
查看 AI 将读取的安装说明正在读取 GitHub 原文…
内容来自 GitHub 原始文件,由原作者维护。在 GitHub 查看
Workload Manager validates enterprise workloads against Google Cloud best practices and recommendations. The public client libraries are centered on evaluations: define a resource scope, choose built-in or custom rules, run an evaluation, then inspect results and scanned resources.
flowchart LR
Rules["List rules"] --> Eval["Create or update evaluation"]
Resources["Project, folder, or org scope"] --> Eval
Eval --> Run["Run evaluation"]
Run --> Results["Inspect evaluation results"]
Results --> Remediate["Remediate findings"]
Results --> Export["Optional BigQuery export"]
To ensure compatibility, security, and successful integration:
google-cloud-workloadmanager client library or
the public REST API (workloadmanager.googleapis.com/v1).gcloud workload-manager
CLI command group. Use gcloud only for authentication, IAM role
assignment, and fetching raw REST tokens.Enable the Workload Manager API:
gcloud services enable workloadmanager.googleapis.com --quiet
Authenticate locally using Application Default Credentials (ADC) before using client libraries:
gcloud auth application-default login
Ensure the Workload Manager service agent has the required roles granted in your project (mandatory for API/client library usage, see IAM & Security).
Grant the least-privileged role needed for the task. Start with
roles/workloadmanager.viewer for read-only access to evaluation resources
and use roles/workloadmanager.evaluationAdmin or
roles/workloadmanager.admin only when creating, updating, running, or
deleting evaluations.
Use the Python client library for the first working automation path:
python3 -m pip install --upgrade google-cloud-workloadmanager
from google.cloud import workloadmanager_v1
project_id = "PROJECT_ID"
location = "LOCATION"
parent = f"projects/{project_id}/locations/{location}"
client = workloadmanager_v1.WorkloadManagerClient()
rules = client.list_rules(
request=workloadmanager_v1.ListRulesRequest(
parent=parent,
evaluation_type=workloadmanager_v1.Evaluation.EvaluationType.OTHER,
)
)
for rule in rules.rules:
print(rule.name, rule.display_name, rule.severity)
Core Concepts: Evaluations, rules, results, scanned resources, supported workload types, and API shape.
General Best Practices: Google Cloud
general best-practice posture checks, OTHER evaluation guidance, custom
Rego rules, and scale/automation patterns.
Client Libraries: Python and Go client library examples for listing rules, creating evaluations, running evaluations, and reading findings.
REST Usage: Direct REST examples for the public Workload Manager API and operations polling.
Public CLI Status: No documented
service-specific gcloud workload-manager command group; use gcloud only
for auth, IAM, API enablement, and REST tokens.
Public MCP Status: No documented public Workload Manager MCP server; use client libraries or REST API instead.
Setup Prerequisites: Terraform examples only for adjacent prerequisites such as API enablement, IAM, BigQuery export datasets, and KMS keys. This is not Workload Manager resource management.
IAM & Security: Workload Manager roles, least-privilege guidance, service agents, data handling, and CMEK notes.
If product behavior or API fields are not covered here, check the current Workload Manager product documentation and client library reference before implementing.
search_documents tool.