|
| 1 | +/* |
| 2 | + * Licensed to the Apache Software Foundation (ASF) under one |
| 3 | + * or more contributor license agreements. See the NOTICE file |
| 4 | + * distributed with this work for additional information |
| 5 | + * regarding copyright ownership. The ASF licenses this file |
| 6 | + * to you under the Apache License, Version 2.0 (the |
| 7 | + * "License"); you may not use this file except in compliance |
| 8 | + * with the License. You may obtain a copy of the License at |
| 9 | + * |
| 10 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | + * |
| 12 | + * Unless required by applicable law or agreed to in writing, |
| 13 | + * software distributed under the License is distributed on an |
| 14 | + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 15 | + * KIND, either express or implied. See the License for the |
| 16 | + * specific language governing permissions and limitations |
| 17 | + * under the License. |
| 18 | + */ |
| 19 | + |
| 20 | +package org.apache.cloudstack.storage.feign.client; |
| 21 | + |
| 22 | +import org.apache.cloudstack.storage.feign.FeignConfiguration; |
| 23 | +import org.apache.cloudstack.storage.feign.model.ExportPolicy; |
| 24 | +import org.apache.cloudstack.storage.feign.model.FileInfo; |
| 25 | +import org.apache.cloudstack.storage.feign.model.response.OntapResponse; |
| 26 | +import org.springframework.cloud.openfeign.FeignClient; |
| 27 | +import org.springframework.context.annotation.Lazy; |
| 28 | +import org.springframework.web.bind.annotation.PathVariable; |
| 29 | +import org.springframework.web.bind.annotation.RequestHeader; |
| 30 | +import org.springframework.web.bind.annotation.RequestMapping; |
| 31 | +import org.springframework.web.bind.annotation.RequestBody; |
| 32 | +import org.springframework.web.bind.annotation.RequestMethod; |
| 33 | +import java.net.URI; |
| 34 | + |
| 35 | +/** |
| 36 | + * @author Administrator |
| 37 | + * |
| 38 | + */ |
| 39 | +@Lazy |
| 40 | +@FeignClient(name = "NASClient", url = "" , configuration = FeignConfiguration.class) |
| 41 | +public interface NASFeignClient { |
| 42 | + |
| 43 | + //File Operations |
| 44 | + |
| 45 | + @RequestMapping(method = RequestMethod.GET, value="/{volume.uuid}/files/{path}") |
| 46 | + OntapResponse<FileInfo> getFileResponse(URI uri, @RequestHeader("Authorization") String header, @PathVariable(name = "volume.uuid", required = true) String volumeUUID, |
| 47 | + @PathVariable(name = "path", required = true) String filePath); |
| 48 | + @RequestMapping(method = RequestMethod.DELETE, value="/{volume.uuid}/files/{path}") |
| 49 | + void deleteFile(URI uri, @RequestHeader("Authorization") String header, @PathVariable(name = "volume.uuid", required = true) String volumeUUID, |
| 50 | + @PathVariable(name = "path", required = true) String filePath); |
| 51 | + @RequestMapping(method = RequestMethod.PATCH, value="/{volume.uuid}/files/{path}") |
| 52 | + void updateFile(URI uri, @RequestHeader("Authorization") String header, @PathVariable(name = "volume.uuid", required = true) String volumeUUID, |
| 53 | + @PathVariable(name = "path", required = true) String filePath, @RequestBody FileInfo fileInfo); |
| 54 | + @RequestMapping(method = RequestMethod.POST, value="/{volume.uuid}/files/{path}") |
| 55 | + void createFile(URI uri, @RequestHeader("Authorization") String header, @PathVariable(name = "volume.uuid", required = true) String volumeUUID, |
| 56 | + @PathVariable(name = "path", required = true) String filePath, @RequestBody FileInfo file); |
| 57 | + |
| 58 | + |
| 59 | + |
| 60 | + //Export Policy Operations |
| 61 | + |
| 62 | + @RequestMapping(method = RequestMethod.POST) |
| 63 | + ExportPolicy createExportPolicy(URI uri, @RequestHeader("Authorization") String header, @RequestHeader("return_records") boolean value, |
| 64 | + @RequestBody ExportPolicy exportPolicy); |
| 65 | + |
| 66 | + //this method to get all export policies and also filtered export policy based on query params as a part of URL |
| 67 | + @RequestMapping(method = RequestMethod.GET) |
| 68 | + OntapResponse<ExportPolicy> getExportPolicyResponse(URI baseURL, @RequestHeader("Authorization") String header); |
| 69 | + |
| 70 | + @RequestMapping(method = RequestMethod.GET, value="/{id}") |
| 71 | + OntapResponse<ExportPolicy> getExportPolicyById(URI baseURL, @RequestHeader("Authorization") String header, @PathVariable(name = "id", required = true) String id); |
| 72 | + |
| 73 | + @RequestMapping(method = RequestMethod.DELETE, value="/{id}") |
| 74 | + void deleteExportPolicyById(URI baseURL, @RequestHeader("Authorization") String header, @PathVariable(name = "id", required = true) String id); |
| 75 | + |
| 76 | + @RequestMapping(method = RequestMethod.PATCH, value="/{id}") |
| 77 | + OntapResponse<ExportPolicy> updateExportPolicy(URI baseURL, @RequestHeader("Authorization") String header, @PathVariable(name = "id", required = true) String id, |
| 78 | + @RequestBody ExportPolicy request); |
| 79 | +} |
0 commit comments