概要

Alert Center API を使用すると、ドメインに影響するアラートを管理できます。 アラートは、Google が検出した潜在的なセキュリティ問題を警告するものです。 アラートには次の情報が含まれます。

  • アラートの発信元。
  • アラートの名前。
  • このアラートが発生した時刻。
  • このアラートに関連付けられた特定のデータ。

ドメイン管理者は管理コンソールから Google 管理コンソール。「 Alert Center API を使用すると、アプリでアラートデータとアラート フィードバックを取得できます。「 API では、既存のアラートに対する新しいアラート フィードバックを作成することもできます。

たとえば、モニタリング アプリは、Alert Center API を使用して、 アラートの優先度を判断してメンバーに通知する できます。チームがアラートに応答すると、アプリは次のことができるようになります。 検出結果に基づいてアラートにフィードバックを添付します。

Alert Center API を使用する

Alert Center API を使用する前に、次のアラートを設定する必要があります。 アラート センター API を有効にする必要があります。 プロジェクトでサービス アカウントを使用する必要があります API にアクセスする際のルールです。

アプリの Cloud プロジェクトが前提条件を満たし、 承認された場合、 アラート センター API の REST リクエスト。API リクエストの作成は、 使用可能なクライアント ライブラリ

次の例は、API を使用して使用可能なアラートを一覧表示する方法を示しています。

Java

// 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);