【问题标题】:How to list group ids in GCP using cli or console如何使用 cli 或控制台在 GCP 中列出组 ID
【发布时间】:2021-10-25 06:24:23
【问题描述】:

我想知道是否有任何方法可以使用 CLI 或云控制台获取组 ID?使用此 ID,我需要使用 Cloud API 收集成员列表。我正在浏览谷歌文档,但我找不到它。

例如,如果我使用:

gcloud identity groups memberships list --group-email=abc@xyz.com

它给出了组 ID。然后我使用this doc 来获取成员列表。

【问题讨论】:

标签: google-cloud-platform google-iam google-groups-api


【解决方案1】:

如果您可以使用 Google 的 SDK 工具 gcloud,那么您可以按照以下方式进行:

组的 ID 是它的实际电子邮件地址 - 您可以在下面看到它:

wb@cloudshell:~ $ gcloud identity groups describe esa111@google.com
createTime: '2021-10-12T09:13:16.737141Z'
description: test group
displayName: esa111
groupKey:
  id: esa111@google.com
labels:
  cloudidentity.googleapis.com/groups.discussion_forum: ''
name: groups/00rj4333f0glbwez
parent: customers/Cx2hsdde9nw
updateTime: '2021-10-12T09:13:16.737141Z'

获取成员列表:

wb@cloudshell:~ $ gcloud identity groups memberships list --group-email=esa111@google.com
---
name: groups/00rj4333f0glbwez/memberships/129543432329845052
preferredMemberKey:
  id: esa222@google.com
roles:
- name: MEMBER
---
name: groups/00rj4333f0glbwez/memberships/11674834e3327905886
preferredMemberKey:
  id: esa111@google.com
roles:
- name: OWNER
- name: MEMBER

如果只列出组的成员 ID,请使用 grep,您将获得:

wb@cloudshell:~ $ gcloud identity groups memberships list --group-email=esa111@google.com | grep id:
  id: esa222@google.com
  id: esa111@google.com

这里有一些关于 gcloud identity groups describelist 命令的文档。

【讨论】:

    猜你喜欢
    • 2020-12-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-12-06
    • 2021-10-16
    • 2011-04-09
    • 2022-06-20
    • 1970-01-01
    相关资源
    最近更新 更多