You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add template import_resource COS source validation
Refactor the parameter validation and implicit auth checks via
'resource_search' calls to allow for both Cloud Manager templates
(existing functionality) and Storage Manager object storage objects
(newly added functionality).
After validation the 'data' still gets passed directly to the
import_image_queue class method of the destination provider.
raiseBadRequestError,"Parameter 'data' has to contain non-empty values for the keys '#{params.join(", ")}', received: '#{data.to_json}'"ifdata.values_at(*params).any?(&:blank?)
raiseBadRequestError,"Parameter 'data' has to contain non-empty values for the keys '#{required_params.join(", ")}', received: '#{data.to_json}'"ifdata.values_at(*required_params).any?(&:blank?)
10
+
10
11
raiseBadRequestError,"Source and destination provider identifiers must differ"ifdata['dst_provider_id'] == data['src_provider_id']
raiseBadRequestError,"Object bucket specified by the id '#{data['bucket_id']}' does not belong to the object storage provider with id '#{data['obj_storage_id']}'"ifbucket.ems_id != cos.id
raiseBadRequestError,"Either provide all of the Object-Storage related parameters (well-formed) or none"ifdata.values_at(*optional_params).any?(&:blank?)
raiseBadRequestError,"Cloud object store container specified by the id '#{data['cos_container_id']}' does not belong to the object store provider with id '#{data['obj_storage_id']}'"ifcos_container.ems_id != cos.id
27
+
raiseBadRequestError,"Source image (template) specified by the id '#{data['src_image_id']}' does not belong to the source provider with id '#{ems_src.id}'"ifsrc_image.ems_id != ems_src.id
raiseBadRequestError,"Parameter 'data' has to contain non-empty values for the keys '#{required_params.join(", ")}', received: '#{data.to_json}'"ifdata.values_at(*required_params).any?(&:blank?)
raiseBadRequestError,"Cloud object store container specified by the id '#{data['cos_container_id']}' does not belong to the object store provider with id '#{data['src_provider_id']}'"ifcos_container.ems_id != ems_src.id
38
+
else
39
+
raiseBadRequestError,"Source provider type '#{ems_src.class}' does not support image import"
25
40
end
26
41
27
-
raiseBadRequestError,"Source image specified by the id '#{data['src_image_id']}' does not belong to the source provider with id '#{ems_src.id}'"ifsrc_image.ems_id != ems_src.id
0 commit comments