Skip to content

Commit f52bae2

Browse files
committed
changes
Signed-off-by: Abhishek Kumar <[email protected]>
1 parent 82f88d9 commit f52bae2

File tree

37 files changed

+1144
-770
lines changed

37 files changed

+1144
-770
lines changed

api/src/main/java/com/cloud/agent/api/to/VirtualMachineTO.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,14 @@
1919
import java.util.List;
2020
import java.util.Map;
2121
import java.util.HashMap;
22+
import java.util.stream.Collectors;
2223

2324
import com.cloud.agent.api.LogLevel;
2425
import com.cloud.network.element.NetworkElement;
2526
import com.cloud.template.VirtualMachineTemplate.BootloaderType;
2627
import com.cloud.vm.VirtualMachine;
2728
import com.cloud.vm.VirtualMachine.Type;
29+
import com.cloud.vm.VmDetailConstants;
2830

2931
public class VirtualMachineTO {
3032
private long id;
@@ -455,4 +457,16 @@ public void setMetadataProductName(String metadataProductName) {
455457
public String toString() {
456458
return String.format("VM {id: \"%s\", name: \"%s\", uuid: \"%s\", type: \"%s\"}", id, name, uuid, type);
457459
}
460+
461+
public Map<String, String> getExternalDetails() {
462+
if (details == null) {
463+
return new HashMap<>();
464+
}
465+
return details.entrySet().stream()
466+
.filter(entry -> entry.getKey().startsWith(VmDetailConstants.EXTERNAL_DETAIL_PREFIX))
467+
.collect(Collectors.toMap(
468+
entry -> entry.getKey().substring(VmDetailConstants.EXTERNAL_DETAIL_PREFIX.length()),
469+
Map.Entry::getValue
470+
));
471+
}
458472
}

api/src/main/java/org/apache/cloudstack/api/response/ExtensionCustomActionParameterResponse.java

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717

1818
package org.apache.cloudstack.api.response;
1919

20+
import java.util.List;
21+
2022
import org.apache.cloudstack.api.ApiConstants;
2123
import org.apache.cloudstack.api.BaseResponse;
2224

@@ -33,25 +35,24 @@ public class ExtensionCustomActionParameterResponse extends BaseResponse {
3335
@Param(description = "Type of the parameter")
3436
private String type;
3537

38+
@SerializedName(ApiConstants.FORMAT)
39+
@Param(description = "Format for value of the parameter. Available for specific types")
40+
private String format;
41+
42+
@SerializedName(ApiConstants.OPTIONS)
43+
@Param(description = "Options for value of the parameter")
44+
private List<Object> options;
45+
3646
@SerializedName(ApiConstants.REQUIRED)
3747
@Param(description = "Whether the parameter is required or not")
3848
private Boolean required;
3949

40-
public ExtensionCustomActionParameterResponse(String name, String type, boolean required) {
41-
this.name = name;
42-
this.type = type;
43-
this.required = required;
44-
}
45-
46-
public void setName(String name) {
50+
public ExtensionCustomActionParameterResponse(String name, String type, String format, List<Object> options,
51+
boolean required) {
4752
this.name = name;
48-
}
49-
50-
public void setType(String type) {
5153
this.type = type;
52-
}
53-
54-
public void setRequired(Boolean required) {
54+
this.format = format;
55+
this.options = options;
5556
this.required = required;
5657
}
5758
}

api/src/main/java/org/apache/cloudstack/api/response/ExtensionResponse.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ public class ExtensionResponse extends BaseResponse {
5151
@Param(description = "The path of the entry point fo the extension")
5252
private String entryPoint;
5353

54+
@SerializedName(ApiConstants.IS_USER_DEFINED)
55+
@Param(description = "True if the extension is added by admin")
56+
private Boolean userDefined;
57+
5458
@SerializedName(ApiConstants.DETAILS)
5559
@Param(description = "The details of the extension")
5660
private Map<String, String> details;
@@ -102,6 +106,10 @@ public void setEntryPoint(String entryPoint) {
102106
this.entryPoint = entryPoint;
103107
}
104108

109+
public void setUserDefined(Boolean userDefined) {
110+
this.userDefined = userDefined;
111+
}
112+
105113
public void setDetails(Map<String, String> details) {
106114
this.details = details;
107115
}

api/src/main/java/org/apache/cloudstack/extension/Extension.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,6 @@ enum Type {
3030
String getDescription();
3131
Type getType();
3232
String getRelativeEntryPoint();
33+
boolean isUserDefined();
3334
Date getCreated();
3435
}

0 commit comments

Comments
 (0)