|
|
|
input_schema = [ |
|
{ |
|
'id': '1', |
|
'type': 'struct', |
|
'fields': [ |
|
{ |
|
'name': 'cos_config', |
|
'type': 'object', |
|
'nullable': False, |
|
'metadata': { |
|
'description': 'Cloud Object Storage configuration' |
|
} |
|
}, |
|
{ |
|
'name': 'source_urls', |
|
'type': 'array', |
|
'nullable': False, |
|
'metadata': { |
|
'description': 'URLs of files to download and upload to COS' |
|
} |
|
}, |
|
{ |
|
'name': 'prefix', |
|
'type': 'string', |
|
'nullable': True, |
|
'metadata': { |
|
'description': 'Optional prefix to add to the file names in COS' |
|
} |
|
}, |
|
{ |
|
'name': 'http_method', |
|
'type': 'string', |
|
'nullable': True, |
|
'metadata': { |
|
'description': 'HTTP method to use for downloading files' |
|
} |
|
} |
|
] |
|
} |
|
] |
|
|
|
|
|
output_schema = [ |
|
{ |
|
'id': '1', |
|
'type': 'struct', |
|
'fields': [ |
|
{ |
|
'name': 'status', |
|
'type': 'string', |
|
'nullable': False, |
|
'metadata': { |
|
'description': 'Status of the operation (success or error)' |
|
} |
|
}, |
|
{ |
|
'name': 'data', |
|
'type': 'object', |
|
'nullable': True, |
|
'metadata': { |
|
'description': 'Response data containing upload details' |
|
} |
|
}, |
|
{ |
|
'name': 'message', |
|
'type': 'string', |
|
'nullable': True, |
|
'metadata': { |
|
'description': 'Error message if status is error' |
|
} |
|
} |
|
] |
|
} |
|
] |
|
|
|
|
|
sample_input = { |
|
'input_data': [ |
|
{ |
|
'fields': ['cos_config', 'source_urls', 'prefix', 'http_method'], |
|
'values': [ |
|
[ |
|
{ |
|
'bucket_name': 'my-bucket', |
|
'api_key': '<your-cos-api-key>', |
|
'instance_id': '<your-cos-instance-id>', |
|
'auth_endpoint': 'https://iam.cloud.ibm.com/identity/token', |
|
'endpoint_url': 'https://s3.eu-de.cloud-object-storage.appdomain.cloud' |
|
}, |
|
[ |
|
'https://example.com/sample-file.pdf', |
|
'https://example.com/another-file.csv' |
|
], |
|
'uploads/files', |
|
'GET' |
|
] |
|
] |
|
} |
|
] |
|
} |