def handler()

in src/org_setup/lambda_handler.py [0:0]


def handler(event: Dict[str, Any], context: LambdaContext) -> None:

    # Set up a new landing zone
    if event.get("eventName") == "SetupLandingZone":
        primary_region = event["awsRegion"]
        accounts: List[Dict[str, str]] = (
            event.get("serviceEventDetails", {})
            .get("setupLandingZoneStatus", {})
            .get("accounts", [])
        )

        admin_account_id: str = None

        for account in accounts:
            if account["accountName"] == ADMINISTRATOR_ACCOUNT_NAME:
                admin_account_id = account["accountId"]
                break

        return setup_organization(
            primary_region=primary_region,
            admin_account_id=admin_account_id,
            regions=REGIONS,
        )

    helper(event, context)