Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return 410 GONE on GET /v2/service_instances/:instance_id/service_bindings/:binding_id/last_operation #458

Open
flo-hauser opened this issue Oct 25, 2024 · 0 comments

Comments

@flo-hauser
Copy link

flo-hauser commented Oct 25, 2024

Hey,
I think it would be good to be able to return a 410 GONE Status on GET /v2/service_instances/:instance_id/service_bindings/:binding_id/last_operation if the binding is removed upon a asynchronous delete binding request.

I think that would be more spec compliant, according to polling-last-operation-for-service-bindings

idea for solution
As in instance last operation, wrap the result = service_broker.last_binding_operation(...) call in try..catch like so:

    @openbroker.route(
        "/v2/service_instances/<instance_id>/service_bindings/<binding_id>/last_operation",
        methods=["GET"],
    )
    def last_binding_operation(instance_id, binding_id):
        service_id = request.args.get("service_id", None)
        plan_id = request.args.get("plan_id", None)

        operation_data = request.args.get("operation", None)

        try: 
            result = service_broker.last_binding_operation(
                instance_id=instance_id,
                binding_id=binding_id,
                operation_data=operation_data,
                service_id=service_id,
                plan_id=plan_id,
            )
            if result is None:
                warnings.warn("Last Binding Operation has to return a LastOperation", stacklevel=0)
                raise errors.ServiceException("Internal broker error")
            return (
                to_json_response(LastOperationResponse(result.state, result.description)),
                HTTPStatus.OK,
            )
        except errors.ErrBindingDoesNotExist:
            return (
                to_json_response(LastOperationResponse(OperationState.SUCCEEDED, "")),
                HTTPStatus.GONE,
            )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant