示例#1
0
 def validate_iam(iam_properties):
     if ("role" not in iam_properties) or (iam_properties["role"] == ""):
         error_msg = ("Please, specify a valid iam role in the "
                      "configuration file (usually located in ~/.scar/scar.cfg).")
         raise ValidatorError(parameter='iam_role',
                              parameter_value=iam_properties,
                              error_msg=error_msg)
示例#2
0
 def validate_function_name(function_name):
     if not StrUtils.find_expression(function_name, VALID_LAMBDA_NAME_REGEX):
         error_msg = ("Find name restrictions in: https://docs.aws.amazon.com/lambda/latest/"
                      "dg/API_CreateFunction.html#SSS-CreateFunction-request-FunctionName")
         raise ValidatorError(parameter='function_name',
                              parameter_value=function_name,
                              error_msg=error_msg)
示例#3
0
 def validate_memory(lambda_memory):
     if (lambda_memory < 128) or (lambda_memory > 3008):
         error_msg = 'Please, set a value between 128 and 3008.'
         raise ValidatorError(parameter='lambda_memory',
                              parameter_value=lambda_memory,
                              error_msg=error_msg)
示例#4
0
 def validate_time(lambda_time):
     if (lambda_time <= 0) or (lambda_time > 900):
         error_msg = 'Please, set a value between 0 and 900.'
         raise ValidatorError(parameter='lambda_time',
                              parameter_value=lambda_time,
                              error_msg=error_msg)
示例#5
0
 def validate_batch_comp_type(batch_comp_type):
     if batch_comp_type not in ['SPOT', 'EC2']:
         error_msg = 'Please, set a valid compute environment type ("EC2" or "SPOT")'
         raise ValidatorError(parameter='batch_comp_type',
                              parameter_value=batch_comp_type,
                              error_msg=error_msg)
示例#6
0
 def validate_batch_memory(batch_memory):
     if batch_memory < 4:
         error_msg = 'Please, set a value greater than 4.'
         raise ValidatorError(parameter='batch_memory',
                              parameter_value=batch_memory,
                              error_msg=error_msg)
示例#7
0
 def validate_batch_vcpus(batch_vcpus):
     if batch_vcpus < 1:
         error_msg = 'Please, set at least one vCPU.'
         raise ValidatorError(parameter='batch_vcpus',
                              parameter_value=batch_vcpus,
                              error_msg=error_msg)