Beispiel #1
0
 def get_validation_error_message(self, given_shapes, input_params):
     s = ShapeResolver(given_shapes)
     input_shape = s.get_shape_by_name('Input')
     validator = ParamValidator()
     errors_found = validator.validate(input_params, input_shape)
     error_message = errors_found.generate_report()
     return errors_found
 def get_validation_error_message(self, given_shapes, input_params):
     s = ShapeResolver(given_shapes)
     input_shape = s.get_shape_by_name('Input')
     validator = ParamValidator()
     errors_found = validator.validate(input_params, input_shape)
     error_message = errors_found.generate_report()
     return errors_found
Beispiel #3
0
def shape_validate(params, shape_name, service):
    session = fake_session()._session
    model = session.get_service_model(service)
    shape = model.shape_for(shape_name)
    validator = ParamValidator()
    report = validator.validate(params, shape)
    if report.has_errors():
        raise PolicyValidationError(report.generate_report())
Beispiel #4
0
def shape_validate(params, shape_name, service):
    session = fake_session()._session
    model = session.get_service_model(service)
    shape = model.shape_for(shape_name)
    validator = ParamValidator()
    report = validator.validate(params, shape)
    if report.has_errors():
        raise PolicyValidationError(report.generate_report())
Beispiel #5
0
 def build_parameters(self, **kwargs):
     """
     Returns a dictionary containing the kwargs for the
     given operation formatted as required to pass to the service
     in a request.
     """
     protocol = self._model.metadata['protocol']
     input_shape = self._model.input_shape
     if input_shape is not None:
         self._convert_kwargs_to_correct_casing(kwargs)
         validator = ParamValidator()
         errors = validator.validate(kwargs, self._model.input_shape)
         if errors.has_errors():
             raise ParamValidationError(report=errors.generate_report())
     serializer = serialize.create_serializer(protocol)
     request_dict = serializer.serialize_to_request(kwargs, self._model)
     return request_dict
Beispiel #6
0
 def build_parameters(self, **kwargs):
     """
     Returns a dictionary containing the kwargs for the
     given operation formatted as required to pass to the service
     in a request.
     """
     protocol = self._model.metadata['protocol']
     input_shape = self._model.input_shape
     if input_shape is not None:
         self._convert_kwargs_to_correct_casing(kwargs)
         validator = ParamValidator()
         errors = validator.validate(kwargs, self._model.input_shape)
         if errors.has_errors():
             raise ParamValidationError(report=errors.generate_report())
     serializer = serialize.create_serializer(protocol)
     request_dict = serializer.serialize_to_request(kwargs, self._model)
     return request_dict