From d46b0b6382e6a58a19d4ec8c164e85f78350deeb Mon Sep 17 00:00:00 2001 From: "Gupta, Surya" Date: Thu, 16 Oct 2025 14:42:37 +0530 Subject: [PATCH 1/8] CSTACKEX-31 NAS and Job Feign Client and POJOs --- .../storage/feign/client/JobFeignClient.java | 42 +++ .../storage/feign/client/NASFeignClient.java | 79 +++++ .../feign/client/VolumeFeignClient.java | 34 +- .../storage/feign/model/ExportPolicy.java | 113 ++++++- .../storage/feign/model/ExportRule.java | 223 +++++++++++++ .../storage/feign/model/FileInfo.java | 312 ++++++++++++++++++ .../cloudstack/storage/feign/model/Job.java | 124 +++++++ .../feign/model/request/VolumeRequestDTO.java | 47 --- .../{JobResponseDTO.java => JobResponse.java} | 26 +- .../response/VolumeDetailsResponseDTO.java | 73 ---- 10 files changed, 895 insertions(+), 178 deletions(-) create mode 100644 plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/client/JobFeignClient.java create mode 100644 plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/client/NASFeignClient.java create mode 100644 plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/ExportRule.java create mode 100644 plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/FileInfo.java create mode 100644 plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/Job.java delete mode 100644 plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/request/VolumeRequestDTO.java rename plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/response/{JobResponseDTO.java => JobResponse.java} (58%) delete mode 100644 plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/response/VolumeDetailsResponseDTO.java diff --git a/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/client/JobFeignClient.java b/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/client/JobFeignClient.java new file mode 100644 index 000000000000..4becf7bb29c4 --- /dev/null +++ b/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/client/JobFeignClient.java @@ -0,0 +1,42 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.cloudstack.storage.feign.client; + +import org.apache.cloudstack.storage.feign.FeignConfiguration; +import org.apache.cloudstack.storage.feign.model.Job; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.context.annotation.Lazy; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestHeader; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import java.net.URI; + +/** + * @author Administrator + * + */ +@Lazy +@FeignClient(name = "JobClient", url = "https://{clusterIP}/api/cluster/jobs" , configuration = FeignConfiguration.class) +public interface JobFeignClient { + + @RequestMapping(method = RequestMethod.GET, value="/{uuid}") + Job getJobByUUID(URI baseURL, @RequestHeader("Authorization") String header, @PathVariable(name = "uuid", required = true) String uuid); + +} diff --git a/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/client/NASFeignClient.java b/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/client/NASFeignClient.java new file mode 100644 index 000000000000..c2314d1059a8 --- /dev/null +++ b/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/client/NASFeignClient.java @@ -0,0 +1,79 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.cloudstack.storage.feign.client; + +import org.apache.cloudstack.storage.feign.FeignConfiguration; +import org.apache.cloudstack.storage.feign.model.ExportPolicy; +import org.apache.cloudstack.storage.feign.model.FileInfo; +import org.apache.cloudstack.storage.feign.model.response.OntapResponse; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.context.annotation.Lazy; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestHeader; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMethod; +import java.net.URI; + +/** + * @author Administrator + * + */ +@Lazy +@FeignClient(name = "NASClient", url = "" , configuration = FeignConfiguration.class) +public interface NASFeignClient { + + //File Operations + + @RequestMapping(method = RequestMethod.GET, value="/{volume.uuid}/files/{path}") + OntapResponse getFileResponse(URI uri, @RequestHeader("Authorization") String header, @PathVariable(name = "volume.uuid", required = true) String volumeUUID, + @PathVariable(name = "path", required = true) String filePath); + @RequestMapping(method = RequestMethod.DELETE, value="/{volume.uuid}/files/{path}") + void deleteFile(URI uri, @RequestHeader("Authorization") String header, @PathVariable(name = "volume.uuid", required = true) String volumeUUID, + @PathVariable(name = "path", required = true) String filePath); + @RequestMapping(method = RequestMethod.PATCH, value="/{volume.uuid}/files/{path}") + void updateFile(URI uri, @RequestHeader("Authorization") String header, @PathVariable(name = "volume.uuid", required = true) String volumeUUID, + @PathVariable(name = "path", required = true) String filePath, @RequestBody FileInfo fileInfo); + @RequestMapping(method = RequestMethod.POST, value="/{volume.uuid}/files/{path}") + void createFile(URI uri, @RequestHeader("Authorization") String header, @PathVariable(name = "volume.uuid", required = true) String volumeUUID, + @PathVariable(name = "path", required = true) String filePath, @RequestBody FileInfo file); + + + + //Export Policy Operations + + @RequestMapping(method = RequestMethod.POST) + ExportPolicy createExportPolicy(URI uri, @RequestHeader("Authorization") String header, @RequestHeader("return_records") boolean value, + @RequestBody ExportPolicy exportPolicy); + + //this method to get all export policies and also filtered export policy based on query params as a part of URL + @RequestMapping(method = RequestMethod.GET) + OntapResponse getExportPolicyResponse(URI baseURL, @RequestHeader("Authorization") String header); + + @RequestMapping(method = RequestMethod.GET, value="/id}") + OntapResponse getExportPolicyById(URI baseURL, @RequestHeader("Authorization") String header, @PathVariable(name = "id", required = true) String id); + + @RequestMapping(method = RequestMethod.DELETE, value="/id}") + void deleteExportPolicyById(URI baseURL, @RequestHeader("Authorization") String header, @PathVariable(name = "id", required = true) String id); + + @RequestMapping(method = RequestMethod.PATCH, value="/id}") + OntapResponse updateExportPolicy(URI baseURL, @RequestHeader("Authorization") String header, @PathVariable(name = "id", required = true) String id, + @RequestBody ExportPolicy request); +} diff --git a/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/client/VolumeFeignClient.java b/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/client/VolumeFeignClient.java index 8218cffad6d6..0ab78ae67d1f 100644 --- a/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/client/VolumeFeignClient.java +++ b/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/client/VolumeFeignClient.java @@ -20,37 +20,29 @@ import org.apache.cloudstack.storage.feign.FeignConfiguration; -import org.apache.cloudstack.storage.feign.model.request.VolumeRequestDTO; -import org.apache.cloudstack.storage.feign.model.response.JobResponseDTO; -import org.apache.cloudstack.storage.feign.model.response.VolumeDetailsResponseDTO; +import org.apache.cloudstack.storage.feign.model.Volume; +import org.apache.cloudstack.storage.feign.model.response.JobResponse; import org.springframework.cloud.openfeign.FeignClient; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PatchMapping; import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestHeader; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMethod; @FeignClient(name = "VolumeClient", url = "https://{clusterIP}/api/storage/volumes", configuration = FeignConfiguration.class) public interface VolumeFeignClient { - @DeleteMapping("/storage/volumes/{id}") - void deleteVolume(@RequestHeader("Authorization") String authHeader, @PathVariable("id") String volumeId); + @RequestMapping(method = RequestMethod.DELETE, value="/{uuid}") + void deleteVolume(@RequestHeader("Authorization") String authHeader, @PathVariable("uuid") String uuid); - @PostMapping("/api/storage/volumes") - JobResponseDTO createVolumeWithJob(@RequestHeader("Authorization") String authHeader, @RequestBody VolumeRequestDTO request - ); + @RequestMapping(method = RequestMethod.POST) + JobResponse createVolumeWithJob(@RequestHeader("Authorization") String authHeader, @RequestBody Volume volumeRequest); - @GetMapping("/api/storage/volumes/{uuid}") - VolumeDetailsResponseDTO getVolumeDetails(@RequestHeader("Authorization") String authHeader, @PathVariable("uuid") String uuid - ); + @RequestMapping(method = RequestMethod.GET, value="/{uuid}") + Volume getVolumeByUUID(@RequestHeader("Authorization") String authHeader, @PathVariable("uuid") String uuid); - @PatchMapping("/api/storage/volumes/{uuid}") - org.apache.cloudstack.storage.feign.model.response.JobResponseDTO updateVolumeRebalancing(@RequestHeader("accept") String acceptHeader, - @PathVariable("uuid") String uuid, - @RequestBody org.apache.cloudstack.storage.feign.model.request.VolumeRequestDTO request - ); + @RequestMapping(method = RequestMethod.PATCH) + JobResponse updateVolumeRebalancing(@RequestHeader("accept") String acceptHeader, @PathVariable("uuid") String uuid, @RequestBody Volume volumeRequest); } diff --git a/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/ExportPolicy.java b/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/ExportPolicy.java index 489ecb3d4087..37dbac24b176 100644 --- a/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/ExportPolicy.java +++ b/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/ExportPolicy.java @@ -16,30 +16,111 @@ * specific language governing permissions and limitations * under the License. */ + package org.apache.cloudstack.storage.feign.model; import com.fasterxml.jackson.annotation.JsonInclude; - +import com.fasterxml.jackson.annotation.JsonProperty; +import java.math.BigInteger; +import java.util.List; import java.util.Objects; @JsonInclude(JsonInclude.Include.NON_NULL) public class ExportPolicy { - private String name; - private long id; - public String getName() { return name; } - public void setName(String name) { this.name = name; } - public long getId() { return id; } - public void setId(long id) { this.id = id; } - - @Override - public boolean equals(Object o) { - if (o == null || getClass() != o.getClass()) return false; - ExportPolicy that = (ExportPolicy) o; - return getId() == that.getId(); + + @JsonProperty("id") + private BigInteger id = null; + @JsonProperty("name") + private String name = null; + @JsonProperty("rules") + private List rules = null; + @JsonProperty("svm") + private Svm svm = null; + + public BigInteger getId() { + return id; + } + + public ExportPolicy name(String name) { + this.name = name; + return this; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public ExportPolicy rules(List rules) { + this.rules = rules; + return this; + } + + public List getRules() { + return rules; + } + + public void setRules(List rules) { + this.rules = rules; + } + + public ExportPolicy svm(Svm svm) { + this.svm = svm; + return this; + } + + public Svm getSvm() { + return svm; + } + + public void setSvm(Svm svm) { + this.svm = svm; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } + if (o == null || getClass() != o.getClass()) { + return false; + } + ExportPolicy exportPolicy = (ExportPolicy) o; + return Objects.equals(this.id, exportPolicy.id) && + Objects.equals(this.name, exportPolicy.name); + } + + @Override + public int hashCode() { + return Objects.hash( id, name, rules, svm); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ExportPolicy {\n"); + + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" rules: ").append(toIndentedString(rules)).append("\n"); + sb.append(" svm: ").append(toIndentedString(svm)).append("\n"); + sb.append("}"); + return sb.toString(); + } - @Override - public int hashCode() { - return Objects.hashCode(getId()); + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; } + return o.toString().replace("\n", "\n "); + } } diff --git a/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/ExportRule.java b/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/ExportRule.java new file mode 100644 index 000000000000..2bd934cf4527 --- /dev/null +++ b/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/ExportRule.java @@ -0,0 +1,223 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.cloudstack.storage.feign.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +/** + * ExportRule + */ +@JsonInclude(JsonInclude.Include.NON_NULL) +public class ExportRule { + @JsonProperty("anonymous_user") + private String anonymousUser ; + + @JsonProperty("clients") + private List clients = null; + + @JsonProperty("index") + private Integer index = null; + + public enum ProtocolsEnum { + any("any"), + + nfs("nfs"), + + nfs3("nfs3"), + + nfs4("nfs4"), + + cifs("cifs"), + + flexcache("flexcache"); + + private String value; + + ProtocolsEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static ProtocolsEnum fromValue(String text) { + for (ProtocolsEnum b : ProtocolsEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + return null; + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final ProtocolsEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public ProtocolsEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return ProtocolsEnum.fromValue(String.valueOf(value)); + } + } + } + + @JsonProperty("protocols") + private List protocols = null; + + public ExportRule anonymousUser(String anonymousUser) { + this.anonymousUser = anonymousUser; + return this; + } + + public String getAnonymousUser() { + return anonymousUser; + } + + public void setAnonymousUser(String anonymousUser) { + this.anonymousUser = anonymousUser; + } + + public ExportRule clients(List clients) { + this.clients = clients; + return this; + } + + public ExportRule addClientsItem(ExportClient clientsItem) { + if (this.clients == null) { + this.clients = new ArrayList(); + } + this.clients.add(clientsItem); + return this; + } + + public List getClients() { + return clients; + } + + public void setClients(List clients) { + this.clients = clients; + } + + public Integer getIndex() { + return index; + } + public void setIndex(Integer index) + { + this.index=index; + } + + public ExportRule protocols(List protocols) { + this.protocols = protocols; + return this; + } + + public ExportRule addProtocolsItem(ProtocolsEnum protocolsItem) { + if (this.protocols == null) { + this.protocols = new ArrayList(); + } + this.protocols.add(protocolsItem); + return this; + } + + public List getProtocols() { + return protocols; + } + + public void setProtocols(List protocols) { + this.protocols = protocols; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ExportRule exportRule = (ExportRule) o; + return Objects.equals(this.anonymousUser, exportRule.anonymousUser) + && Objects.equals(this.clients, exportRule.clients) && Objects.equals(this.index, exportRule.index) + && Objects.equals(this.protocols, exportRule.protocols); + } + + @Override + public int hashCode() { + return Objects.hash(anonymousUser, clients, index, protocols); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ExportRule {\n"); + + sb.append(" anonymousUser: ").append(toIndentedString(anonymousUser)).append("\n"); + sb.append(" clients: ").append(toIndentedString(clients)).append("\n"); + sb.append(" index: ").append(toIndentedString(index)).append("\n"); + sb.append(" protocols: ").append(toIndentedString(protocols)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static class ExportClient { + @JsonProperty("match") + private String match = null; + + public ExportClient match (String match) { + this.match = match; + return this; + } + public String getMatch () { + return match; + } + + public void setMatch (String match) { + this.match = match; + } + } + +} diff --git a/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/FileInfo.java b/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/FileInfo.java new file mode 100644 index 000000000000..b2c81a1f0261 --- /dev/null +++ b/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/FileInfo.java @@ -0,0 +1,312 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.cloudstack.storage.feign.model; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; + +import java.time.OffsetDateTime; +import java.util.Objects; + +/** + * Information about a single file. + */ +@JsonInclude(JsonInclude.Include.NON_NULL) +public class FileInfo { + @JsonProperty("bytes_used") + private Long bytesUsed = null; + @JsonProperty("creation_time") + private OffsetDateTime creationTime = null; + @JsonProperty("fill_enabled") + private Boolean fillEnabled = null; + @JsonProperty("is_empty") + private Boolean isEmpty = null; + @JsonProperty("is_snapshot") + private Boolean isSnapshot = null; + @JsonProperty("is_vm_aligned") + private Boolean isVmAligned = null; + @JsonProperty("modified_time") + private OffsetDateTime modifiedTime = null; + @JsonProperty("name") + private String name = null; + @JsonProperty("overwrite_enabled") + private Boolean overwriteEnabled = null; + @JsonProperty("path") + private String path = null; + @JsonProperty("size") + private Long size = null; + @JsonProperty("target") + private String target = null; + + /** + * Type of the file. + */ + public enum TypeEnum { + FILE("file"), + + DIRECTORY("directory"), + + BLOCKDEV("blockdev"), + + CHARDEV("chardev"), + + SYMLINK("symlink"), + + SOCKET("socket"), + + FIFO("fifo"), + + STREAM("stream"), + + LUN("lun"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return null; + } + } + + @JsonProperty("type") + private TypeEnum type = null; + + @JsonProperty("unique_bytes") + private Long uniqueBytes = null; + + @JsonProperty("unix_permissions") + private Integer unixPermissions = null; + + /** + * The actual number of bytes used on disk by this file. If byte_offset and length parameters are specified, this will return the bytes used by the file within the given range. + * @return bytesUsed + **/ + public Long getBytesUsed() { + return bytesUsed; + } + + public OffsetDateTime getCreationTime() { + return creationTime; + } + + public FileInfo fillEnabled(Boolean fillEnabled) { + this.fillEnabled = fillEnabled; + return this; + } + + public Boolean isFillEnabled() { + return fillEnabled; + } + + public void setFillEnabled(Boolean fillEnabled) { + this.fillEnabled = fillEnabled; + } + + + public Boolean isIsEmpty() { + return isEmpty; + } + + public void setIsEmpty(Boolean isEmpty) { + this.isEmpty = isEmpty; + } + + public Boolean isIsSnapshot() { + return isSnapshot; + } + + public void setIsSnapshot(Boolean isSnapshot) { + this.isSnapshot = isSnapshot; + } + + + public Boolean isIsVmAligned() { + return isVmAligned; + } + + + public OffsetDateTime getModifiedTime() { + return modifiedTime; + } + + public FileInfo name(String name) { + this.name = name; + return this; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public FileInfo overwriteEnabled(Boolean overwriteEnabled) { + this.overwriteEnabled = overwriteEnabled; + return this; + } + + public Boolean isOverwriteEnabled() { + return overwriteEnabled; + } + + public void setOverwriteEnabled(Boolean overwriteEnabled) { + this.overwriteEnabled = overwriteEnabled; + } + + public FileInfo path(String path) { + this.path = path; + return this; + } + + public String getPath() { + return path; + } + + public void setPath(String path) { + this.path = path; + } + public Long getSize() { + return size; + } + + public void setSize(Long size) { + this.size = size; + } + + public FileInfo target(String target) { + this.target = target; + return this; + } + + public String getTarget() { + return target; + } + + public void setTarget(String target) { + this.target = target; + } + + public FileInfo type(TypeEnum type) { + this.type = type; + return this; + } + + public TypeEnum getType() { + return type; + } + + public void setType(TypeEnum type) { + this.type = type; + } + + public Long getUniqueBytes() { + return uniqueBytes; + } + + public FileInfo unixPermissions(Integer unixPermissions) { + this.unixPermissions = unixPermissions; + return this; + } + + public Integer getUnixPermissions() { + return unixPermissions; + } + + public void setUnixPermissions(Integer unixPermissions) { + this.unixPermissions = unixPermissions; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FileInfo fileInfo = (FileInfo) o; + return Objects.equals(this.name, fileInfo.name) && + Objects.equals(this.path, fileInfo.path); + } + + @Override + public int hashCode() { + return Objects.hash(bytesUsed, creationTime, fillEnabled, isEmpty, isSnapshot, isVmAligned, modifiedTime, name, overwriteEnabled, path, size, target, type, uniqueBytes, unixPermissions); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FileInfo {\n"); + sb.append(" bytesUsed: ").append(toIndentedString(bytesUsed)).append("\n"); + sb.append(" creationTime: ").append(toIndentedString(creationTime)).append("\n"); + sb.append(" fillEnabled: ").append(toIndentedString(fillEnabled)).append("\n"); + sb.append(" isEmpty: ").append(toIndentedString(isEmpty)).append("\n"); + sb.append(" isSnapshot: ").append(toIndentedString(isSnapshot)).append("\n"); + sb.append(" isVmAligned: ").append(toIndentedString(isVmAligned)).append("\n"); + sb.append(" modifiedTime: ").append(toIndentedString(modifiedTime)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" overwriteEnabled: ").append(toIndentedString(overwriteEnabled)).append("\n"); + sb.append(" path: ").append(toIndentedString(path)).append("\n"); + sb.append(" size: ").append(toIndentedString(size)).append("\n"); + sb.append(" target: ").append(toIndentedString(target)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" uniqueBytes: ").append(toIndentedString(uniqueBytes)).append("\n"); + sb.append(" unixPermissions: ").append(toIndentedString(unixPermissions)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/Job.java b/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/Job.java new file mode 100644 index 000000000000..5693b1ff5c1e --- /dev/null +++ b/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/Job.java @@ -0,0 +1,124 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.cloudstack.storage.feign.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * @author Administrator + * + */ +@JsonInclude(Include.NON_NULL) +public class Job { + + @JsonProperty("uuid") + String uuid; + @JsonProperty("description") + String description; + @JsonProperty("state") + String state; + @JsonProperty("message") + String message; + @JsonProperty("code") + String code; + @JsonProperty("_links") + private Links links; + + @JsonProperty("error") + private JobError error; + public JobError getError () { return error; } + public void setError (JobError error) { this.error = error; } + public Links getLinks() { return links; } + public void setLinks(Links links) { this.links = links; } + public String getUuid() { + return uuid; + } + public void setUuid(String uuid) { + this.uuid = uuid; + } + public String getDescription() { + return description; + } + public void setDescription(String description) { + this.description = description; + } + public String getState() { + return state; + } + public void setState(String state) { + this.state = state; + } + public String getMessage() { + return message; + } + public void setMessage(String message) { + this.message = message; + } + public String getCode() { + return code; + } + public void setCode(String code) { + this.code = code; + } + @Override + public String toString() { + return "JobDTO [uuid=" + uuid + ", description=" + description + ", state=" + state + ", message=" + + message + ", code=" + code + "]"; + } + + public static class Links { + @JsonProperty("message") + private Self self; + public Self getSelf() { return self; } + public void setSelf(Self self) { this.self = self; } + } + + public static class Self { + @JsonProperty("message") + private String href; + public String getHref() { return href; } + public void setHref(String href) { this.href = href; } + } + + public static class JobError { + @JsonProperty("message") + String messsage; + @JsonProperty("code") + String code; + // Getters and Setters + public String getMessage() { + return messsage; + } + public void setMessage(String messsage) { + this.messsage = messsage; + } + public String getCode() { + return code; + } + public void setCode(String code) { + this.code = code; + } + @Override + public String toString() { + return "JobError [messsage=" + messsage + ", code=" + code + "]"; + } + } +} diff --git a/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/request/VolumeRequestDTO.java b/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/request/VolumeRequestDTO.java deleted file mode 100644 index 7f758211fe86..000000000000 --- a/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/request/VolumeRequestDTO.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.cloudstack.storage.feign.model.request; - -import java.util.List; - -public class VolumeRequestDTO { - private String name; - private List aggregates; - private SvmDTO svm; - - // getters and setters - public String getName() { return name; } - public void setName(String name) { this.name = name; } - public List getAggregates() { return aggregates; } - public void setAggregates(List aggregates) { this.aggregates = aggregates; } - public SvmDTO getSvm() { return svm; } - public void setSvm(SvmDTO svm) { this.svm = svm; } - - public static class AggregateDTO { - private String name; - public String getName() { return name; } - public void setName(String name) { this.name = name; } - } - - public static class SvmDTO { - private String name; - public String getName() { return name; } - public void setName(String name) { this.name = name; } - } -} diff --git a/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/response/JobResponseDTO.java b/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/response/JobResponse.java similarity index 58% rename from plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/response/JobResponseDTO.java rename to plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/response/JobResponse.java index b90806c63420..a794c191c493 100644 --- a/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/response/JobResponseDTO.java +++ b/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/response/JobResponse.java @@ -18,29 +18,13 @@ */ package org.apache.cloudstack.storage.feign.model.response; -public class JobResponseDTO { +import com.fasterxml.jackson.annotation.JsonProperty; +import org.apache.cloudstack.storage.feign.model.Job; + +public class JobResponse { + @JsonProperty("job") private Job job; public Job getJob() { return job; } public void setJob(Job job) { this.job = job; } - public static class Job { - private String uuid; - private Links links; - public String getUuid() { return uuid; } - public void setUuid(String uuid) { this.uuid = uuid; } - public Links getLinks() { return links; } - public void setLinks(Links links) { this.links = links; } - } - - public static class Links { - private Self self; - public Self getSelf() { return self; } - public void setSelf(Self self) { this.self = self; } - } - - public static class Self { - private String href; - public String getHref() { return href; } - public void setHref(String href) { this.href = href; } - } } diff --git a/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/response/VolumeDetailsResponseDTO.java b/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/response/VolumeDetailsResponseDTO.java deleted file mode 100644 index e7016dbc6801..000000000000 --- a/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/response/VolumeDetailsResponseDTO.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.cloudstack.storage.feign.model.response; - - -import org.apache.cloudstack.storage.feign.model.Aggregate; -import org.apache.cloudstack.storage.feign.model.Nas; -import org.apache.cloudstack.storage.feign.model.Qos; - -import java.util.List; - -public class VolumeDetailsResponseDTO { - private String uuid; - private String createTime; - private String name; - private long size; - private String state; - private String style; - private List aggregates; - private Nas nas; - private Qos qos; - private Svm svm; - private String antiRansomwareState; - - // getters and setters - public String getUuid() { return uuid; } - public void setUuid(String uuid) { this.uuid = uuid; } - public String getCreateTime() { return createTime; } - public void setCreateTime(String createTime) { this.createTime = createTime; } - public String getName() { return name; } - public void setName(String name) { this.name = name; } - public long getSize() { return size; } - public void setSize(long size) { this.size = size; } - public String getState() { return state; } - public void setState(String state) { this.state = state; } - public String getStyle() { return style; } - public void setStyle(String style) { this.style = style; } - public List getAggregates() { return aggregates; } - public void setAggregates(List aggregates) { this.aggregates = aggregates; } - public Nas getNas() { return nas; } - public void setNas(Nas nas) { this.nas = nas; } - public Qos getQos() { return qos; } - public void setQos(Qos qos) { this.qos = qos; } - public Svm getSvm() { return svm; } - public void setSvm(Svm svm) { this.svm = svm; } - public String getAntiRansomwareState() { return antiRansomwareState; } - public void setAntiRansomwareState(String antiRansomwareState) { this.antiRansomwareState = antiRansomwareState; } - - public static class Svm { - private String name; - private String uuid; - public String getName() { return name; } - public void setName(String name) { this.name = name; } - public String getUuid() { return uuid; } - public void setUuid(String uuid) { this.uuid = uuid; } - } -} From 2f3b41f7cecfceb9972aee04f2270de7c0e4bdf9 Mon Sep 17 00:00:00 2001 From: "Gupta, Surya" Date: Thu, 16 Oct 2025 14:55:59 +0530 Subject: [PATCH 2/8] CSTACKEX-31 Fixed Checks Issues --- .../storage/feign/model/ExportPolicy.java | 6 ------ .../cloudstack/storage/feign/model/FileInfo.java | 2 -- .../apache/cloudstack/storage/feign/model/Job.java | 13 ++++--------- 3 files changed, 4 insertions(+), 17 deletions(-) diff --git a/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/ExportPolicy.java b/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/ExportPolicy.java index 37dbac24b176..be78639844b3 100644 --- a/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/ExportPolicy.java +++ b/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/ExportPolicy.java @@ -104,7 +104,6 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class ExportPolicy {\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); sb.append(" rules: ").append(toIndentedString(rules)).append("\n"); @@ -112,11 +111,6 @@ public String toString() { sb.append("}"); return sb.toString(); } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ private String toIndentedString(Object o) { if (o == null) { return "null"; diff --git a/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/FileInfo.java b/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/FileInfo.java index b2c81a1f0261..124603136f51 100644 --- a/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/FileInfo.java +++ b/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/FileInfo.java @@ -307,6 +307,4 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } - } - diff --git a/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/Job.java b/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/Job.java index 5693b1ff5c1e..a1a0c2698f14 100644 --- a/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/Job.java +++ b/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/Job.java @@ -100,16 +100,11 @@ public static class Self { public static class JobError { @JsonProperty("message") - String messsage; + String errorMesssage; @JsonProperty("code") String code; - // Getters and Setters - public String getMessage() { - return messsage; - } - public void setMessage(String messsage) { - this.messsage = messsage; - } + public String getErrorMesssage () { return errorMesssage; } + public void setErrorMesssage (String errorMesssage) { this.errorMesssage = errorMesssage; } public String getCode() { return code; } @@ -118,7 +113,7 @@ public void setCode(String code) { } @Override public String toString() { - return "JobError [messsage=" + messsage + ", code=" + code + "]"; + return "JobError [errorMesssage=" + errorMesssage + ", code=" + code + "]"; } } } From 88bba44cd5d7d05d53fec155ce21e46309b90a1f Mon Sep 17 00:00:00 2001 From: "Gupta, Surya" Date: Thu, 16 Oct 2025 15:15:22 +0530 Subject: [PATCH 3/8] CSTACKEX-31 Resolve Review Comments --- .../storage/feign/model/ExportRule.java | 65 ++++--------------- .../storage/feign/model/FileInfo.java | 17 +---- 2 files changed, 15 insertions(+), 67 deletions(-) diff --git a/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/ExportRule.java b/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/ExportRule.java index 2bd934cf4527..29cac0483f34 100644 --- a/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/ExportRule.java +++ b/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/ExportRule.java @@ -28,7 +28,6 @@ import java.io.IOException; import java.util.ArrayList; import java.util.List; -import java.util.Objects; /** * ExportRule @@ -51,11 +50,7 @@ public enum ProtocolsEnum { nfs3("nfs3"), - nfs4("nfs4"), - - cifs("cifs"), - - flexcache("flexcache"); + nfs4("nfs4"); private String value; @@ -116,14 +111,6 @@ public ExportRule clients(List clients) { return this; } - public ExportRule addClientsItem(ExportClient clientsItem) { - if (this.clients == null) { - this.clients = new ArrayList(); - } - this.clients.add(clientsItem); - return this; - } - public List getClients() { return clients; } @@ -160,23 +147,22 @@ public List getProtocols() { public void setProtocols(List protocols) { this.protocols = protocols; } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + + public static class ExportClient { + @JsonProperty("match") + private String match = null; + + public ExportClient match (String match) { + this.match = match; + return this; } - if (o == null || getClass() != o.getClass()) { - return false; + public String getMatch () { + return match; } - ExportRule exportRule = (ExportRule) o; - return Objects.equals(this.anonymousUser, exportRule.anonymousUser) - && Objects.equals(this.clients, exportRule.clients) && Objects.equals(this.index, exportRule.index) - && Objects.equals(this.protocols, exportRule.protocols); - } - @Override - public int hashCode() { - return Objects.hash(anonymousUser, clients, index, protocols); + public void setMatch (String match) { + this.match = match; + } } @Override @@ -191,33 +177,10 @@ public String toString() { sb.append("}"); return sb.toString(); } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ private String toIndentedString(Object o) { if (o == null) { return "null"; } return o.toString().replace("\n", "\n "); } - - public static class ExportClient { - @JsonProperty("match") - private String match = null; - - public ExportClient match (String match) { - this.match = match; - return this; - } - public String getMatch () { - return match; - } - - public void setMatch (String match) { - this.match = match; - } - } - } diff --git a/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/FileInfo.java b/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/FileInfo.java index 124603136f51..b67704435a9e 100644 --- a/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/FileInfo.java +++ b/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/FileInfo.java @@ -62,22 +62,7 @@ public class FileInfo { */ public enum TypeEnum { FILE("file"), - - DIRECTORY("directory"), - - BLOCKDEV("blockdev"), - - CHARDEV("chardev"), - - SYMLINK("symlink"), - - SOCKET("socket"), - - FIFO("fifo"), - - STREAM("stream"), - - LUN("lun"); + DIRECTORY("directory"); private String value; From 5d03aaeaf6f39612a60913459b8a5b45ae2d48b2 Mon Sep 17 00:00:00 2001 From: "Gupta, Surya" Date: Thu, 16 Oct 2025 15:16:53 +0530 Subject: [PATCH 4/8] CSTACKEX-31 Resolve Review Comments --- .../cloudstack/storage/feign/client/VolumeFeignClient.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/client/VolumeFeignClient.java b/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/client/VolumeFeignClient.java index 0ab78ae67d1f..fb3c9712d750 100644 --- a/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/client/VolumeFeignClient.java +++ b/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/client/VolumeFeignClient.java @@ -23,6 +23,7 @@ import org.apache.cloudstack.storage.feign.model.Volume; import org.apache.cloudstack.storage.feign.model.response.JobResponse; import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.context.annotation.Lazy; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestHeader; import org.springframework.web.bind.annotation.RequestMapping; @@ -30,6 +31,7 @@ import org.springframework.web.bind.annotation.RequestMethod; +@Lazy @FeignClient(name = "VolumeClient", url = "https://{clusterIP}/api/storage/volumes", configuration = FeignConfiguration.class) public interface VolumeFeignClient { From 6a763487dcf29b2a69db96147fa5127e176e844e Mon Sep 17 00:00:00 2001 From: "Gupta, Surya" Date: Thu, 16 Oct 2025 15:17:52 +0530 Subject: [PATCH 5/8] CSTACKEX-31 Resolve Review Comments --- .../main/java/org/apache/cloudstack/storage/feign/model/Nas.java | 1 - 1 file changed, 1 deletion(-) diff --git a/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/Nas.java b/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/Nas.java index 5fdd1f772f0f..27590d3fde25 100644 --- a/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/Nas.java +++ b/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/Nas.java @@ -45,5 +45,4 @@ public void setExportPolicy(ExportPolicy exportPolicy) { this.exportPolicy = exportPolicy; } - } From 535289c10d3b29c0522c566237fd15c590f31741 Mon Sep 17 00:00:00 2001 From: "Gupta, Surya" Date: Thu, 16 Oct 2025 16:45:31 +0530 Subject: [PATCH 6/8] CSTACKEX-31 Added Aggr and size to volume model --- .../cloudstack/storage/feign/model/Volume.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/Volume.java b/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/Volume.java index 73d11312bc0e..3d384c56db2e 100644 --- a/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/Volume.java +++ b/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/Volume.java @@ -22,6 +22,7 @@ import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; import java.util.Objects; @JsonInclude(JsonInclude.Include.NON_NULL) @@ -50,6 +51,12 @@ public class Volume { @JsonProperty("anti_ransomware") private AntiRansomware antiRansomware; + @JsonProperty("aggregates") + private List aggregates = null; + + @JsonProperty("size") + private Long size = null; + // Getters and setters public String getUuid() { return uuid; @@ -111,6 +118,15 @@ public void setAntiRansomware(AntiRansomware antiRansomware) { this.antiRansomware = antiRansomware; } + public List getAggregates () { return aggregates; } + + public void setAggregates (List aggregates) { this.aggregates = aggregates; } + + public Long getSize () { return size; } + + public void setSize (Long size) { this.size = size; } + + @Override public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) return false; From 558bd197bb54c9b4cead816ca71be11a07d4e582 Mon Sep 17 00:00:00 2001 From: "Gupta, Surya" Date: Fri, 17 Oct 2025 10:44:27 +0530 Subject: [PATCH 7/8] CSTACKEX-31 Change the export policy endpoint path --- .../storage/feign/client/NASFeignClient.java | 6 +++--- .../storage/feign/model/ExportRule.java | 21 ------------------- 2 files changed, 3 insertions(+), 24 deletions(-) diff --git a/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/client/NASFeignClient.java b/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/client/NASFeignClient.java index c2314d1059a8..6e7b37d9378f 100644 --- a/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/client/NASFeignClient.java +++ b/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/client/NASFeignClient.java @@ -67,13 +67,13 @@ ExportPolicy createExportPolicy(URI uri, @RequestHeader("Authorization") String @RequestMapping(method = RequestMethod.GET) OntapResponse getExportPolicyResponse(URI baseURL, @RequestHeader("Authorization") String header); - @RequestMapping(method = RequestMethod.GET, value="/id}") + @RequestMapping(method = RequestMethod.GET, value="/{id}") OntapResponse getExportPolicyById(URI baseURL, @RequestHeader("Authorization") String header, @PathVariable(name = "id", required = true) String id); - @RequestMapping(method = RequestMethod.DELETE, value="/id}") + @RequestMapping(method = RequestMethod.DELETE, value="/{id}") void deleteExportPolicyById(URI baseURL, @RequestHeader("Authorization") String header, @PathVariable(name = "id", required = true) String id); - @RequestMapping(method = RequestMethod.PATCH, value="/id}") + @RequestMapping(method = RequestMethod.PATCH, value="/{id}") OntapResponse updateExportPolicy(URI baseURL, @RequestHeader("Authorization") String header, @PathVariable(name = "id", required = true) String id, @RequestBody ExportPolicy request); } diff --git a/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/ExportRule.java b/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/ExportRule.java index 29cac0483f34..604fd02d1570 100644 --- a/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/ExportRule.java +++ b/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/ExportRule.java @@ -75,19 +75,6 @@ public static ProtocolsEnum fromValue(String text) { } return null; } - - public static class Adapter extends TypeAdapter { - @Override - public void write(final JsonWriter jsonWriter, final ProtocolsEnum enumeration) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public ProtocolsEnum read(final JsonReader jsonReader) throws IOException { - String value = jsonReader.nextString(); - return ProtocolsEnum.fromValue(String.valueOf(value)); - } - } } @JsonProperty("protocols") @@ -132,14 +119,6 @@ public ExportRule protocols(List protocols) { return this; } - public ExportRule addProtocolsItem(ProtocolsEnum protocolsItem) { - if (this.protocols == null) { - this.protocols = new ArrayList(); - } - this.protocols.add(protocolsItem); - return this; - } - public List getProtocols() { return protocols; } From 9380d57c90141eaa05a01f9511b2c89dead07f03 Mon Sep 17 00:00:00 2001 From: "Gupta, Surya" Date: Fri, 17 Oct 2025 11:12:09 +0530 Subject: [PATCH 8/8] CSTACKEX-31 Fixed check styles --- .../apache/cloudstack/storage/feign/model/ExportRule.java | 6 ------ 1 file changed, 6 deletions(-) diff --git a/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/ExportRule.java b/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/ExportRule.java index 604fd02d1570..6d4798667075 100644 --- a/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/ExportRule.java +++ b/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/ExportRule.java @@ -21,12 +21,6 @@ import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; -import com.google.gson.TypeAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; - -import java.io.IOException; -import java.util.ArrayList; import java.util.List; /**