shwstppr commented on code in PR #7873:
URL: https://github.com/apache/cloudstack/pull/7873#discussion_r1324218328


##########
api/src/main/java/org/apache/cloudstack/api/command/user/snapshot/CopySnapshotCmd.java:
##########
@@ -0,0 +1,178 @@
+// 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.api.command.user.snapshot;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiCommandResourceType;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ResponseObject;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.command.user.UserCmd;
+import org.apache.cloudstack.api.response.SnapshotResponse;
+import org.apache.cloudstack.api.response.ZoneResponse;
+import org.apache.cloudstack.context.CallContext;
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.log4j.Logger;
+
+import com.cloud.dc.DataCenter;
+import com.cloud.event.EventTypes;
+import com.cloud.exception.ResourceAllocationException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.exception.StorageUnavailableException;
+import com.cloud.storage.Snapshot;
+import com.cloud.user.Account;
+
+@APICommand(name = "copySnapshot", description = "Copies a snapshot from one 
zone to another.", responseObject = SnapshotResponse.class, responseView = 
ResponseObject.ResponseView.Restricted,
+        requestHasSensitiveInfo = false, responseHasSensitiveInfo = false, 
since = "4.19.0")
+public class CopySnapshotCmd extends BaseAsyncCmd implements UserCmd {
+    public static final Logger s_logger = 
Logger.getLogger(CopySnapshotCmd.class.getName());
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+
+    @Parameter(name = ApiConstants.ID, type = CommandType.UUID,
+            entityType = SnapshotResponse.class, required = true, description 
= "the ID of the snapshot.")
+    private Long id;
+
+    @Parameter(name = ApiConstants.SOURCE_ZONE_ID,
+            type = CommandType.UUID,
+            entityType = ZoneResponse.class,
+            description = "ID of the zone in which the snapshot is currently 
present. " +
+                    "If not specified and zone in which the volume of the 
snapshot is present will be used.")
+    private Long sourceZoneId;
+
+    @Parameter(name = ApiConstants.DESTINATION_ZONE_ID,
+            type = CommandType.UUID,
+            entityType = ZoneResponse.class,
+            required = false,
+            description = "the ID of the zone the snapshot is being copied 
to.")
+    protected Long destZoneId;
+
+    @Parameter(name = ApiConstants.DESTINATION_ZONE_ID_LIST,
+            type=CommandType.LIST,
+            collectionType = CommandType.UUID,
+            entityType = ZoneResponse.class,
+            required = false,
+            description = "A comma-separated list of IDs of the zones that the 
snapshot needs to be copied to." +
+                    "Specify this list if the snapshot needs to copied to 
multiple zones in one go. " +
+                    "Do not specify destzoneid and destzoneids together, 
however one of them is required.")
+    protected List<Long> destZoneIds;

Review Comment:
   @vishesh92 I agree but this is consistent with `copyTemplate` API. Should we 
still use just one param? cc @harikrishna-patnala 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to