| 
									
										
										
										
											2015-07-30 15:37:43 +03:00
										 |  |  | require_relative "request_parser" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | module Devops | 
					
						
							|  |  |  |   module API2_0 | 
					
						
							|  |  |  |     module Parser | 
					
						
							|  |  |  |       class StackParser < RequestParser | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         def create | 
					
						
							| 
									
										
										
										
											2015-08-12 13:32:26 +03:00
										 |  |  |           @body ||= create_object_from_json_body | 
					
						
							|  |  |  |           project_name = check_string(@body["project"], "Parameter 'project' must be a not empty string") | 
					
						
							|  |  |  |           env_name = check_string(@body["deploy_env"], "Parameter 'deploy_env' must be a not empty string") | 
					
						
							|  |  |  |           check_string(@body["name"], "Parameter 'name' must be a not empty string", true, false) | 
					
						
							|  |  |  |           list = check_array(@body["run_list"], "Parameter 'run_list' is invalid, it should be not empty array of strings", String, true, true) | 
					
						
							| 
									
										
										
										
											2015-08-04 12:36:10 +03:00
										 |  |  |           Validators::Helpers::RunList.new(list).validate! unless list.nil? | 
					
						
							| 
									
										
										
										
											2015-08-12 13:32:26 +03:00
										 |  |  |           @body | 
					
						
							| 
									
										
										
										
											2015-08-04 12:36:10 +03:00
										 |  |  |         end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         def run_list | 
					
						
							|  |  |  |           list = check_array(create_object_from_json_body(Array), "Body must contains not empty array of strings") | 
					
						
							|  |  |  |           Validators::Helpers::RunList.new(list).validate! | 
					
						
							|  |  |  |           list | 
					
						
							| 
									
										
										
										
											2015-07-30 15:37:43 +03:00
										 |  |  |         end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       end | 
					
						
							|  |  |  |     end | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | end |