def handler(event, context):
    print(event)
    print(context)

    # Handles the case when this is called during deletion
    if event['RequestType'] == 'Delete':
        cf_response.send(event, context, "SUCCESS", {"Status": "SUCCESS"})
        return 'SUCCESS'

    partner_table = boto3.resource('dynamodb').Table('PrometheonPartners')
    add_random_data_to_table(150, partner_table)

    # Put specific required values in the table
    partner_table.put_item(
        Item={
            'PartnerName': 'dummy_name_delete_b4_demo',
            'email': '*****@*****.**',
            'address': fake.address(),
            'clientDealValue': 'No money, I\'m a dummy value!'
        })

    partner_table.put_item(
        Item={
            'PartnerName': 'ProTowTires',
            'email': '*****@*****.**',
            'address': fake.address(),
            'clientDealValue': 'OVER NINE-THOUSAND!!!!'
        })

    # Add another 50 random values
    add_random_data_to_table(50, partner_table)

    # Return resposne to CloudFormation saying this was successful
    cf_response.send(event, context, "SUCCESS", {"Status": "SUCCESS"})
def handler(event, context):
    print(event)
    print(context)

    # Handles the case when this is called during deletion
    if event['RequestType'] == 'Delete':
        cf_response.send(event, context, 'SUCCESS', {'Status': 'SUCCESS'})
        return 'SUCCESS'

    populated_table = boto3.resource('dynamodb').Table('PrometheonMusic')

    add_testing_data_to_table(15, populated_table)

    # Return resposne to CloudFormation saying this was successful
    cf_response.send(event, context, 'SUCCESS', {'Status': 'SUCCESS'})
def handler(event, context):
    print(event)
    print(context)
    
    # Handles the case when this is called during deletion
    if event['RequestType'] == 'Delete':
        cf_response.send(event, context, 'SUCCESS', {'Status': 'SUCCESS'})
        return 'SUCCESS'
    
    populated_table = boto3.resource('dynamodb').Table('PrometheonMusic')
    
    add_testing_data_to_table(15, populated_table)

    # Return resposne to CloudFormation saying this was successful
    cf_response.send(event, context, 'SUCCESS', {'Status': 'SUCCESS'})
def handler(event, context):
    print(event)
    print(context)
    
    # Handles the case when this is called during deletion
    if event['RequestType'] == 'Delete':
        cf_response.send(event, context, 'SUCCESS', {'Status': 'SUCCESS'})
        return 'SUCCESS'
    
    service_record_table = boto3.resource('dynamodb').Table('PrometheonServiceRecords')
    
    add_random_data_to_table(245, service_record_table)
    add_test_val_for_student_to_check_for(service_record_table)
    add_test_val_for_us_to_check_for(service_record_table)

    # Return resposne to CloudFormation saying this was successful
    cf_response.send(event, context, 'SUCCESS', {'Status': 'SUCCESS'})
def handler(event, context):
    print(event)
    print(context)

    # Handles the case when this is called during deletion
    if event['RequestType'] == 'Delete':
        cf_response.send(event, context, 'SUCCESS', {'Status': 'SUCCESS'})
        return 'SUCCESS'

    service_record_table = boto3.resource('dynamodb').Table(
        'PrometheonServiceRecords')

    add_random_data_to_table(245, service_record_table)
    add_test_val_for_student_to_check_for(service_record_table)
    add_test_val_for_us_to_check_for(service_record_table)

    # Return resposne to CloudFormation saying this was successful
    cf_response.send(event, context, 'SUCCESS', {'Status': 'SUCCESS'})
def handler(event, context):
    print(event)
    print(context)

    # Handles the case when this is called during deletion
    if event['RequestType'] == 'Delete':
        cf_response.send(event, context, 'SUCCESS', {'Status': 'SUCCESS'})
        return 'SUCCESS'

    clients_table = boto3.resource('dynamodb').Table('ClientsTable')

    add_random_data_to_table(50, clients_table)
    add_values_to_delete_into_table(15, clients_table)
    add_values_to_update_into_table(10, clients_table)
    add_random_data_to_table(35, clients_table)

    # Return resposne to CloudFormation saying this was successful
    cf_response.send(event, context, 'SUCCESS', {'Status': 'SUCCESS'})
