Delete cos_stream_schema_examples.py
Browse files- cos_stream_schema_examples.py +0 -101
cos_stream_schema_examples.py
DELETED
@@ -1,101 +0,0 @@
|
|
1 |
-
# Define input data schema as a proper Python list (not a string)
|
2 |
-
input_schema = [
|
3 |
-
{
|
4 |
-
'id': '1',
|
5 |
-
'type': 'struct',
|
6 |
-
'fields': [
|
7 |
-
{
|
8 |
-
'name': 'cos_config',
|
9 |
-
'type': 'object',
|
10 |
-
'nullable': False,
|
11 |
-
'metadata': {
|
12 |
-
'description': 'Cloud Object Storage configuration'
|
13 |
-
}
|
14 |
-
},
|
15 |
-
{
|
16 |
-
'name': 'source_urls',
|
17 |
-
'type': 'array',
|
18 |
-
'nullable': False,
|
19 |
-
'metadata': {
|
20 |
-
'description': 'URLs of files to download and upload to COS'
|
21 |
-
}
|
22 |
-
},
|
23 |
-
{
|
24 |
-
'name': 'prefix',
|
25 |
-
'type': 'string',
|
26 |
-
'nullable': True,
|
27 |
-
'metadata': {
|
28 |
-
'description': 'Optional prefix to add to the file names in COS'
|
29 |
-
}
|
30 |
-
},
|
31 |
-
{
|
32 |
-
'name': 'http_method',
|
33 |
-
'type': 'string',
|
34 |
-
'nullable': True,
|
35 |
-
'metadata': {
|
36 |
-
'description': 'HTTP method to use for downloading files'
|
37 |
-
}
|
38 |
-
}
|
39 |
-
]
|
40 |
-
}
|
41 |
-
]
|
42 |
-
|
43 |
-
# Define output data schema as a proper Python list (not a string)
|
44 |
-
output_schema = [
|
45 |
-
{
|
46 |
-
'id': '1',
|
47 |
-
'type': 'struct',
|
48 |
-
'fields': [
|
49 |
-
{
|
50 |
-
'name': 'status',
|
51 |
-
'type': 'string',
|
52 |
-
'nullable': False,
|
53 |
-
'metadata': {
|
54 |
-
'description': 'Status of the operation (success or error)'
|
55 |
-
}
|
56 |
-
},
|
57 |
-
{
|
58 |
-
'name': 'data',
|
59 |
-
'type': 'object',
|
60 |
-
'nullable': True,
|
61 |
-
'metadata': {
|
62 |
-
'description': 'Response data containing upload details'
|
63 |
-
}
|
64 |
-
},
|
65 |
-
{
|
66 |
-
'name': 'message',
|
67 |
-
'type': 'string',
|
68 |
-
'nullable': True,
|
69 |
-
'metadata': {
|
70 |
-
'description': 'Error message if status is error'
|
71 |
-
}
|
72 |
-
}
|
73 |
-
]
|
74 |
-
}
|
75 |
-
]
|
76 |
-
|
77 |
-
# Define sample scoring input
|
78 |
-
sample_input = {
|
79 |
-
'input_data': [
|
80 |
-
{
|
81 |
-
'fields': ['cos_config', 'source_urls', 'prefix', 'http_method'],
|
82 |
-
'values': [
|
83 |
-
[
|
84 |
-
{
|
85 |
-
'bucket_name': 'my-bucket',
|
86 |
-
'api_key': '<your-cos-api-key>',
|
87 |
-
'instance_id': '<your-cos-instance-id>',
|
88 |
-
'auth_endpoint': 'https://iam.cloud.ibm.com/identity/token',
|
89 |
-
'endpoint_url': 'https://s3.eu-de.cloud-object-storage.appdomain.cloud'
|
90 |
-
},
|
91 |
-
[
|
92 |
-
'https://example.com/sample-file.pdf',
|
93 |
-
'https://example.com/another-file.csv'
|
94 |
-
],
|
95 |
-
'uploads/files',
|
96 |
-
'GET'
|
97 |
-
]
|
98 |
-
]
|
99 |
-
}
|
100 |
-
]
|
101 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|