Mantenha tudo organizado com as coleções
Salve e categorize o conteúdo com base nas suas preferências.
Como criar e pesquisar grupos com identidades mapeadas
Nesta página, você aprenderá a criar e pesquisar grupos com identidades mapeadas. Um
grupo de identidade é um tipo de grupo que espelha um grupo em uma fonte
de identidade externa, como um grupo do Active Directory. Esses grupos são usados
ao criar um conector de identidade para o Google Cloud Search.
Para criar um grupo mapeado por identidade, chame
groups.create()
com uma instância do novo grupo. A instância do grupo precisa incluir groupKey,
Parent e label definidos como system/groups/external. O groupKey é uma
combinação de namespace e groupId que identifica exclusivamente o grupo.
Python
No exemplo a seguir, mostramos uma função auxiliar para criar um grupo de identidade usando a
biblioteca de cliente do Python: Use o ID da origem de identidade, gerado ao
criar a origem de identidade no Google Admin Console, para chamar a função
auxiliar e criar um grupo:
defcreate_identity_group(service,identity_source_id,group_id,group_display_name,group_description):namespace="identitysources/"+identity_source_idgroup_key={"id":group_id,"namespace":namespace}group={"parent":namespace,"description":group_description,"displayName":group_display_name,"groupKey":group_key,"labels":{# Set the label to specify creation of an identity group."system/groups/external":""}}try:response=service.groups().create(body=group).execute()printresponseexceptException,e:printemyNewGroup=create_identity_group(idSvc,"ABC1234","zebra","Zebra external group","The Zebra group is an identity group representing the Zoolandexternalidentity")
Ao fornecer o namespace, você não sofrerá conflitos de nomenclatura
e coloca o grupo com identidades mapeadas no contexto apropriado de outros grupos da
mesma origem de identidade externa.
Como pesquisar grupos com identidades mapeadas
REST
Para pesquisar grupos mapeados por identidade, chame
groups.search()
com uma string de consulta. Para pesquisar todos os grupos, só é necessário fornecer o rótulo
system/groups/external.
Python
No exemplo a seguir, mostramos uma função auxiliar usada para
pesquisar grupos com identidades mapeadas usando a biblioteca de cliente do Python:
defsearch_identity_groups(service,identity_source_id,pageSize,view):# Set the label to search for all identity groupssearchQuery="&query=namespace=identitysources/"+identity_source_id \
+"%20AND%20"+"labels:system/groups/external" \
+"&pageSize="+pageSize+"&view="+viewtry:searchGroupsRequest=service.groups().search()searchGroupsRequest.uri+=searchQueryresponse=searchGroupsRequest.execute()printresponseexceptException,e:printe
[[["Fácil de entender","easyToUnderstand","thumb-up"],["Meu problema foi resolvido","solvedMyProblem","thumb-up"],["Outro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Informações incorretas ou exemplo de código","incorrectInformationOrSampleCode","thumb-down"],["Não contém as informações/amostras de que eu preciso","missingTheInformationSamplesINeed","thumb-down"],["Problema na tradução","translationIssue","thumb-down"],["Outro","otherDown","thumb-down"]],["Última atualização 2025-08-18 UTC."],[[["\u003cp\u003eIdentity-mapped groups mirror groups in external identity sources like Active Directory and are used when creating an identity connector for Google Cloud Search.\u003c/p\u003e\n"],["\u003cp\u003eCreating an identity-mapped group involves using the \u003ccode\u003egroups.create()\u003c/code\u003e API method and providing a \u003ccode\u003egroupKey\u003c/code\u003e, \u003ccode\u003eParent\u003c/code\u003e, and \u003ccode\u003elabel\u003c/code\u003e set to \u003ccode\u003esystem/groups/external\u003c/code\u003e, with the \u003ccode\u003egroupKey\u003c/code\u003e uniquely identifying the group through a \u003ccode\u003enamespace\u003c/code\u003e and \u003ccode\u003egroupId\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eWhen creating the identity group using Python, the namespace must be included to avoid naming conflicts and to ensure the group is in the proper context of the external identity source.\u003c/p\u003e\n"],["\u003cp\u003eSearching for identity-mapped groups is done via the \u003ccode\u003egroups.search()\u003c/code\u003e API method, where providing the \u003ccode\u003esystem/groups/external\u003c/code\u003e label will return all such groups.\u003c/p\u003e\n"],["\u003cp\u003eAfter creating an identity group, the next step is to create memberships, using the procedures described in "Managing identity-mapped group memberships".\u003c/p\u003e\n"]]],[],null,["# Creating and searching for identity-mapped groups\n=================================================\n\nThis page explains how to create and search for *identity-mapped groups*. An\nidentity-mapped group is a type of group that mirrors a group in an\nexternal identity source, such as an Active Directory group. Identity-mapped\ngroups are used when creating an identity connector for Google Cloud Search.\n\nFor more information about identity-mapped groups, see\n[Groups API overview](/identity/docs/groups#group-types).\n\nThe following sections demonstrate how to manage identity-mapped groups.\n\nBefore you begin\n----------------\n\n| **Note:** Before you use any of the Cloud Identity APIs, you must set up Cloud Identity. See [Setting up Cloud Identity](/identity/docs/set-up-cloud-identity-admin) for instructions.\n\nPerform the following tasks before proceeding with the information on this page:\n\n- [Create the identity source](https://support.google.com/a/answer/9039510)\n in the Google Admin console.\n\n- Read the [Groups API overview](/identity/docs/groups).\n\n- [Set up the Groups API](/identity/docs/how-to/setup).\n\nCreating an identity-mapped group\n---------------------------------\n\n### REST\n\nTo create an identity-mapped group, call\n[`groups.create()`](/identity/docs/reference/rest/v1/groups/create) with an\ninstance of the new group. The group instance must include a `groupKey` ,\n`Parent`, and `label` set to `system/groups/external`. The `groupKey` is a\ncombination of `namespace` and `groupId` that uniquely identifies the group.\n\n### Python\n\nThe following example shows a helper function to create an identity group\nusing the Python client library. Use the identity source ID, obtained when you\ncreated the identity source in the Google Admin console, to call the helper\nfunction and create a group: \n\n def create_identity_group(service, identity_source_id, group_id, group_display_name,\n group_description):\n namespace = \"identitysources/\" + identity_source_id\n group_key = {\"id\": group_id, \"namespace\": namespace}\n group = {\n \"parent\": namespace,\n \"description\": group_description,\n \"displayName\": group_display_name,\n \"groupKey\": group_key,\n \"labels\": {\n # Set the label to specify creation of an identity group.\n \"system/groups/external\": \"\"\n }\n }\n\n try:\n response = service.groups().create(body=group).execute()\n print response\n except Exception, e:\n print e\n\n myNewGroup = create_identity_group(\n idSvc,\n \"ABC1234\",\n \"zebra\",\n \"Zebra external group\",\n \"The Zebra group is an identity group representing the Zooland\n external identity\"\n )\n\nProviding the namespace ensures that you won't experience any naming\ncollisions, and places the identity-mapped group in the proper context of other\ngroups from the same external identity source.\n\n### Searching for identity-mapped groups\n\n### REST\n\nTo search for identity-mapped groups, call\n[`groups.search()`](/identity/docs/reference/rest/v1/groups/search) with a\nquery string. To search for all groups, you only need to provide the label\n`system/groups/external`.\n\n### Python\n\nThe following example shows a helper function used to\nsearch for identity-mapped groups using the Python client library: \n\n def search_identity_groups(service, identity_source_id, pageSize, view):\n # Set the label to search for all identity groups\n searchQuery = \"&query=namespace=identitysources/\" + identity_source_id \\\n + \"%20AND%20\" + \"labels:system/groups/external\" \\\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, e:\n print e\n\nWhat's next\n-----------\n\nAfter a group exists, you can create memberships for it. To create memberships\nfor an identity-mapped group, refer to\n[Managing identity-mapped group memberships](/identity/docs/how-to/memberships-identity-groups)."]]