Esempio n. 7
0
def handler(event, context):
    print(event)
    print(context)
    
    # Handles the case when this is called during deletion
    if event['RequestType'] == 'Delete':
        cf_response.send(event, context, 'SUCCESS', {'Status': 'SUCCESS'})
        return 'SUCCESS'
    
    f = open('musicData.json')
    request_items = json.loads(f.read())

    music_table = boto3.resource('dynamodb').Table('PrometheonMusic')
    for item in request_items:
        music_table.put_item(Item=item)
        time.sleep(.21)

    # Return resposne to CloudFormation saying this was successful
    cf_response.send(event, context, 'SUCCESS', {'Status': 'SUCCESS'})
Esempio n. 8
0
def handler(event, context):
    try:
        # This automatically succeeds when the custom resource is called during deletion
        # It uses the cf_response file which 
        if event['RequestType'] == 'Delete':
            cf_response.send(event, context, 'SUCCESS', {'Status': 'SUCCESS'})
            return 'SUCCESS'
        # This is the real core 'custom' part of this custom resource
        # All it does it write 10 test items to a DynamoDB table
        # But you can really do anything supported by the AWS SDKs
        i = 0
        while i < 10:
            i = i + 1
            clients_table = boto3.resource('dynamodb').Table('Clients')
            clients_table.put_item(
                Item={
                    'ClientId': str(uuid.uuid4()),
                    'paymentStatus': random.choice(['paid', 'overdue', 'canceled'])
                }
            )
            # Wait a little because the table only has 5 write capacity units
            time.sleep(0.25)
        # If all this works... 
        # Then return response to CloudFormation saying this was successful
        cf_response.send(event, context, 'SUCCESS', {'Status': 'SUCCESS'})
    except Exception as e:
        # Return a failure to CloudFormation if there's an error in the process above
        print(str(e))
        cf_response.send(event, context, 'FAILED', {'Status': 'FAILED'})
Esempio n. 9
0
def handler(event, context):
    print(event)
    print(context)
    
    # Handles the case when this is called during deletion
    if event['RequestType'] == 'Delete':
        cf_response.send(event, context, "SUCCESS", {"Status": "SUCCESS"})
        return 'SUCCESS'
    
    users_table = boto3.resource('dynamodb').Table('Users')
    add_random_data_to_table(150, users_table)
    
    # Put specific required values in the table
    users_table.put_item(
        Item={
            'UserEmail': '*****@*****.**',
            'name': 'Dell Etteme',
            'address': fake.address(),
            'plan': "Test Account"
        }
    )
    
    users_table.put_item(
        Item={
            'UserEmail': '*****@*****.**',
            'name': 'Ned Updatum',
            'address': fake.address(),
            'plan': "Trial"
        }
    )
    
    # Add another 50 random values 
    add_random_data_to_table(50, users_table)

    # Return resposne to CloudFormation saying this was successful
    cf_response.send(event, context, "SUCCESS", {"Status": "SUCCESS"})
def handler(event, context):
    print(event)
    print(context)
    
    # Handles the case when this is called during deletion
    if event['RequestType'] == 'Delete':
        cf_response.send(event, context, "SUCCESS", {"Status": "SUCCESS"})
        return 'SUCCESS'
    
    partner_table = boto3.resource('dynamodb').Table('PrometheonPartners')
    add_random_data_to_table(150, partner_table)
    
    # Put specific required values in the table
    partner_table.put_item(
        Item={
            'PartnerName': 'dummy_name_delete_b4_demo',
            'email': '*****@*****.**',
            'address': fake.address(),
            'clientDealValue': 'No money, I\'m a dummy value!'
        }
    )
    
    partner_table.put_item(
        Item={
            'PartnerName': 'ProTowTires',
            'email': '*****@*****.**',
            'address': fake.address(),
            'clientDealValue': 'OVER NINE-THOUSAND!!!!'
        }
    )
    
    # Add another 50 random values 
    add_random_data_to_table(50, partner_table)

    # Return resposne to CloudFormation saying this was successful
    cf_response.send(event, context, "SUCCESS", {"Status": "SUCCESS"})