개요

Alert Center API를 사용하면 도메인에 영향을 주는 알림을 관리할 수 있습니다. 알림은 Google에서 감지한 잠재적인 보안 문제에 대한 경고입니다. 알림에는 다음 정보가 포함됩니다.

  • 알림이 발생한 소스입니다.
  • 경고의 이름입니다.
  • 알림이 발생한 시간입니다.
  • 이 경보와 관련된 특정 데이터입니다.

도메인 관리자는 Google 관리 콘솔. 이 Alert Center API를 사용하면 빌드하는 앱에서 알림 데이터와 알림 의견을 가져올 수 있습니다. 이 API는 기존 알림에 대한 새로운 알림 의견을 만들 수도 있습니다.

예를 들어 모니터링 앱은 Alert Center API를 사용하여 가장 최근의 경보를 제공하고 우선순위를 정하여 구성원들에게 알림 역할을 할 수 있습니다 팀이 알림에 응답하면 앱은 결과를 기반으로 알림에 피드백을 첨부합니다.

Alert Center API 사용

Alert Center API를 사용하려면 먼저 새 Cloud Platform 프로젝트를 만들고 Alert Center API를 사용 설정합니다. 프로젝트에서 서비스 계정을 사용해야 합니다. API에 액세스할 때 확인할 수 있습니다

앱에 기본 요건을 충족하고 사용 사례에 적합한 Cloud 프로젝트가 있으면 승인되면 Alert Center API REST 요청 API 요청을 보다 쉽게 하려면 제공되는 클라이언트 라이브러리를 참조하세요.

다음 예시에서는 API를 사용하여 사용 가능한 알림을 나열하는 방법을 보여줍니다.

자바

// First, authorize the API and create a client to make requests with.
URL serviceAccountUrl = AuthUtils.class.getResource("/client_secret.json");
GoogleCredentials credentials =  ServiceAccountCredentials
    .fromStream(serviceAccountUrl.openStream())
    .createDelegated("admin@xxxx.com")
    .createScoped(Collections.singleton("https://www.googleapis.com/auth/apps.alerts"));
ApacheHttpTransport transport = new ApacheHttpTransport();
HttpCredentialsAdapter adapter = new HttpCredentialsAdapter(credentials);
AlertCenter alertCenter = new AlertCenter.Builder(transport, new JacksonFactory(), adapter)
    .setApplicationName("Alert Center client")
    .build();

// List alerts in pages, printing each alert discovered.
String pageToken = null;
do {
  ListAlertsResponse listResponse = service.alerts().list().setPageToken(pageToken)
      .setPageSize(20).execute();
  if (listResponse.getAlerts() != null) {
    for (Alert alert : listResponse.getAlerts()) {
      System.out.println(alert);
    }
  }
  pageToken = listResponse.getNextPageToken();
} while (pageToken != null);