Returns an AWS-valid Lambda event name.
199738
def get_event_name(lambda_name, name):
        
        return '{prefix:.{width}}-{postfix}'.format(prefix=lambda_name, width=max(0, 63 - len(name)), postfix=name)[:64]
980021
def _event_func_names(self, event: str) -> List[str]:
        
        return [func.__name__ for func in self._events[event]]
751618
def getEventTypeNameFromEnum(self, eType):
        """"""

        fn = self.function_table.getEventTypeNameFromEnum
        result = fn(eType)
        return result
107453
function _getMouseEventName(eventName) {
	if (maps.mouseEvents[eventName]) {
		eventName = maps.mouseEvents[eventName];
	}
	return eventName;
}
286959
def stmt_lambda_name(self, index=None):
        """"""
        if index is None:
            index = len(self.stmt_lambdas)
        return stmt_lambda_var + "_" + str(index)
569345
private String getDeviceName(String eventName) {
        int pos = eventName.lastIndexOf('.');
        return eventName.substring(0, pos);
    }
847213
def get_event_from_name(self, event_name):
        
        return next((e for e in self.events if e.name == event_name), None)
488389
def _lambda_add_s3_event_source(awsclient, arn, event, bucket, prefix,
                                suffix):
    
    json_data = {
        'LambdaFunctionConfigurations': [{
            'LambdaFunctionArn': arn,
            'Id': str(uuid.uuid1()),
            'Events': [event]
        }]
    }

    filter_rules = build_filter_rules(prefix, suffix)

    json_data['LambdaFunctionConfigurations'][0].update({
        'Filter': {
            'Key': {
                'FilterRules': filter_rules
            }
        }
    })
    # http://docs.aws.amazon.com/cli/latest/reference/s3api/put-bucket-notification-configuration.html
    # http://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html
    client_s3 = awsclient.get_client('s3')

    bucket_configurations = client_s3.get_bucket_notification_configuration(
        Bucket=bucket)
    bucket_configurations.pop('ResponseMetadata')

    if 'LambdaFunctionConfigurations' in bucket_configurations:
        bucket_configurations['LambdaFunctionConfigurations'].append(
            json_data['LambdaFunctionConfigurations'][0]
        )
    else:
        bucket_configurations['LambdaFunctionConfigurations'] = json_data[
            'LambdaFunctionConfigurations']

    response = client_s3.put_bucket_notification_configuration(
        Bucket=bucket,
        NotificationConfiguration=bucket_configurations
    )
    # TODO don't return a table, but success state
    return json2table(response)
1081354
def _generate_lambda(self):
        
        self.tf_conf['resource']['aws_lambda_function']['lambda_func'] = {
            'filename': 'webhook2lambda2sqs_func.zip',
            'function_name': self.resource_name,
            'role': '${aws_iam_role.lambda_role.arn}',
            'handler': 'webhook2lambda2sqs_func.webhook2lambda2sqs_handler',
            'source_code_hash': '${base64sha256(file('
                                '"webhook2lambda2sqs_func.zip"))}',
            'description': self.description,
            'runtime': 'python2.7',
            'timeout': 120
        }
        self.tf_conf['output']['lambda_func_arn'] = {
            'value': '${aws_lambda_function.lambda_func.arn}'
        }
1049310
def _get_event_source_status(awsclient, evt_source, lambda_arn):
    
    event_source_obj = _get_event_source_obj(awsclient, evt_source)
    return event_source_obj.status(lambda_arn)
113104
def name(self):
        
        if self.m_name == -1 or (self.m_event != START_TAG and self.m_event != END_TAG):
            return ''

        return self.sb[self.m_name]
648668
def get_lambda_runtime_info(context):
    '''
    
    '''

    runtime_info = {
        'remaining_time': context.get_remaining_time_in_millis(),
        'function_name': context.function_name,
        'function_version': context.function_version,
        'invoked_function_arn': context.invoked_function_arn,
        'memory_limit': context.memory_limit_in_mb,
        'aws_request_id': context.aws_request_id,
        'log_group_name': context.log_group_name,
        'log_stream_name': context.log_stream_name
    }

    return runtime_info
690995
def get_lambdas(awsclient, config, add_arn=False):
    
    if 'lambda' in config:
        client_lambda = awsclient.get_client('lambda')
        lambda_entries = config['lambda'].get('entries', [])
        lmbdas = []
        for lambda_entry in lambda_entries:
            lmbda = {
                'name': lambda_entry.get('name', None),
                'alias': lambda_entry.get('alias', None),
                'swagger_ref': lambda_entry.get('swaggerRef', None)
            }
            if add_arn:
                _sleep()
                response_lambda = client_lambda.get_function(
                    FunctionName=lmbda['name'])
                lmbda['arn'] = response_lambda['Configuration']['FunctionArn']
            lmbdas.append(lmbda)
        return lmbdas
    else:
        return []
1157736
public SourceType identifyWithEventName(String source, String eventName) {
        if (eventName.startsWith(CREATE_EVENT_PREFIX)) {
            return getCloudTrailSourceType(source);
        }
        return SourceType.Other;
    }
497326
def ping(awsclient, function_name, alias_name=ALIAS_NAME, version=None):
    
    log.debug('sending ping to lambda function: %s', function_name)
    payload = '{"ramuda_action": "ping"}'  # default to ping event
    # reuse invoke
    return invoke(awsclient, function_name, payload, invocation_type=None,
                  alias_name=alias_name, version=version)
625874
function processEventName(eventName) {
  // bindtap => onTap
  // tap => onTap
  if (eventName.startsWith('bind') || !eventName.startsWith('on')) {
    return eventName.replace(/^(bind){0,1}(.*)/, (g, $1, $2) => {
      return `on${$2[0].toUpperCase()}${$2.slice(1)}`
    })
  }
  return eventName
}
385679
def _prepare_authorizer_event(self, arn, lambda_event, lambda_context):
        # type: (str, EventType, LambdaContext) -> EventType
        """"""
        authorizer_event = lambda_event.copy()
        authorizer_event['type'] = 'TOKEN'
        try:
            authorizer_event['authorizationToken'] = authorizer_event.get(
                'headers', {})['authorization']
        except KeyError:
            raise NotAuthorizedError(
                {'x-amzn-RequestId': lambda_context.aws_request_id,
                 'x-amzn-ErrorType': 'UnauthorizedException'},
                b'{"message":"Unauthorized"}')
        authorizer_event['methodArn'] = arn
        return authorizer_event