@@ -214,36 +214,36 @@ async def get_granules_dapa(request: Request, collection_id: str, limit: Union[i
214214 raise HTTPException (status_code = granules_result ['statusCode' ], detail = granules_result ['body' ])
215215
216216
217- @router .get ("/{collection_id}/items/{granule_id}" )
218- @router .get ("/{collection_id}/items/{granule_id}/" )
219- async def get_single_granule_dapa (request : Request , collection_id : str , granule_id : str ):
220- authorizer : UDSAuthorizorAbstract = UDSAuthorizerFactory () \
221- .get_instance (UDSAuthorizerFactory .cognito ,
222- es_url = os .getenv ('ES_URL' ),
223- es_port = int (os .getenv ('ES_PORT' , '443' ))
224- )
225- auth_info = FastApiUtils .get_authorization_info (request )
226- collection_identifier = UdsCollections .decode_identifier (collection_id )
227- if not authorizer .is_authorized_for_collection (DBConstants .read , collection_id ,
228- auth_info ['ldap_groups' ],
229- collection_identifier .tenant ,
230- collection_identifier .venue ):
231- LOGGER .debug (f'user: { auth_info ["username" ]} is not authorized for { collection_id } ' )
232- raise HTTPException (status_code = 403 , detail = json .dumps ({
233- 'message' : 'not authorized to execute this action'
234- }))
235- try :
236- api_base_prefix = FastApiUtils .get_api_base_prefix ()
237- pg_link_generator = PaginationLinksGenerator (request )
238- granules_dapa_query = GranulesDapaQueryEs (collection_id , 1 , None , None , filter , None , f'{ pg_link_generator .base_url } /{ api_base_prefix } ' )
239- granules_result = granules_dapa_query .get_single_granule (granule_id )
240- except Exception as e :
241- LOGGER .exception ('failed during get_granules_dapa' )
242- raise HTTPException (status_code = 500 , detail = str (e ))
243- return granules_result
217+ # @router.get("/{collection_id}/items/{granule_id}")
218+ # @router.get("/{collection_id}/items/{granule_id}/")
219+ # async def get_single_granule_dapa(request: Request, collection_id: str, granule_id: str):
220+ # authorizer: UDSAuthorizorAbstract = UDSAuthorizerFactory() \
221+ # .get_instance(UDSAuthorizerFactory.cognito,
222+ # es_url=os.getenv('ES_URL'),
223+ # es_port=int(os.getenv('ES_PORT', '443'))
224+ # )
225+ # auth_info = FastApiUtils.get_authorization_info(request)
226+ # collection_identifier = UdsCollections.decode_identifier(collection_id)
227+ # if not authorizer.is_authorized_for_collection(DBConstants.read, collection_id,
228+ # auth_info['ldap_groups'],
229+ # collection_identifier.tenant,
230+ # collection_identifier.venue):
231+ # LOGGER.debug(f'user: {auth_info["username"]} is not authorized for {collection_id}')
232+ # raise HTTPException(status_code=403, detail=json.dumps({
233+ # 'message': 'not authorized to execute this action'
234+ # }))
235+ # try:
236+ # api_base_prefix = FastApiUtils.get_api_base_prefix()
237+ # pg_link_generator = PaginationLinksGenerator(request)
238+ # granules_dapa_query = GranulesDapaQueryEs(collection_id, 1, None, None, filter, None, f'{pg_link_generator.base_url}/{api_base_prefix}')
239+ # granules_result = granules_dapa_query.get_single_granule(granule_id)
240+ # except Exception as e:
241+ # LOGGER.exception('failed during get_granules_dapa')
242+ # raise HTTPException(status_code=500, detail=str(e))
243+ # return granules_result
244244
245- @router .delete ("/{collection_id}/items/{granule_id}/actual " )
246- @router .delete ("/{collection_id}/items/{granule_id}/actual/ " )
245+ @router .delete ("/{collection_id}/items/{granule_id}" )
246+ @router .delete ("/{collection_id}/items/{granule_id}/" )
247247async def delete_single_granule_dapa_actual (request : Request , collection_id : str , granule_id : str ):
248248 authorizer : UDSAuthorizorAbstract = UDSAuthorizerFactory () \
249249 .get_instance (UDSAuthorizerFactory .cognito ,
@@ -267,7 +267,6 @@ async def delete_single_granule_dapa_actual(request: Request, collection_id: str
267267 cumulus .with_collection_id (collection_id )
268268 cumulus_delete_result = cumulus .delete_entry (cumulus_lambda_prefix , granule_id ) # TODO not sure it is correct granule ID
269269 LOGGER .debug (f'cumulus_delete_result: { cumulus_delete_result } ' )
270- sleep (3 ) # Testing if this helps
271270 es_delete_result = GranulesDbIndex ().delete_entry (collection_identifier .tenant ,
272271 collection_identifier .venue ,
273272 granule_id
0 commit comments