Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@

import feign.QueryMap;
import org.apache.cloudstack.storage.feign.model.ExportPolicy;
import org.apache.cloudstack.storage.feign.model.FileCloneRequest;
import org.apache.cloudstack.storage.feign.model.FileInfo;
import org.apache.cloudstack.storage.feign.model.response.JobResponse;
import org.apache.cloudstack.storage.feign.model.response.OntapResponse;
import feign.Headers;
import feign.Param;
Expand Down Expand Up @@ -58,6 +60,15 @@ void createFile(@Param("authHeader") String authHeader,
@Param("path") String filePath,
FileInfo file);

/**
* Creates a space-efficient clone of a file within a FlexVolume.
*
* <p>ONTAP REST: {@code POST /api/storage/file/clone}</p>
*/
@RequestLine("POST /api/storage/file/clone")
@Headers({"Authorization: {authHeader}", "Content-Type: application/json"})
JobResponse cloneFile(@Param("authHeader") String authHeader, FileCloneRequest request);

// Export Policy Operations
@RequestLine("POST /api/protocols/nfs/export-policies")
@Headers({"Authorization: {authHeader}"})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ public interface SANFeignClient {
@Headers({"Authorization: {authHeader}"})
Lun getLunByUUID(@Param("authHeader") String authHeader, @Param("uuid") String uuid);

@RequestLine("PATCH /{uuid}")
@Headers({"Authorization: {authHeader}"})
@RequestLine("PATCH /api/storage/luns/{uuid}")
@Headers({"Authorization: {authHeader}", "Content-Type: application/json"})
void updateLun(@Param("authHeader") String authHeader, @Param("uuid") String uuid, Lun lun);

@RequestLine("DELETE /api/storage/luns/{uuid}")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
/*
* 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.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;

/**
* Request body for the ONTAP file clone API.
*
* <p>ONTAP REST endpoint: {@code POST /api/storage/file/clone}</p>
*
* <p>Creates a space-efficient copy of a file. Source and destination paths are relative to the
* root of {@code volume}, and both must live in that same FlexVolume.</p>
*/
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class FileCloneRequest {

@JsonProperty("volume")
private VolumeRef volume;

@JsonProperty("source_path")
private String sourcePath;

@JsonProperty("destination_path")
private String destinationPath;

@JsonProperty("overwrite_destination")
private Boolean overwriteDestination;

public FileCloneRequest() {
}

public FileCloneRequest(String flexVolUuid, String flexVolName, String sourcePath, String destinationPath) {
this.volume = new VolumeRef(flexVolUuid, flexVolName);
this.sourcePath = sourcePath;
this.destinationPath = destinationPath;
}

public VolumeRef getVolume() {
return volume;
}

public void setVolume(VolumeRef volume) {
this.volume = volume;
}

public String getSourcePath() {
return sourcePath;
}

public void setSourcePath(String sourcePath) {
this.sourcePath = sourcePath;
}

public String getDestinationPath() {
return destinationPath;
}

public void setDestinationPath(String destinationPath) {
this.destinationPath = destinationPath;
}

public Boolean getOverwriteDestination() {
return overwriteDestination;
}

public void setOverwriteDestination(Boolean overwriteDestination) {
this.overwriteDestination = overwriteDestination;
}

@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
public static class VolumeRef {

@JsonProperty("uuid")
private String uuid;

@JsonProperty("name")
private String name;

public VolumeRef() {
}

public VolumeRef(String uuid, String name) {
this.uuid = uuid;
this.name = name;
}

public String getUuid() {
return uuid;
}

public void setUuid(String uuid) {
this.uuid = uuid;
}

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}
}

@Override
public String toString() {
return "FileCloneRequest{volume=" + (volume != null ? volume.getUuid() : null)
+ ", sourcePath=" + sourcePath
+ ", destinationPath=" + destinationPath + "}";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,7 @@ private String toIndentedString(Object o) {
}


@JsonInclude(JsonInclude.Include.NON_NULL)
public static class Clone {
@JsonProperty("source")
private Source source = null;
Expand All @@ -319,6 +320,7 @@ public void setSource(Source source) {
}
}

@JsonInclude(JsonInclude.Include.NON_NULL)
public static class Source {
@JsonProperty("name")
private String name = null;
Expand Down
Loading