All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.zalando.nakadiproducer.snapshots.impl.SnapshotEventCreationMvcEndpoint Maven / Gradle / Ivy

There is a newer version: 30.0.0-RC1
Show newest version
package org.zalando.nakadiproducer.snapshots.impl;

import org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter;
import org.springframework.boot.actuate.endpoint.mvc.HypermediaDisabled;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

public class SnapshotEventCreationMvcEndpoint extends EndpointMvcAdapter {
    private final SnapshotEventCreationEndpoint delegate;

    public SnapshotEventCreationMvcEndpoint(SnapshotEventCreationEndpoint delegate) {
        super(delegate);
        this.delegate = delegate;
    }

    @RequestMapping(value = "/{eventType:.*}", method = RequestMethod.POST)
    @ResponseBody
    @HypermediaDisabled
    public ResponseEntity createSnapshot(@PathVariable String eventType,
            @RequestBody(required = false) String filter) {
        if (!this.delegate.isEnabled()) {
            // Shouldn't happen - MVC endpoint shouldn't be registered when delegate's
            // disabled
            return getDisabledResponse();
        }

        delegate.invoke(eventType, filter);
        return ResponseEntity.ok().build();
    }


}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy