|
7 | 7 |
|
8 | 8 |
|
9 | 9 | class DataSource(BaseAPI, data_source_pb2_grpc.DataSourceServicer):
|
10 |
| - |
11 | 10 | pb2 = data_source_pb2
|
12 | 11 | pb2_grpc = data_source_pb2_grpc
|
13 | 12 |
|
14 | 13 | def register(self, request, context):
|
15 | 14 | params, metadata = self.parse_request(request, context)
|
16 | 15 |
|
17 |
| - with self.locator.get_service('DataSourceService', metadata) as data_source_service: |
18 |
| - return self.locator.get_info('DataSourceInfo', data_source_service.register(params)) |
| 16 | + with self.locator.get_service( |
| 17 | + "DataSourceService", metadata |
| 18 | + ) as data_source_service: |
| 19 | + return self.locator.get_info( |
| 20 | + "DataSourceInfo", data_source_service.register(params) |
| 21 | + ) |
19 | 22 |
|
20 | 23 | def update(self, request, context):
|
21 | 24 | params, metadata = self.parse_request(request, context)
|
22 | 25 |
|
23 |
| - with self.locator.get_service('DataSourceService', metadata) as data_source_service: |
24 |
| - return self.locator.get_info('DataSourceInfo', data_source_service.update(params)) |
| 26 | + with self.locator.get_service( |
| 27 | + "DataSourceService", metadata |
| 28 | + ) as data_source_service: |
| 29 | + return self.locator.get_info( |
| 30 | + "DataSourceInfo", data_source_service.update(params) |
| 31 | + ) |
| 32 | + |
| 33 | + def update_secret_data(self, request, context): |
| 34 | + params, metadata = self.parse_request(request, context) |
| 35 | + |
| 36 | + with self.locator.get_service( |
| 37 | + "DataSourceService", metadata |
| 38 | + ) as data_source_service: |
| 39 | + return self.locator.get_info( |
| 40 | + "DataSourceInfo", data_source_service.update_secret_data(params) |
| 41 | + ) |
25 | 42 |
|
26 | 43 | def update_plugin(self, request, context):
|
27 | 44 | params, metadata = self.parse_request(request, context)
|
28 | 45 |
|
29 |
| - with self.locator.get_service('DataSourceService', metadata) as data_source_service: |
30 |
| - return self.locator.get_info('DataSourceInfo', data_source_service.update_plugin(params)) |
| 46 | + with self.locator.get_service( |
| 47 | + "DataSourceService", metadata |
| 48 | + ) as data_source_service: |
| 49 | + return self.locator.get_info( |
| 50 | + "DataSourceInfo", data_source_service.update_plugin(params) |
| 51 | + ) |
31 | 52 |
|
32 | 53 | def verify_plugin(self, request, context):
|
33 | 54 | params, metadata = self.parse_request(request, context)
|
34 | 55 |
|
35 |
| - with self.locator.get_service('DataSourceService', metadata) as data_source_service: |
| 56 | + with self.locator.get_service( |
| 57 | + "DataSourceService", metadata |
| 58 | + ) as data_source_service: |
36 | 59 | data_source_service.verify_plugin(params)
|
37 |
| - return self.locator.get_info('EmptyInfo') |
| 60 | + return self.locator.get_info("EmptyInfo") |
38 | 61 |
|
39 | 62 | def enable(self, request, context):
|
40 | 63 | params, metadata = self.parse_request(request, context)
|
41 | 64 |
|
42 |
| - with self.locator.get_service('DataSourceService', metadata) as data_source_service: |
43 |
| - return self.locator.get_info('DataSourceInfo', data_source_service.enable(params)) |
| 65 | + with self.locator.get_service( |
| 66 | + "DataSourceService", metadata |
| 67 | + ) as data_source_service: |
| 68 | + return self.locator.get_info( |
| 69 | + "DataSourceInfo", data_source_service.enable(params) |
| 70 | + ) |
44 | 71 |
|
45 | 72 | def disable(self, request, context):
|
46 | 73 | params, metadata = self.parse_request(request, context)
|
47 | 74 |
|
48 |
| - with self.locator.get_service('DataSourceService', metadata) as data_source_service: |
49 |
| - return self.locator.get_info('DataSourceInfo', data_source_service.disable(params)) |
| 75 | + with self.locator.get_service( |
| 76 | + "DataSourceService", metadata |
| 77 | + ) as data_source_service: |
| 78 | + return self.locator.get_info( |
| 79 | + "DataSourceInfo", data_source_service.disable(params) |
| 80 | + ) |
50 | 81 |
|
51 | 82 | def deregister(self, request, context):
|
52 | 83 | params, metadata = self.parse_request(request, context)
|
53 | 84 |
|
54 |
| - with self.locator.get_service('DataSourceService', metadata) as data_source_service: |
| 85 | + with self.locator.get_service( |
| 86 | + "DataSourceService", metadata |
| 87 | + ) as data_source_service: |
55 | 88 | data_source_service.deregister(params)
|
56 |
| - return self.locator.get_info('EmptyInfo') |
| 89 | + return self.locator.get_info("EmptyInfo") |
57 | 90 |
|
58 | 91 | def sync(self, request, context):
|
59 | 92 | params, metadata = self.parse_request(request, context)
|
60 | 93 |
|
61 |
| - with self.locator.get_service('DataSourceService', metadata) as data_source_service: |
62 |
| - return self.locator.get_info('JobInfo', data_source_service.sync(params)) |
| 94 | + with self.locator.get_service( |
| 95 | + "DataSourceService", metadata |
| 96 | + ) as data_source_service: |
| 97 | + return self.locator.get_info("JobInfo", data_source_service.sync(params)) |
63 | 98 |
|
64 | 99 | def get(self, request, context):
|
65 | 100 | params, metadata = self.parse_request(request, context)
|
66 | 101 |
|
67 |
| - with self.locator.get_service('DataSourceService', metadata) as data_source_service: |
68 |
| - return self.locator.get_info('DataSourceInfo', data_source_service.get(params)) |
| 102 | + with self.locator.get_service( |
| 103 | + "DataSourceService", metadata |
| 104 | + ) as data_source_service: |
| 105 | + return self.locator.get_info( |
| 106 | + "DataSourceInfo", data_source_service.get(params) |
| 107 | + ) |
69 | 108 |
|
70 | 109 | def list(self, request, context):
|
71 | 110 | params, metadata = self.parse_request(request, context)
|
72 | 111 |
|
73 |
| - with self.locator.get_service('DataSourceService', metadata) as data_source_service: |
| 112 | + with self.locator.get_service( |
| 113 | + "DataSourceService", metadata |
| 114 | + ) as data_source_service: |
74 | 115 | data_source_vos, total_count = data_source_service.list(params)
|
75 |
| - return self.locator.get_info('DataSourcesInfo', |
76 |
| - data_source_vos, |
77 |
| - total_count, |
78 |
| - minimal=self.get_minimal(params)) |
| 116 | + return self.locator.get_info( |
| 117 | + "DataSourcesInfo", |
| 118 | + data_source_vos, |
| 119 | + total_count, |
| 120 | + minimal=self.get_minimal(params), |
| 121 | + ) |
79 | 122 |
|
80 | 123 | def stat(self, request, context):
|
81 | 124 | params, metadata = self.parse_request(request, context)
|
82 | 125 |
|
83 |
| - with self.locator.get_service('DataSourceService', metadata) as data_source_service: |
84 |
| - return self.locator.get_info('StatisticsInfo', data_source_service.stat(params)) |
| 126 | + with self.locator.get_service( |
| 127 | + "DataSourceService", metadata |
| 128 | + ) as data_source_service: |
| 129 | + return self.locator.get_info( |
| 130 | + "StatisticsInfo", data_source_service.stat(params) |
| 131 | + ) |
0 commit comments