搜索安全群组

本页面介绍如何使用 Cloud Identity Groups API 来查找所有安全群组。

REST

如需搜索所有安全群组,请使用查询字符串 labels:cloudidentity.googleapis.com/groups.security 调用 groups.search()

Python

以下示例展示了使用 Python 客户端库搜索安全组的辅助函数:

def search_security_groups(service, identity_source_id, pageSize, view):
  # Set the label to search for all Google groups
  searchQuery = "&query=parent=='customers/{customer_id}'&&labels:cloudidentity.googleapis.com/groups.security" \
    + "&pageSize=" + pageSize + "&view=" + view
  try:
    searchGroupsRequest = service.groups().search()
    searchGroupsRequest.uri += searchQuery
    response = searchGroupsRequest.execute()
    print(response)
  except Exception as e:
    print(e)