eruvanos / openbrokerapi

A python package for the V2 CF Service Broker API
https://openbrokerapi.readthedocs.io/
MIT License
35 stars 19 forks source link

is there a way to support prefix_url when defining a blueprint. #243

Open demoze opened 1 year ago

demoze commented 1 year ago

Is your feature request related to a problem? Please describe.

I would like the servicebroker to be call by multiple cloud controller with a prefix. Each cloudcontroller will make a call to the broker by prefixing the url.

EG : //v2/catalog

This way the broker can handle the request base on wha call him.

The way I use to do that is by passing a url_prefix='/' in the bueprint or when registering the bueprint.

openbrokerapi.api.get_blueprint() has no url_prefix option , and trying to do it with app.register_blueprint(api_blueprint, url_prefix='/') will failed later when the request come in.

13/05/2023 00:35:37 - ERROR - root - catalog() got an unexpected keyword argument 'pfatform_id'
Traceback (most recent call last):
  File "D:\Users\abs\PycharmProjects\cf-idzone-service\venv\lib\site-packages\flask\app.py", line 1484, in full_dispatch_request
    rv = self.dispatch_request()
  File "D:\Users\abs\PycharmProjects\cf-idzone-service\venv\lib\site-packages\flask\app.py", line 1469, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
TypeError: catalog() got an unexpected keyword argument 'pfatform_id'
13/05/2023 00:35:39 - ERROR - root - catalog() got an unexpected keyword argument 'pfatform_id'
Traceback (most recent call last):
  File "D:\Users\abs\PycharmProjects\cf-idzone-service\venv\lib\site-packages\flask\app.py", line 1484, in full_dispatch_request
    rv = self.dispatch_request()
  File "D:\Users\abs\PycharmProjects\cf-idzone-service\venv\lib\site-packages\flask\app.py", line 1469, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
TypeError: catalog() got an unexpected keyword argument 'pfatform_id'

13/05/2023 00:35:39 - INFO - werkzeug - 127.0.0.1 - - [13/May/2023 00:35:39] "GET /cfy-bgl/v2/catalog HTTP/1.1" 500 -

Describe the solution you'd like It will be nice, to be able to have url_prefix option on api.get_bleuprint() and add support to handle it.