보안 그룹 만들기
이 페이지에서는 보안 그룹을 만드는 방법을 설명합니다. 새 보안 그룹을 만들거나 Google 그룹을 보안 그룹으로 업데이트할 수 있습니다.
시작하기 전에
이 페이지의 정보를 계속 진행하기 전에 다음 작업을 수행하세요.
보안 그룹 요구사항
보안 그룹에는 다음만 포함될 수 있습니다.
- 도메인 내부 또는 외부 사용자(Google 서비스와 연결된 경우)
- 도메인 내부 또는 외부 서비스 계정
- 도메인 내 보안 그룹
이러한 조건을 충족하지 않는 Google 그룹에는 보안 그룹 라벨을 적용할 수 없습니다.
사전 정의된 최고 관리자 또는 그룹 관리자만 보안 그룹을 업데이트할 권한이 있습니다.
새 보안 그룹 만들기
REST
보안 그룹을 만들려면 새 그룹의 인스턴스로 groups.create()를 호출합니다. 그룹 인스턴스에는 cloudidentity.googleapis.com/groups.security 및 cloudidentity.googleapis.com/groups.discussion_forum으로 설정된 groupKey, Parent, labels가 포함되어야 합니다.
Python
다음 예시에서는 Python 클라이언트 라이브러리를 사용하여 Google 그룹을 만드는 도우미 함수가 나와 있습니다.
def create_google_group(service, customer_id, group_id, group_display_name, group_description):
  group_key = {"id": group_id}
  group = {
    "parent": "customers/" + customer_id,
    "description": group_description,
    "displayName": group_display_name,
    "groupKey": group_key,
    # Set the label to specify creation of a Google Group.
    "labels": {
      "cloudidentity.googleapis.com/groups.security": "",
      "cloudidentity.googleapis.com/groups.discussion_forum": ""
    }
  }
  try:
    request = service.groups().create(body=group)
    request.uri += "&initialGroupConfig=WITH_INITIAL_OWNER"
    response = request.execute()
    print(response)
  except Exception as e:
    print(e)
Google 그룹을 보안 그룹으로 업데이트
REST
Google 그룹을 보안 그룹으로 업데이트하려면 updateMask를 cloudidentity.googleapis.com/groups.security 및 cloudidentity.googleapis.com/groups.discussion_forum로 설정하여 groups.patch()를 호출합니다.
샘플 요청 본문
{
  "labels": {
    "cloudidentity.googleapis.com/groups.security": "",
    "cloudidentity.googleapis.com/groups.discussion_forum": ""
  }
}
Python
다음 예시에서는 Python 클라이언트 라이브러리를 사용하여 Google 그룹을 보안 그룹으로 업데이트하는 도우미 함수를 보여줍니다.
def add_security_label_to_group(service, group_name):
  group = {
    "labels": {
      "cloudidentity.googleapis.com/groups.security": "",
      "cloudidentity.googleapis.com/groups.discussion_forum": ""
    }
  }
  try:
    request = service.groups().patch(name=group_name, body=group)
    request.uri = request.uri + '&updateMask=labels'
    response = request.execute()
    print(response)
  except Exception as e:
    print(e)