def event_source_mapping_present(name, EventSourceArn, FunctionName, StartingPosition,
            Enabled=True, BatchSize=100,
            region=None, key=None, keyid=None, profile=None):
    ret = {'name': None,
           'result': True,
           'comment': '',
           'changes': {}
           }

    r = __salt__['boto_lambda.event_source_mapping_exists'](EventSourceArn=EventSourceArn,
                                    FunctionName=FunctionName,
                                    region=region, key=key, keyid=keyid, profile=profile)

    if 'error' in r:
        ret['result'] = False
        ret['comment'] = 'Failed to create event source mapping: {0}.'.format(r['error']['message'])
        return ret

    if not r.get('exists'):
        if __opts__['test']:
            ret['comment'] = 'Event source mapping {0} is set to be created.'.format(FunctionName)
            ret['result'] = None
            return ret
        r = __salt__['boto_lambda.create_event_source_mapping'](EventSourceArn=EventSourceArn,
                    FunctionName=FunctionName, StartingPosition=StartingPosition,
                    Enabled=Enabled, BatchSize=BatchSize,
                    region=region, key=key, keyid=keyid, profile=profile)
        if not r.get('created'):
            ret['result'] = False
            ret['comment'] = 'Failed to create event source mapping: {0}.'.format(r['error']['message'])
            return ret
        _describe = __salt__['boto_lambda.describe_event_source_mapping'](
                                 EventSourceArn=EventSourceArn,
                                 FunctionName=FunctionName,
                                 region=region, key=key, keyid=keyid, profile=profile)
        ret['name'] = _describe['event_source_mapping']['UUID']
        ret['changes']['old'] = {'event_source_mapping': None}
        ret['changes']['new'] = _describe
        ret['comment'] = 'Event source mapping {0} created.'.format(ret['name'])
        return ret

    ret['comment'] = os.linesep.join([ret['comment'], 'Event source mapping is present.'])
    ret['changes'] = {}
    _describe = __salt__['boto_lambda.describe_event_source_mapping'](
                                 EventSourceArn=EventSourceArn,
                                 FunctionName=FunctionName,
                                 region=region, key=key, keyid=keyid, profile=profile)['event_source_mapping']

    need_update = False
    for val, var in {
        'BatchSize': 'BatchSize',
    }.iteritems():
        if _describe[val] != locals()[var]:
            need_update = True
            ret['changes'].setdefault('new', {})[var] = locals()[var]
            ret['changes'].setdefault('old', {})[var] = _describe[val]
    # verify FunctionName against FunctionArn
    function_arn = _get_function_arn(FunctionName,
                    region=region, key=key, keyid=keyid, profile=profile)
    if _describe['FunctionArn'] != function_arn:
        need_update = True
        ret['changes'].setdefault('new', {})['FunctionArn'] = function_arn
        ret['changes'].setdefault('old', {})['FunctionArn'] = _describe['FunctionArn']
    # TODO check for 'Enabled', since it doesn't directly map to a specific state
    if need_update:
        ret['comment'] = os.linesep.join([ret['comment'], 'Event source mapping to be modified'])
        if __opts__['test']:
            msg = 'Event source mapping {0} set to be modified.'.format(_describe['UUID'])
            ret['comment'] = msg
            ret['result'] = None
            return ret
        _r = __salt__['boto_lambda.update_event_source_mapping'](UUID=_describe['UUID'],
                                        FunctionName=FunctionName,
                                        Enabled=Enabled,
                                        BatchSize=BatchSize,
                                        region=region, key=key,
                                        keyid=keyid, profile=profile)
        if not _r.get('updated'):
            ret['result'] = False
            ret['comment'] = 'Failed to update mapping: {0}.'.format(_r['error']['message'])
            ret['changes'] = {}
    return ret
Get my originally requesting transport's host.
dataset/ETHPy150Open saltstack/salt/salt/states/boto_lambda.py/event_source_mapping_present--crossover with--dataset/ETHPy150Open scrapy/scrapy/scrapy/xlib/tx/iweb.py/IRequest.getHost