in AccountCreationLambda.py [0:0]
def create_account_in_cloudcheckr(env, adminapikey, accountname):
"""
Creates an account in CloudCheckr that is an empty slate. This will return the external_id
"""
api_url = env + "/api/account.json/add_account_v3"
add_account_info = json.dumps({"account_name": accountname})
response_post = requests.post(api_url, headers={"Content-Type": \
"application/json", "access_key": \
adminapikey}, data=add_account_info)
if "cc_external_id" in response_post.json():
print("Successfully created the account " + accountname + \
" with external_id " + response_post.json()["cc_external_id"])
print(response_post.json())
return response_post.json()["cc_external_id"]
else:
print(response_post.json())
return None