예제 #1
0
 def _check_if_function_exists(self, hook) -> bool:
     name = self.body.get('name')
     if not name:
         raise GcpFieldValidationException(f"The 'name' field should be present in body: '{self.body}'.")
     try:
         hook.get_function(name)
     except HttpError as e:
         status = e.resp.status
         if status == 404:
             return False
         raise e
     return True
예제 #2
0
def _validate_max_instances(value):
    if int(value) <= 0:
        raise GcpFieldValidationException(
            "The max instances parameter has to be greater than 0")
예제 #3
0
def _validate_available_memory_in_mb(value):
    if int(value) <= 0:
        raise GcpFieldValidationException(
            "The available memory has to be greater than 0")
예제 #4
0
 def _int_equal_to_zero(value):
     if int(value) != 0:
         raise GcpFieldValidationException("The available memory has to be equal to 0")