@@ -132,6 +132,40 @@ def query_direct_to_private_api(self, private_api_prefix: str, transform=True):
132132 return {'server_error' : f'error while invoking:{ str (e )} ' }
133133 return {'results' : stac_list }
134134
135+ def add_entry (self , private_api_prefix : str , new_granule : dict ):
136+ raise NotImplementedError (f'Please implement adding granules to Cumulus' )
137+ # https://nasa.github.io/cumulus-api/v18.4.0/#create-granule
138+ # payload = {
139+ # 'httpMethod': 'POST',
140+ # 'resource': '/{proxy+}',
141+ # 'path': f'/{self.__collections_key}',
142+ # 'headers': {
143+ # 'Content-Type': 'application/json',
144+ # },
145+ # 'body': json.dumps(new_granule)
146+ # }
147+ # LOGGER.debug(f'payload: {payload}')
148+ # try:
149+ # query_result = self._invoke_api(payload, private_api_prefix)
150+ # """
151+ # {'statusCode': 500, 'body': '', 'headers': {}}
152+ # """
153+ # if query_result['statusCode'] >= 500:
154+ # LOGGER.error(f'server error status code: {query_result["statusCode"]}. details: {query_result}')
155+ # return {'server_error': query_result}
156+ # if query_result['statusCode'] >= 400:
157+ # LOGGER.error(f'client error status code: {query_result["statusCode"]}. details: {query_result}')
158+ # return {'client_error': query_result}
159+ # query_result = json.loads(query_result['body'])
160+ # LOGGER.debug(f'json query_result: {query_result}')
161+ # if 'message' not in query_result:
162+ # return {'server_error': f'invalid response: {query_result}'}
163+ # except Exception as e:
164+ # LOGGER.exception('error while invoking')
165+ # return {'server_error': f'error while invoking:{str(e)}'}
166+ # return {'status': query_result['message']}
167+ return
168+
135169 def delete_entry (self , private_api_prefix : str , granule_id : str ):
136170 payload = {
137171 'httpMethod' : 'DELETE' ,
0 commit comments