@@ -229,6 +229,38 @@ def delete_executions(self, new_collection: dict, private_api_prefix: str):
229229 return {'server_error' : f'error while invoking:{ str (e )} ' }
230230 return {'status' : query_result }
231231
232+ def list_executions (self , new_collection : dict , private_api_prefix : str ):
233+ # $ curl --request DELETE https://example.com/rules/repeat_test --header 'Authorization: Bearer ReplaceWithTheToken'
234+ payload = {
235+ 'httpMethod' : 'GET' ,
236+ 'resource' : '/{proxy+}' ,
237+ 'path' : f'/executions' ,
238+ 'queryStringParameters' : {'limit' : '100' , 'collectionId' : f'{ new_collection ["name" ]} ___{ new_collection ["version" ]} ' },
239+ 'headers' : {
240+ 'Content-Type' : 'application/json' ,
241+ }
242+ }
243+ LOGGER .debug (f'payload: { payload } ' )
244+ try :
245+ query_result = self ._invoke_api (payload , private_api_prefix )
246+ """
247+ {'statusCode': 500, 'body': '', 'headers': {}}
248+ """
249+ if query_result ['statusCode' ] >= 500 :
250+ LOGGER .error (f'server error status code: { query_result ["statusCode" ]} . details: { query_result } ' )
251+ return {'server_error' : query_result }
252+ if query_result ['statusCode' ] >= 400 :
253+ LOGGER .error (f'client error status code: { query_result ["statusCode" ]} . details: { query_result } ' )
254+ return {'client_error' : query_result }
255+ query_result = json .loads (query_result ['body' ])
256+ LOGGER .debug (f'json query_result: { query_result } ' )
257+ if 'id' not in query_result :
258+ return {'server_error' : f'invalid response: { query_result } ' }
259+ except Exception as e :
260+ LOGGER .exception ('error while invoking' )
261+ return {'server_error' : f'error while invoking:{ str (e )} ' }
262+ return {'status' : query_result }
263+
232264 def create_sqs_rules (self , new_collection : dict , private_api_prefix : str , sqs_url : str , provider_name : str = '' , workflow_name : str = 'CatalogGranule' , visibility_timeout : int = 1800 ):
233265 """
234266curl --request POST "$CUMULUS_BASEURL/rules" --header "Authorization: Bearer $cumulus_token" --header 'Content-Type: application/json' --data '{
0 commit comments