Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Ricerca di gruppi di sicurezza
Questa pagina spiega come trovare tutti i gruppi di sicurezza con l'API Cloud Identity Groups.
REST
Per cercare tutti i gruppi di sicurezza, chiama
groups.search()
con una stringa di query labels:cloudidentity.googleapis.com/groups.security.
Python
L'esempio seguente mostra una funzione di supporto per la ricerca di gruppi di sicurezza
utilizzando la libreria client Python:
defsearch_security_groups(service,identity_source_id,pageSize,view):# Set the label to search for all Google groupssearchQuery="&query=parent=='customers/{customer_id}'&&labels:cloudidentity.googleapis.com/groups.security" \
+"&pageSize="+pageSize+"&view="+viewtry:searchGroupsRequest=service.groups().search()searchGroupsRequest.uri+=searchQueryresponse=searchGroupsRequest.execute()print(response)exceptExceptionase:print(e)
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Difficile da capire","hardToUnderstand","thumb-down"],["Informazioni o codice di esempio errati","incorrectInformationOrSampleCode","thumb-down"],["Mancano le informazioni o gli esempi di cui ho bisogno","missingTheInformationSamplesINeed","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Altra","otherDown","thumb-down"]],["Ultimo aggiornamento 2025-09-04 UTC."],[[["\u003cp\u003eThis page outlines the process of finding all security groups using the Cloud Identity Groups API.\u003c/p\u003e\n"],["\u003cp\u003eUtilize the \u003ccode\u003egroups.search()\u003c/code\u003e method in the API with the query string \u003ccode\u003elabels:cloudidentity.googleapis.com/groups.security\u003c/code\u003e to search for security groups.\u003c/p\u003e\n"],["\u003cp\u003eWhen using methods that require the \u003ccode\u003ecustomer_id\u003c/code\u003e, ensure it is prepended with "C", like in the example 'C046psxkn'.\u003c/p\u003e\n"],["\u003cp\u003eThe Python example demonstrates a helper function that can be used to search for all security groups, specifying a customer ID and security label.\u003c/p\u003e\n"]]],[],null,["# Searching for security groups\n=============================\n\nThis page explains how to find all of your security groups with the\nCloud Identity Groups API.\n**Note:** When a method requires the `customer_id`, you must prepend a \"C\" to the ID that you can view in the Google Admin console (for example, 'C046psxkn'). \n\n### REST\n\nTo search for all security groups, call\n[`groups.search()`](/identity/docs/reference/rest/v1/groups/search)\nwith a query string of `labels:cloudidentity.googleapis.com/groups.security`.\n\n### Python\n\nThe following example shows a helper function to search for security groups\nusing the Python client library: \n\n def search_security_groups(service, identity_source_id, pageSize, view):\n # Set the label to search for all Google groups\n searchQuery = \"&query=parent=='customers/{customer_id}'&&labels:cloudidentity.googleapis.com/groups.security\" \\\n + \"&pageSize=\" + pageSize + \"&view=\" + view\n try:\n searchGroupsRequest = service.groups().search()\n searchGroupsRequest.uri += searchQuery\n response = searchGroupsRequest.execute()\n print(response)\n except Exception as e:\n print(e)"]]