This is an automated email from the ASF dual-hosted git repository.
dahn pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudstack.git
The following commit(s) were added to refs/heads/main by this push:
new 108651ad403 api: make displaytext form upload template/iso optional
(#8289)
108651ad403 is described below
commit 108651ad403e007f208af4703cc6adedf4a105ae
Author: Abhishek Kumar <[email protected]>
AuthorDate: Mon Dec 4 13:18:49 2023 +0530
api: make displaytext form upload template/iso optional (#8289)
Signed-off-by: Abhishek Kumar <[email protected]>
---
.../cloudstack/api/command/user/iso/GetUploadParamsForIsoCmd.java | 4 ++--
.../api/command/user/template/GetUploadParamsForTemplateCmd.java | 5 +++--
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git
a/api/src/main/java/org/apache/cloudstack/api/command/user/iso/GetUploadParamsForIsoCmd.java
b/api/src/main/java/org/apache/cloudstack/api/command/user/iso/GetUploadParamsForIsoCmd.java
index a7a418f5a86..e1759566299 100644
---
a/api/src/main/java/org/apache/cloudstack/api/command/user/iso/GetUploadParamsForIsoCmd.java
+++
b/api/src/main/java/org/apache/cloudstack/api/command/user/iso/GetUploadParamsForIsoCmd.java
@@ -29,6 +29,7 @@ import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.GetUploadParamsResponse;
import org.apache.cloudstack.api.response.GuestOSResponse;
import org.apache.cloudstack.context.CallContext;
+import org.apache.commons.lang3.StringUtils;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientCapacityException;
@@ -54,7 +55,6 @@ public class GetUploadParamsForIsoCmd extends
AbstractGetUploadParamsCmd {
@Parameter(name = ApiConstants.DISPLAY_TEXT,
type = BaseCmd.CommandType.STRING,
- required = true,
description = "the display text of the ISO. This is usually used
for display purposes.",
length = 4096)
private String displayText;
@@ -85,7 +85,7 @@ public class GetUploadParamsForIsoCmd extends
AbstractGetUploadParamsCmd {
}
public String getDisplayText() {
- return displayText;
+ return StringUtils.isBlank(displayText) ? getName() : displayText;
}
public Boolean isFeatured() {
diff --git
a/api/src/main/java/org/apache/cloudstack/api/command/user/template/GetUploadParamsForTemplateCmd.java
b/api/src/main/java/org/apache/cloudstack/api/command/user/template/GetUploadParamsForTemplateCmd.java
index 3a9e1c8b429..ab872b84edb 100644
---
a/api/src/main/java/org/apache/cloudstack/api/command/user/template/GetUploadParamsForTemplateCmd.java
+++
b/api/src/main/java/org/apache/cloudstack/api/command/user/template/GetUploadParamsForTemplateCmd.java
@@ -33,6 +33,7 @@ import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.GetUploadParamsResponse;
import org.apache.cloudstack.api.response.GuestOSResponse;
import org.apache.cloudstack.context.CallContext;
+import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger;
import com.cloud.exception.ResourceAllocationException;
@@ -46,7 +47,7 @@ public class GetUploadParamsForTemplateCmd extends
AbstractGetUploadParamsCmd {
private static final String s_name = "postuploadtemplateresponse";
- @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)
+ @Parameter(name = ApiConstants.DISPLAY_TEXT, type = CommandType.STRING,
description = "the display text of the template. This is usually used for
display purposes.", length = 4096)
private String displayText;
@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 {
private Boolean deployAsIs;
public String getDisplayText() {
- return displayText;
+ return StringUtils.isBlank(displayText) ? getName() : displayText;
}
public String getHypervisor() {