def lambdaLoops()

in bulkprovision/testlambdas.py [0:0]


def lambdaLoops():
    count = 10
    while count > 0:
        
        # uncomment the lines below to override the SSM parameter values for product and provisioning artifact IDs
        prov_payload = {
            "scparams":SC_TEMPLATE_PARAMETER_NAMES,
            #"scproductid":PRODUCT_ID,
            #"scpaid":PROVISIONINGA_ART_ID,
            "tags":[ {"Key":"auto_provision","Value":"SUCCESS"}] 
        }        
        resp = doLambda("SC-BULK-PROVISION", prov_payload)        
        
        # kick off the SC-BULK-MONITOR function for each of the following status flags.
        obj = {"status":["PROVISIONING", "TERMINATING"]}
        func = "SC-BULK-MONITOR"
        resp = doLambda(func, obj)
            
        # TERMINATING-FAILURE and error status flags use the SC-BULK-HANDLE-FAILED function and the retry threshold value
        status_flags = ["TERMINATING-FAILURE","STATUS-ERROR","PRODUCT-ERROR","PROVISION-ERROR"]
        obj = {"status":status_flags,"retrythreshold":RETRY }
        func = "SC-BULK-HANDLE-FAILED"
        resp = doLambda(func, obj)
        
        doLambda("SC-BULK-CLEANUP",{"status":["TERMINATED"] })
        
        count -= 1
        print("waiting...")
        time.sleep(15)