rs_server_catalog/middleware/response_manager.md
Module to process the Responses returned by stac-fastapi for the Catalog middleware.
CatalogResponseManager
Class to process the Responses returned by stac-fastapi for the Catalog middleware. Each type of Response is managed in one of the functions.
Source code in docs/rs-server/services/catalog/rs_server_catalog/middleware/response_manager.py
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 | |
manage_delete_response(response, user)
async
Change the name of the deleted collection by removing owner_id.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
response
|
StreamingResponse
|
The client response. |
required |
user
|
str
|
The owner id. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
JSONResponse |
Response
|
The new response with the updated collection name. |
Source code in docs/rs-server/services/catalog/rs_server_catalog/middleware/response_manager.py
438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 | |
manage_download_response(request, response)
async
Manage download response and handle requests that should generate a presigned URL.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
request
|
Request
|
The request object. |
required |
response
|
StreamingResponse
|
The response object received. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
JSONResponse |
JSONResponse | RedirectResponse
|
Returns a JSONResponse object containing either the presigned URL or |
JSONResponse | RedirectResponse
|
the response content with the appropriate status code. |
Source code in docs/rs-server/services/catalog/rs_server_catalog/middleware/response_manager.py
213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 | |
manage_get_response(request, response)
async
Remove the user name from objects and adapt all links.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
request
|
Request
|
The client request. |
required |
response
|
Response | StreamingResponse
|
The response from the rs-catalog. |
required |
Returns: Response: The response updated.
Source code in docs/rs-server/services/catalog/rs_server_catalog/middleware/response_manager.py
259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 | |
manage_put_post_response(request, response)
async
Manage put or post responses.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
response
|
StreamingResponse
|
The response object received. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
JSONResponse |
Returns a JSONResponse object containing the response content |
|
|
with the appropriate status code. |
Raises:
| Type | Description |
|---|---|
HTTPException
|
If there is an error while clearing the temporary bucket, |
Source code in docs/rs-server/services/catalog/rs_server_catalog/middleware/response_manager.py
395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 | |
manage_responses(request, streaming_response)
async
Manage responses sent by stac-fastpi after dispatch and before sending it to the user.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
request
|
Request
|
Original request sent to stac-fastapi |
required |
streaming_response
|
StreamingResponse
|
Response returned by stac-fastapi |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Response |
Response
|
HTTP Response |
Source code in docs/rs-server/services/catalog/rs_server_catalog/middleware/response_manager.py
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 | |
manage_search_response(request, response)
async
The '/catalog/search' endpoint doesn't give the information of the owner_id and collection_ids. to get these values, this function try to search them into the search query. If successful, updates the response content by removing the owner_id from the collection_ids and adapt all links. If not successful, does nothing and return the response.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
response
|
StreamingResponse
|
The response from the rs server. |
required |
request
|
Request
|
The request from the client. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
GeoJSONResponse |
GeoJSONResponse
|
The updated response. |
Source code in docs/rs-server/services/catalog/rs_server_catalog/middleware/response_manager.py
166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 | |
log_http_exception(*args, **kwargs)
Log error and return an HTTP exception to be raised by the caller
Source code in docs/rs-server/services/catalog/rs_server_catalog/middleware/response_manager.py
70 71 72 | |