Skip to content

Commit 108651a

Browse files
authored
api: make displaytext form upload template/iso optional (#8289)
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
1 parent 5651eab commit 108651a

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

api/src/main/java/org/apache/cloudstack/api/command/user/iso/GetUploadParamsForIsoCmd.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import org.apache.cloudstack.api.response.GetUploadParamsResponse;
3030
import org.apache.cloudstack.api.response.GuestOSResponse;
3131
import org.apache.cloudstack.context.CallContext;
32+
import org.apache.commons.lang3.StringUtils;
3233

3334
import com.cloud.exception.ConcurrentOperationException;
3435
import com.cloud.exception.InsufficientCapacityException;
@@ -54,7 +55,6 @@ public class GetUploadParamsForIsoCmd extends AbstractGetUploadParamsCmd {
5455

5556
@Parameter(name = ApiConstants.DISPLAY_TEXT,
5657
type = BaseCmd.CommandType.STRING,
57-
required = true,
5858
description = "the display text of the ISO. This is usually used for display purposes.",
5959
length = 4096)
6060
private String displayText;
@@ -85,7 +85,7 @@ public Boolean isBootable() {
8585
}
8686

8787
public String getDisplayText() {
88-
return displayText;
88+
return StringUtils.isBlank(displayText) ? getName() : displayText;
8989
}
9090

9191
public Boolean isFeatured() {

api/src/main/java/org/apache/cloudstack/api/command/user/template/GetUploadParamsForTemplateCmd.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import org.apache.cloudstack.api.response.GetUploadParamsResponse;
3434
import org.apache.cloudstack.api.response.GuestOSResponse;
3535
import org.apache.cloudstack.context.CallContext;
36+
import org.apache.commons.lang3.StringUtils;
3637
import org.apache.log4j.Logger;
3738

3839
import com.cloud.exception.ResourceAllocationException;
@@ -46,7 +47,7 @@ public class GetUploadParamsForTemplateCmd extends AbstractGetUploadParamsCmd {
4647

4748
private static final String s_name = "postuploadtemplateresponse";
4849

49-
@Parameter(name = ApiConstants.DISPLAY_TEXT, type = CommandType.STRING, required = true, description = "the display text of the template. This is usually used for display purposes.", length = 4096)
50+
@Parameter(name = ApiConstants.DISPLAY_TEXT, type = CommandType.STRING, description = "the display text of the template. This is usually used for display purposes.", length = 4096)
5051
private String displayText;
5152

5253
@Parameter(name = ApiConstants.HYPERVISOR, type = CommandType.STRING, required = true, description = "the target hypervisor for the template")
@@ -95,7 +96,7 @@ public class GetUploadParamsForTemplateCmd extends AbstractGetUploadParamsCmd {
9596
private Boolean deployAsIs;
9697

9798
public String getDisplayText() {
98-
return displayText;
99+
return StringUtils.isBlank(displayText) ? getName() : displayText;
99100
}
100101

101102
public String getHypervisor() {

0 commit comments

Comments
 (0)