Skip to content

Commit

Permalink
Merge remote-tracking branch 'apache/4.19' into 4.19-import-volume
Browse files Browse the repository at this point in the history
  • Loading branch information
weizhouapache committed Apr 4, 2024
2 parents ffe9c96 + c25264b commit a2574bd
Show file tree
Hide file tree
Showing 112 changed files with 1,487 additions and 215 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@ private static AlertType getAlertType(short type) {
return null;
}

public static Set<AlertType> getAlertTypes() {
return defaultAlertTypes;
}

@Override
public String toString() {
return String.valueOf(this.getType());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import org.apache.cloudstack.acl.ProjectRole;
import org.apache.cloudstack.acl.RoleType;
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.BaseCmd;
Expand Down Expand Up @@ -70,4 +71,13 @@ public long getEntityOwnerId() {
return Account.ACCOUNT_ID_SYSTEM;
}

@Override
public Long getApiResourceId() {
return getProjectId();
}

@Override
public ApiCommandResourceType getApiResourceType() {
return ApiCommandResourceType.Project;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiArgValidator;
import org.apache.cloudstack.api.ApiCommandResourceType;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.Parameter;
Expand Down Expand Up @@ -96,4 +97,14 @@ private void setupResponse(final ProjectRolePermission rolePermission, final Pro
response.setObjectName("projectrolepermission");
setResponseObject(response);
}

@Override
public Long getApiResourceId() {
return getProjectId();
}

@Override
public ApiCommandResourceType getApiResourceType() {
return ApiCommandResourceType.Project;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiArgValidator;
import org.apache.cloudstack.api.ApiCommandResourceType;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseCmd;
Expand Down Expand Up @@ -79,4 +80,14 @@ public void execute() {
public long getEntityOwnerId() {
return CallContext.current().getCallingAccountId();
}

@Override
public Long getApiResourceId() {
return getProjectId();
}

@Override
public ApiCommandResourceType getApiResourceType() {
return ApiCommandResourceType.Project;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiArgValidator;
import org.apache.cloudstack.api.ApiCommandResourceType;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseCmd;
Expand Down Expand Up @@ -80,4 +81,14 @@ public void execute() {
public long getEntityOwnerId() {
return CallContext.current().getCallingAccountId();
}

@Override
public Long getApiResourceId() {
return getProjectId();
}

@Override
public ApiCommandResourceType getApiResourceType() {
return ApiCommandResourceType.Project;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiArgValidator;
import org.apache.cloudstack.api.ApiCommandResourceType;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseCmd;
Expand Down Expand Up @@ -76,4 +77,14 @@ public void execute() {
public long getEntityOwnerId() {
return 0;
}

@Override
public Long getApiResourceId() {
return getProjectId();
}

@Override
public ApiCommandResourceType getApiResourceType() {
return ApiCommandResourceType.Project;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiArgValidator;
import org.apache.cloudstack.api.ApiCommandResourceType;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseCmd;
Expand Down Expand Up @@ -154,4 +155,14 @@ private boolean updateProjectRolePermissionOrder(ProjectRole projectRole) {
public long getEntityOwnerId() {
return CallContext.current().getCallingAccountId();
}

@Override
public Long getApiResourceId() {
return getProjectId();
}

@Override
public ApiCommandResourceType getApiResourceType() {
return ApiCommandResourceType.Project;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import java.util.ArrayList;
import java.util.List;

import com.cloud.offering.DiskOffering.State;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiCommandResourceType;
import org.apache.cloudstack.api.ApiConstants;
Expand All @@ -27,6 +28,7 @@
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.DiskOfferingResponse;
import org.apache.commons.lang3.EnumUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger;

Expand Down Expand Up @@ -123,6 +125,9 @@ public class UpdateDiskOfferingCmd extends BaseCmd {
@Parameter(name = ApiConstants.CACHE_MODE, type = CommandType.STRING, description = "the cache mode to use for this disk offering", since = "4.15")
private String cacheMode;

@Parameter(name = ApiConstants.STATE, type = CommandType.STRING, description = "state of the disk offering")
private String diskOfferingState;

/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
Expand Down Expand Up @@ -262,6 +267,13 @@ public Long getIopsWriteRateMax() {
public Long getIopsWriteRateMaxLength() {
return iopsWriteRateMaxLength;
}
public State getState() {
State state = EnumUtils.getEnumIgnoreCase(State.class, diskOfferingState);
if (StringUtils.isNotBlank(diskOfferingState) && state == null) {
throw new InvalidParameterValueException("Invalid state value: " + diskOfferingState);
}
return state;
}

/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import java.util.ArrayList;
import java.util.List;

import com.cloud.offering.ServiceOffering.State;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiCommandResourceType;
import org.apache.cloudstack.api.ApiConstants;
Expand All @@ -27,6 +28,7 @@
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.ServiceOfferingResponse;
import org.apache.commons.lang3.EnumUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger;

Expand Down Expand Up @@ -84,6 +86,11 @@ public class UpdateServiceOfferingCmd extends BaseCmd {
since = "4.16")
private String hostTags;

@Parameter(name = ApiConstants.STATE,
type = CommandType.STRING,
description = "state of the service offering")
private String serviceOfferingState;

/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
Expand Down Expand Up @@ -172,6 +179,14 @@ public String getHostTags() {
return hostTags;
}

public State getState() {
State state = EnumUtils.getEnumIgnoreCase(State.class, serviceOfferingState);
if (StringUtils.isNotBlank(serviceOfferingState) && state == null) {
throw new InvalidParameterValueException("Invalid state value: " + serviceOfferingState);
}
return state;
}

/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiArgValidator;
import org.apache.cloudstack.api.ApiCommandResourceType;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseAsyncCmd;
Expand Down Expand Up @@ -102,4 +103,14 @@ public String getEventType() {
public String getEventDescription() {
return "change out-of-band management password for host: " + getHostId();
}

@Override
public Long getApiResourceId() {
return getHostId();
}

@Override
public ApiCommandResourceType getApiResourceType() {
return ApiCommandResourceType.Host;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiArgValidator;
import org.apache.cloudstack.api.ApiCommandResourceType;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseCmd;
Expand Down Expand Up @@ -112,4 +113,14 @@ protected void putOptionIfIsNotEmpty(ImmutableMap.Builder<OutOfBandManagement.Op
builder.put(option, value);
}
}

@Override
public Long getApiResourceId() {
return getHostId();
}

@Override
public ApiCommandResourceType getApiResourceType() {
return ApiCommandResourceType.Host;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiArgValidator;
import org.apache.cloudstack.api.ApiCommandResourceType;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseAsyncCmd;
Expand Down Expand Up @@ -94,4 +95,14 @@ public String getEventType() {
public String getEventDescription() {
return "disable out-of-band management password for cluster: " + getClusterId();
}

@Override
public Long getApiResourceId() {
return getClusterId();
}

@Override
public ApiCommandResourceType getApiResourceType() {
return ApiCommandResourceType.Cluster;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiArgValidator;
import org.apache.cloudstack.api.ApiCommandResourceType;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseAsyncCmd;
Expand Down Expand Up @@ -95,4 +96,14 @@ public String getEventType() {
public String getEventDescription() {
return "disable out-of-band management password for host: " + getHostId();
}

@Override
public Long getApiResourceId() {
return getHostId();
}

@Override
public ApiCommandResourceType getApiResourceType() {
return ApiCommandResourceType.Host;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiArgValidator;
import org.apache.cloudstack.api.ApiCommandResourceType;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseAsyncCmd;
Expand Down Expand Up @@ -94,4 +95,14 @@ public String getEventType() {
public String getEventDescription() {
return "disable out-of-band management password for zone: " + getZoneId();
}

@Override
public Long getApiResourceId() {
return getZoneId();
}

@Override
public ApiCommandResourceType getApiResourceType() {
return ApiCommandResourceType.Zone;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiArgValidator;
import org.apache.cloudstack.api.ApiCommandResourceType;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseAsyncCmd;
Expand Down Expand Up @@ -94,4 +95,14 @@ public String getEventType() {
public String getEventDescription() {
return "enable out-of-band management password for cluster: " + getClusterId();
}

@Override
public Long getApiResourceId() {
return getClusterId();
}

@Override
public ApiCommandResourceType getApiResourceType() {
return ApiCommandResourceType.Cluster;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiArgValidator;
import org.apache.cloudstack.api.ApiCommandResourceType;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseAsyncCmd;
Expand Down Expand Up @@ -95,4 +96,14 @@ public String getEventType() {
public String getEventDescription() {
return "enable out-of-band management password for host: " + getHostId();
}

@Override
public Long getApiResourceId() {
return getHostId();
}

@Override
public ApiCommandResourceType getApiResourceType() {
return ApiCommandResourceType.Host;
}
}
Loading

0 comments on commit a2574bd

Please sign in to comment.