アセット ディスカバリの実行

アセット ディスカバリ スキャンの開始方法を説明します。

コードサンプル

Java

static void runAssetDiscovery(OrganizationName organizationName) {
  try (SecurityCenterClient client = SecurityCenterClient.create()) {
    // Call the API.  Note calls to runAssetDiscovery are throttled if too many requests
    // are made.
    OperationFuture<RunAssetDiscoveryResponse, Empty> result =
        client.runAssetDiscoveryAsync(organizationName);

    // Uncomment this line to wait for a certain amount of time for the asset discovery run
    // to complete.
    // result.get(130, TimeUnit.SECONDS);
    System.out.println("Asset discovery runs asynchronously.");
  } catch (IOException e) {
    throw new RuntimeException("Couldn't create client.", e);
  } catch (ResourceExhaustedException e) {
    System.out.println("Asset discovery run already in progress.");
  }
}

次のステップ

他の Google Cloud プロダクトに関連するコードサンプルの検索およびフィルタ検索を行うには、Google Cloud のサンプルをご覧ください。