Skip to content

Commit ef69e83

Browse files
Merge branch 'main' into api-keypair-restructure
2 parents 62259f7 + b19c069 commit ef69e83

File tree

110 files changed

+2688
-740
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

110 files changed

+2688
-740
lines changed

api/src/main/java/com/cloud/dc/DedicatedResources.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@
2121
import org.apache.cloudstack.api.InternalIdentity;
2222

2323
public interface DedicatedResources extends InfrastructureEntity, InternalIdentity, Identity {
24+
enum Type {
25+
Zone, Pod, Cluster, Host
26+
}
27+
2428
@Override
2529
long getId();
2630

api/src/main/java/com/cloud/storage/Volume.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -271,11 +271,13 @@ enum Event {
271271

272272
void setExternalUuid(String externalUuid);
273273

274-
public Long getPassphraseId();
274+
Long getPassphraseId();
275275

276-
public void setPassphraseId(Long id);
276+
void setPassphraseId(Long id);
277277

278-
public String getEncryptFormat();
278+
String getEncryptFormat();
279279

280-
public void setEncryptFormat(String encryptFormat);
280+
void setEncryptFormat(String encryptFormat);
281+
282+
boolean isDeleteProtection();
281283
}

api/src/main/java/com/cloud/storage/VolumeApiService.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,9 @@ Snapshot takeSnapshot(Long volumeId, Long policyId, Long snapshotId, Account acc
117117

118118
Snapshot allocSnapshot(Long volumeId, Long policyId, String snapshotName, Snapshot.LocationType locationType, List<Long> zoneIds) throws ResourceAllocationException;
119119

120-
Volume updateVolume(long volumeId, String path, String state, Long storageId, Boolean displayVolume, String customId, long owner, String chainInfo, String name);
120+
Volume updateVolume(long volumeId, String path, String state, Long storageId,
121+
Boolean displayVolume, Boolean deleteProtection,
122+
String customId, long owner, String chainInfo, String name);
121123

122124
/**
123125
* Extracts the volume to a particular location.

api/src/main/java/org/apache/cloudstack/affinity/AffinityGroupResponse.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import org.apache.cloudstack.api.BaseResponse;
2626
import org.apache.cloudstack.api.EntityReference;
2727
import org.apache.cloudstack.api.response.ControlledViewEntityResponse;
28+
import org.apache.cloudstack.dedicated.DedicatedResourceResponse;
2829

2930
import com.cloud.serializer.Param;
3031

@@ -76,6 +77,10 @@ public class AffinityGroupResponse extends BaseResponse implements ControlledVie
7677
@Param(description = "virtual machine IDs associated with this affinity group")
7778
private List<String> vmIdList;
7879

80+
@SerializedName("dedicatedresources")
81+
@Param(description = "dedicated resources associated with this affinity group")
82+
private List<DedicatedResourceResponse> dedicatedResources;
83+
7984
public AffinityGroupResponse() {
8085
}
8186

@@ -171,4 +176,12 @@ public void addVMId(String vmId) {
171176
this.vmIdList.add(vmId);
172177
}
173178

179+
public void addDedicatedResource(DedicatedResourceResponse dedicatedResourceResponse) {
180+
if (this.dedicatedResources == null) {
181+
this.dedicatedResources = new ArrayList<>();
182+
}
183+
184+
this.dedicatedResources.add(dedicatedResourceResponse);
185+
}
186+
174187
}

api/src/main/java/org/apache/cloudstack/api/ApiConstants.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ public class ApiConstants {
138138
public static final String DATACENTER_NAME = "datacentername";
139139
public static final String DATADISK_OFFERING_LIST = "datadiskofferinglist";
140140
public static final String DEFAULT_VALUE = "defaultvalue";
141+
public static final String DELETE_PROTECTION = "deleteprotection";
141142
public static final String DESCRIPTION = "description";
142143
public static final String DESTINATION = "destination";
143144
public static final String DESTINATION_ZONE_ID = "destzoneid";

api/src/main/java/org/apache/cloudstack/api/ApiServerService.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@
2121

2222
import javax.servlet.http.HttpSession;
2323

24+
import com.cloud.domain.Domain;
2425
import com.cloud.exception.CloudAuthenticationException;
26+
import com.cloud.user.UserAccount;
2527

2628
public interface ApiServerService {
2729
public boolean verifyRequest(Map<String, Object[]> requestParameters, Long userId, InetAddress remoteAddress) throws ServerApiException;
@@ -42,4 +44,8 @@ public ResponseObject loginUser(HttpSession session, String username, String pas
4244
public String handleRequest(Map<String, Object[]> params, String responseType, StringBuilder auditTrailSb) throws ServerApiException;
4345

4446
public Class<?> getCmdClass(String cmdName);
47+
48+
boolean forgotPassword(UserAccount userAccount, Domain domain);
49+
50+
boolean resetPassword(UserAccount userAccount, String token, String password);
4551
}

api/src/main/java/org/apache/cloudstack/api/auth/APIAuthenticationType.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@
1717
package org.apache.cloudstack.api.auth;
1818

1919
public enum APIAuthenticationType {
20-
LOGIN_API, LOGOUT_API, READONLY_API, LOGIN_2FA_API
20+
LOGIN_API, LOGOUT_API, READONLY_API, LOGIN_2FA_API, PASSWORD_RESET
2121
}

api/src/main/java/org/apache/cloudstack/api/command/user/vm/UpdateVMCmd.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,14 @@ public class UpdateVMCmd extends BaseCustomIdCmd implements SecurityGroupAction,
146146
@Parameter(name = ApiConstants.EXTRA_CONFIG, type = CommandType.STRING, since = "4.12", description = "an optional URL encoded string that can be passed to the virtual machine upon successful deployment", length = 5120)
147147
private String extraConfig;
148148

149+
@Parameter(name = ApiConstants.DELETE_PROTECTION,
150+
type = CommandType.BOOLEAN, since = "4.20.0",
151+
description = "Set delete protection for the virtual machine. If " +
152+
"true, the instance will be protected from deletion. " +
153+
"Note: If the instance is managed by another service like" +
154+
" autoscaling groups or CKS, delete protection will be ignored.")
155+
private Boolean deleteProtection;
156+
149157
/////////////////////////////////////////////////////
150158
/////////////////// Accessors ///////////////////////
151159
/////////////////////////////////////////////////////
@@ -215,6 +223,10 @@ public boolean isCleanupDetails(){
215223
return cleanupDetails == null ? false : cleanupDetails.booleanValue();
216224
}
217225

226+
public Boolean getDeleteProtection() {
227+
return deleteProtection;
228+
}
229+
218230
public Map<String, Map<Integer, String>> getDhcpOptionsMap() {
219231
Map<String, Map<Integer, String>> dhcpOptionsMap = new HashMap<>();
220232
if (dhcpOptionsNetworkList != null && !dhcpOptionsNetworkList.isEmpty()) {

api/src/main/java/org/apache/cloudstack/api/command/user/volume/UpdateVolumeCmd.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,14 @@ public class UpdateVolumeCmd extends BaseAsyncCustomIdCmd implements UserCmd {
7777
@Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "new name of the volume", since = "4.16")
7878
private String name;
7979

80+
@Parameter(name = ApiConstants.DELETE_PROTECTION,
81+
type = CommandType.BOOLEAN, since = "4.20.0",
82+
description = "Set delete protection for the volume. If true, The volume " +
83+
"will be protected from deletion. Note: If the volume is managed by " +
84+
"another service like autoscaling groups or CKS, delete protection will be " +
85+
"ignored.")
86+
private Boolean deleteProtection;
87+
8088
/////////////////////////////////////////////////////
8189
/////////////////// Accessors ///////////////////////
8290
/////////////////////////////////////////////////////
@@ -109,6 +117,10 @@ public String getName() {
109117
return name;
110118
}
111119

120+
public Boolean getDeleteProtection() {
121+
return deleteProtection;
122+
}
123+
112124
/////////////////////////////////////////////////////
113125
/////////////// API Implementation///////////////////
114126
/////////////////////////////////////////////////////
@@ -168,7 +180,7 @@ public String getEventDescription() {
168180
public void execute() {
169181
CallContext.current().setEventDetails("Volume Id: " + this._uuidMgr.getUuid(Volume.class, getId()));
170182
Volume result = _volumeService.updateVolume(getId(), getPath(), getState(), getStorageId(), getDisplayVolume(),
171-
getCustomId(), getEntityOwnerId(), getChainInfo(), getName());
183+
getDeleteProtection(), getCustomId(), getEntityOwnerId(), getChainInfo(), getName());
172184
if (result != null) {
173185
VolumeResponse response = _responseGenerator.createVolumeResponse(getResponseView(), result);
174186
response.setResponseName(getCommandName());

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,10 @@ public class UserVmResponse extends BaseResponseWithTagInformation implements Co
320320
@Param(description = "true if vm contains XS/VMWare tools inorder to support dynamic scaling of VM cpu/memory.")
321321
private Boolean isDynamicallyScalable;
322322

323+
@SerializedName(ApiConstants.DELETE_PROTECTION)
324+
@Param(description = "true if vm has delete protection.", since = "4.20.0")
325+
private boolean deleteProtection;
326+
323327
@SerializedName(ApiConstants.SERVICE_STATE)
324328
@Param(description = "State of the Service from LB rule")
325329
private String serviceState;
@@ -995,6 +999,14 @@ public void setDynamicallyScalable(Boolean dynamicallyScalable) {
995999
isDynamicallyScalable = dynamicallyScalable;
9961000
}
9971001

1002+
public boolean isDeleteProtection() {
1003+
return deleteProtection;
1004+
}
1005+
1006+
public void setDeleteProtection(boolean deleteProtection) {
1007+
this.deleteProtection = deleteProtection;
1008+
}
1009+
9981010
public String getOsTypeId() {
9991011
return osTypeId;
10001012
}

0 commit comments

Comments
 (0)