Searching for security groups
This page explains how to find all of your security groups with the Cloud Identity Groups API.
REST
To search for all security groups, call groups.search()
with a query string of labels:cloudidentity.googleapis.com/groups.security
.
Python
The following example shows a helper function to search for security groups using the Python client library:
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
)

