# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: MIT-0 import json import boto3 import os import utils import uuid import logger import requests import re region = os.environ['AWS_REGION'] create_tenant_admin_user_resource_path = os.environ['CREATE_TENANT_ADMIN_USER_RESOURCE_PATH'] create_tenant_resource_path = os.environ['CREATE_TENANT_RESOURCE_PATH'] lambda_client = boto3.client('lambda') #TODO: Implement this method def register_tenant(event, context): pass def __create_tenant_admin_user(tenant_details, headers, auth, host, stage_name): try: url = ''.join(['https://', host, '/', stage_name, create_tenant_admin_user_resource_path]) logger.info(url) response = requests.post(url, data=json.dumps(tenant_details), auth=auth, headers=headers) response_json = response.json() except Exception as e: logger.error('Error occured while calling the create tenant admin user service') raise Exception('Error occured while calling the create tenant admin user service', e) else: return response_json def __create_tenant(tenant_details, headers, auth, host, stage_name): try: url = ''.join(['https://', host, '/', stage_name, create_tenant_resource_path]) response = requests.post(url, data=json.dumps(tenant_details), auth=auth, headers=headers) response_json = response.json() except Exception as e: logger.error('Error occured while creating the tenant record in table') raise Exception('Error occured while creating the tenant record in table', e) else: return response_json