com.shapestone.end.point.lock.EndPointLockController Maven / Gradle / Ivy
The newest version!
package com.shapestone.end.point.lock;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Map;
import static org.springframework.http.HttpStatus.OK;
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
import static org.springframework.web.bind.annotation.RequestMethod.GET;
import static org.springframework.web.bind.annotation.RequestMethod.POST;
import static org.springframework.web.bind.annotation.RequestMethod.PUT;
/**
* Name: Michael Williams
* Date: 4/4/17.
*/
@RestController
public class EndPointLockController {
private EndPointLock endPointLock;
public EndPointLockController(EndPointLock endPointLock) {
this.endPointLock = endPointLock;
}
@RequestMapping(path = "/end-point-locks/{endPointName}/toggle", consumes = APPLICATION_JSON_VALUE, method = PUT)
public ResponseEntity lockEndPoint(@PathVariable("endPointName") String endPointName) {
return new ResponseEntity(endPointLock.toggle(endPointName), OK);
}
@RequestMapping(path = "/end-point-locks/{endPointName}/statuses/{status}", consumes = APPLICATION_JSON_VALUE, method = POST)
public ResponseEntity addLockEndPoint(@PathVariable("endPointName") String endPointName,
@PathVariable("status") Boolean aBoolean) {
this.endPointLock.addEndPoint(endPointName, aBoolean);
return new ResponseEntity(true, OK);
}
@RequestMapping(path = "/end-point-locks", method = GET)
public ResponseEntity © 2015 - 2025 Weber Informatics LLC | Privacy Policy