(project: Project, input: dict, session: Session, log: dict)
| 342 | |
| 343 | |
| 344 | def validate_input_from_blob_path(project: Project, input: dict, session: Session, log: dict): |
| 345 | if input.get('connection_id') is None: |
| 346 | log['error'] = {} |
| 347 | log['error']['connection_id'] = 'Provide a connection ID' |
| 348 | connection = Connection.get_by_id(session, id = input.get('connection_id')) |
| 349 | |
| 350 | if connection is None: |
| 351 | log['error'] = {} |
| 352 | log['error']['connection_id'] = 'Connection ID does not exist' |
| 353 | return log |
| 354 | |
| 355 | connector, log = get_custom_url_supported_connector(session = session, log = log, connection_id = connection.id) |
| 356 | if regular_log.log_has_error(log): |
| 357 | return log |
| 358 | |
| 359 | if connection.project_id != project.id: |
| 360 | log['error'] = {} |
| 361 | log['error']['connection_id'] = 'Invalid Connection ID. Connection ID must belong to project' |
| 362 | |
| 363 | if input.get('bucket_name') is None: |
| 364 | log['error'] = {} |
| 365 | log['error']['bucket_name'] = 'Provide bucket name for blob' |
| 366 | |
| 367 | if input.get('media') is None or input.get('media') == {}: |
| 368 | log['error'] = {} |
| 369 | log['error']['media'] = 'Provide media data. Needs to be {"media_type": str, "url": str<optional>}' |
| 370 | |
| 371 | if input.get('media') is not None and input['media'].get('type') is None: |
| 372 | log['error'] = {} |
| 373 | log['error'][ |
| 374 | 'media.type'] = 'Provide media type needs to be ["image", "video", "text", "audio", "csv", "sensor_fusion", "geo_tiff"]' |
| 375 | if input.get('raw_data_blob_path') is None: |
| 376 | log['error'] = {} |
| 377 | log['error']['raw_data_blob_path'] = 'Provide raw_data_blob_path for blob' |
| 378 | |
| 379 | return log |
| 380 | |
| 381 | |
| 382 | def validate_file_data_for_input_packet(session, input, project_string_id, log): |
no test coverage detected