从 GCP 获取所有项目所有者的列表、文件夹路径

从 GCP 获取所有项目所有者的列表、文件夹路径

我正在尝试获取域中所有 GCP 项目和项目所有者的列表并将其导出到 CSV,我编写了一个脚本,该脚本提供了项目 ID、名称、项目编号、日期和时间的详细信息。但无法获取项目所有者、文件夹路径、成本中心、环境。

#!/bin/bash
> project_data.csv
gcloud projects list --format="value(project_id, name, project_number, project_owner, tags, labels.org,  createTime.date(tz=LOCAL))" >whole_project_details.txt
echo project_id, project_name, project_number, project_owner, project_tag, project_label, project_time >project_data.csv
while read project_details
do
project_id=`echo $project_details | awk '{print $1}'`
project_name=`echo  $project_details | awk '{print $2}'`
project_number=`echo $project_details | awk '{print $3}'`
project_time=`echo $project_details | awk '{print $4}'`
project_owner=`echo $project_details | awk '{print $5}'`
project_label=`echo $project_details | awk '{print $6}'`
project_tag=`echo $project_details | awk '{print $7}'`
echo $project_id, $project_name, $project_number, $project_owner, $project_tag, $project_label, $project_time  >> project_data.csv
done < whole_project_details.txt

请帮帮我,如何获取该数据。因为我是 GCP 平台的新手。

相关内容