Open Kilda Java Documentation
FeatureTogglesController.java
Go to the documentation of this file.
1 /* Copyright 2017 Telstra Open Source
2  *
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 package org.openkilda.northbound.controller;
17 
18 import io.swagger.annotations.Api;
19 import io.swagger.annotations.ApiResponse;
20 import io.swagger.annotations.ApiResponses;
23 
24 import io.swagger.annotations.ApiOperation;
25 import org.springframework.beans.factory.annotation.Autowired;
26 import org.springframework.context.annotation.PropertySource;
27 import org.springframework.http.HttpStatus;
28 import org.springframework.web.bind.annotation.GetMapping;
29 import org.springframework.web.bind.annotation.RequestBody;
30 import org.springframework.web.bind.annotation.RequestMapping;
31 import org.springframework.web.bind.annotation.RequestMethod;
32 import org.springframework.web.bind.annotation.ResponseStatus;
33 import org.springframework.web.bind.annotation.RestController;
34 
38 @RestController
39 @RequestMapping("/features")
40 @PropertySource("classpath:northbound.properties")
41 @Api
43 
44  @Autowired
45  private FeatureTogglesService featureTogglesService;
46 
47  @ApiOperation(value = "Toggle kilda features")
48  @ApiResponses(value = {
49  @ApiResponse(code = 200, message = "Operation is successful")
50  })
51  @RequestMapping(method = RequestMethod.POST)
52  @ResponseStatus(HttpStatus.OK)
53  public void toggleFeatures(@RequestBody FeatureTogglePayload request) {
54  featureTogglesService.toggleFeatures(request);
55  }
56 
57  @ApiOperation(value = "Get states of feature toggles", response = FeatureTogglePayload.class)
58  @ApiResponses(value = {
59  @ApiResponse(code = 200, message = "Operation is successful")
60  })
61  @GetMapping
62  @ResponseStatus(HttpStatus.OK)
64  return featureTogglesService.getFeatureTogglesState();
65  }
66 }
value
Definition: nodes.py:62
void toggleFeatures(@RequestBody FeatureTogglePayload request)