private async getOrgRoot()

in source/services/preReqManager/lib/preReqManager.ts [559:598]


  private async getOrgRoot() {
    try {
      const organization = new OrganizationsClient({
        region: dataplane,
        customUserAgent,
      });

      const _ro: ListRootsCommandOutput = await organization.send(
        new ListRootsCommand({})
      );
      logger.debug({
        label: "PreRegManager/enableConfig",
        message: `organization root list: ${JSON.stringify(_ro)}`,
      });

      if (!_ro || !_ro.Roots) {
        const _m = "error fetching organization details";
        logger.error({
          label: "PreRegManager/enableConfig",
          message: `${_m}`,
        });
        throw new Error(_m);
      }

      const roots = _ro.Roots.map((root) => {
        return root.Id as string;
      });
      logger.debug({
        label: "PreRegManager/getOrgRoot",
        message: `organization roots: ${roots}`,
      });
      return roots;
    } catch (e) {
      logger.error({
        label: "PreRegManager/getOrgRoot",
        message: `error in getting Organization root: ${JSON.stringify(e)}`,
      });
      throw new Error(e);
    }
  }