Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import org.apache.cloudstack.api.response.TemplateResponse;
import org.apache.commons.lang3.StringUtils;

import java.util.Collection;
import java.util.Map;

public abstract class BaseUpdateTemplateOrIsoCmd extends BaseCmd {
Expand Down Expand Up @@ -76,7 +75,7 @@ public abstract class BaseUpdateTemplateOrIsoCmd extends BaseCmd {
protected Boolean isRoutingType;

@Parameter(name = ApiConstants.DETAILS, type = CommandType.MAP, description = "Details in key/value pairs using format details[i].keyname=keyvalue. Example: details[0].hypervisortoolsversion=xenserver61")
protected Map details;
protected Map<Integer, Map<String, String>> details;

@Parameter(name = ApiConstants.CLEAN_UP_DETAILS,
type = CommandType.BOOLEAN,
Expand Down Expand Up @@ -144,13 +143,11 @@ public Boolean isRoutingType() {
return isRoutingType;
}

public Map getDetails() {
public Map<String, String> getDetails() {
if (this.details == null || this.details.isEmpty()) {
return null;
}

Collection paramsCollection = this.details.values();
return (Map) (paramsCollection.toArray())[0];
return this.details.values().iterator().next();
}

public boolean isCleanupDetails() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
// under the License.
package org.apache.cloudstack.api.command.admin.account;

import java.util.Collection;
import java.util.Map;

import javax.inject.Inject;
Expand Down Expand Up @@ -70,7 +69,7 @@ public class UpdateAccountCmd extends BaseCmd implements UserCmd {
private String networkDomain;

@Parameter(name = ApiConstants.ACCOUNT_DETAILS, type = CommandType.MAP, description = "Details for the Account used to store specific parameters")
private Map details;
private Map<Integer, Map<String, String>> details;

@Parameter(name = ApiConstants.API_KEY_ACCESS, type = CommandType.STRING, description = "Determines if Api key access for this user is enabled, disabled or inherits the value from its parent, the domain level setting api.key.access", since = "4.20.1.0", authorized = {RoleType.Admin})
private String apiKeyAccess;
Expand Down Expand Up @@ -104,14 +103,11 @@ public String getNetworkDomain() {
return networkDomain;
}

public Map getDetails() {
public Map<String, String> getDetails() {
if (details == null || details.isEmpty()) {
return null;
}

Collection paramsCollection = details.values();
Map params = (Map)(paramsCollection.toArray())[0];
return params;
return details.values().iterator().next();
}

public String getApiKeyAccess() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ public class AddClusterCmd extends BaseCmd {
type = CommandType.MAP,
description = "Details in key/value pairs to be added to the extension-resource mapping. Use the format externaldetails[i].<key>=<value>. Example: externaldetails[0].endpoint.url=https://example.com",
since = "4.21.0")
protected Map externalDetails;
protected Map<Integer, Map<String, String>> externalDetails;

public String getOvm3Pool() {
return ovm3pool;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public class UpdateClusterCmd extends BaseCmd {
type = CommandType.MAP,
description = "Details in key/value pairs to be added to the extension-resource mapping. Use the format externaldetails[i].<key>=<value>. Example: externaldetails[0].endpoint.url=https://example.com",
since = "4.21.0")
protected Map externalDetails;
protected Map<Integer, Map<String, String>> externalDetails;

public String getClusterName() {
return clusterName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public class AddGuestOsCmd extends BaseAsyncCreateCmd {
private String osName;

@Parameter(name = ApiConstants.DETAILS, type = CommandType.MAP, required = false, description = "Map of (key/value pairs)")
private Map details;
private Map<Integer, Map<String, String>> details;

@Parameter(name="forDisplay", type=CommandType.BOOLEAN, description="whether this guest OS is available for end users", authorized = {RoleType.Admin})
private Boolean display;
Expand All @@ -79,7 +79,7 @@ public String getOsName() {
return osName;
}

public Map getDetails() {
public Map<String, String> getDetails() {
Map<String, String> detailsMap = new HashMap<>();
if (!MapUtils.isEmpty(details)) {
Collection<?> servicesCollection = details.values();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public class UpdateGuestOsCmd extends BaseAsyncCmd {
private String osDisplayName;

@Parameter(name = ApiConstants.DETAILS, type = CommandType.MAP, required = false, description = "Map of (key/value pairs)")
private Map details;
private Map<Integer, Map<String, String>> details;

@Parameter(name="forDisplay", type=CommandType.BOOLEAN, description="whether this guest OS is available for end users", authorized = {RoleType.Admin})
private Boolean display;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public class AddHostCmd extends BaseCmd {
type = CommandType.MAP,
description = "Details in key/value pairs using format externaldetails[i].keyname=keyvalue. Example: externaldetails[0].endpoint.url=urlvalue",
since = "4.21.0")
protected Map externalDetails;
protected Map<Integer, Map<String, String>> externalDetails;

/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public class AddSecondaryStorageCmd extends BaseCmd {
protected Long zoneId;

@Parameter(name = ApiConstants.DETAILS, type = CommandType.MAP, description = "Details in key/value pairs using format details[i].keyname=keyvalue. Example: details[0].copytemplatesfromothersecondarystorages=true")
protected Map details;
protected Map<Integer, Map<String, String>> details;

/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public class UpdateHostCmd extends BaseCmd {
private String annotation;

@Parameter(name = ApiConstants.EXTERNAL_DETAILS, type = CommandType.MAP, description = "Details in key/value pairs using format externaldetails[i].keyname=keyvalue. Example: externaldetails[0].endpoint.url=urlvalue", since = "4.21.0")
protected Map externalDetails;
protected Map<Integer, Map<String, String>> externalDetails;

@Parameter(name = ApiConstants.CLEAN_UP_EXTERNAL_DETAILS,
type = CommandType.BOOLEAN,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ public abstract class NetworkOfferingBaseCmd extends BaseCmd {
@Parameter(name = ApiConstants.DETAILS, type = CommandType.MAP, since = "4.2.0", description = "Network offering details in key/value pairs."
+ " Supported keys are internallbprovider/publiclbprovider with service provider as a value, and"
+ " promiscuousmode/macaddresschanges/forgedtransmits with true/false as value to accept/reject the security settings if available for a nic/portgroup")
protected Map details;
protected Map<Integer, Map<String, String>> details;

@Parameter(name = ApiConstants.EGRESS_DEFAULT_POLICY,
type = CommandType.BOOLEAN,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
import com.cloud.event.EventTypes;
import com.cloud.user.Account;

import java.util.Collection;
import java.util.Map;

@APICommand(name = "createBgpPeer",
Expand Down Expand Up @@ -91,7 +90,7 @@ public class CreateBgpPeerCmd extends BaseAsyncCmd {

@Parameter(name = ApiConstants.DETAILS, type = CommandType.MAP,
description = "BGP peer details in key/value pairs.")
protected Map details;
protected Map<Integer, Map<String, String>> details;

/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
Expand Down Expand Up @@ -134,8 +133,7 @@ public Map<String, String> getDetails() {
if (MapUtils.isEmpty(details)) {
return null;
}
Collection<String> paramsCollection = this.details.values();
return (Map<String, String>) (paramsCollection.toArray())[0];
return this.details.values().iterator().next();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
import com.cloud.utils.exception.CloudRuntimeException;
import org.apache.commons.collections.MapUtils;

import java.util.Collection;
import java.util.Map;

@APICommand(name = "updateBgpPeer",
Expand Down Expand Up @@ -74,7 +73,7 @@ public class UpdateBgpPeerCmd extends BaseAsyncCmd {

@Parameter(name = ApiConstants.DETAILS, type = CommandType.MAP,
description = "BGP peer details in key/value pairs.")
protected Map details;
protected Map<Integer, Map<String, String>> details;

@Parameter(name = ApiConstants.CLEAN_UP_DETAILS,
type = CommandType.BOOLEAN,
Expand Down Expand Up @@ -105,8 +104,7 @@ public Map<String, String> getDetails() {
if (MapUtils.isEmpty(details)) {
return null;
}
Collection<String> paramsCollection = this.details.values();
return (Map<String, String>) (paramsCollection.toArray())[0];
return this.details.values().iterator().next();
}

public boolean isCleanupDetails(){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ public class CreateDiskOfferingCmd extends BaseCmd {
private Boolean encrypt;

@Parameter(name = ApiConstants.DETAILS, type = CommandType.MAP, description = "Details to specify disk offering parameters", since = "4.16")
private Map details;
private Map<Integer, Map<String, String>> details;



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public class CreateServiceOfferingCmd extends BaseCmd {
private String deploymentPlanner;

@Parameter(name = ApiConstants.SERVICE_OFFERING_DETAILS, type = CommandType.MAP, description = "Details for planner, used to store specific parameters")
private Map details;
private Map<Integer, Map<String, String>> details;

@Parameter(name = ApiConstants.ROOT_DISK_SIZE, type = CommandType.LONG, since = "4.15", description = "The Root disk size in GB.")
private Long rootDiskSize;
Expand Down Expand Up @@ -286,7 +286,7 @@ public class CreateServiceOfferingCmd extends BaseCmd {
type = CommandType.MAP,
description = "Details in key/value pairs using format externaldetails[i].keyname=keyvalue. Example: externaldetails[0].endpoint.url=urlvalue",
since = "4.21.0")
private Map externalDetails;
private Map<Integer, Map<String, String>> externalDetails;

/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public class UpdateServiceOfferingCmd extends BaseCmd implements DomainAndZoneId
type = CommandType.MAP,
description = "Details in key/value pairs using format externaldetails[i].keyname=keyvalue. Example: externaldetails[0].endpoint.url=urlvalue",
since = "4.21.0")
private Map externalDetails;
private Map<Integer, Map<String, String>> externalDetails;

@Parameter(name = ApiConstants.CLEAN_UP_EXTERNAL_DETAILS,
type = CommandType.BOOLEAN,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public class AddImageStoreCmd extends BaseCmd {
@Parameter(name = ApiConstants.DETAILS,
type = CommandType.MAP,
description = "The details for the image store. Example: details[0].key=accesskey&details[0].value=s389ddssaa&details[1].key=secretkey&details[1].value=8dshfsss")
private Map details;
private Map<Integer, Map<String, String>> details;

/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
Expand Down Expand Up @@ -108,7 +108,7 @@ public void setProviderName(String providerName) {
this.providerName = providerName;
}

public void setDetails(Map<String, String> details) {
public void setDetails(Map<Integer, Map<String, String>> details) {
this.details = details;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public class AddObjectStoragePoolCmd extends BaseCmd {
@Parameter(name = ApiConstants.DETAILS,
type = CommandType.MAP,
description = "the details for the object store. Example: details[0].key=accesskey&details[0].value=s389ddssaa&details[1].key=secretkey&details[1].value=8dshfsss")
private Map details;
private Map<Integer, Map<String, String>> details;

@Parameter(name = ApiConstants.TAGS, type = CommandType.STRING, description = "the tags for the storage pool")
private String tags;
Expand Down Expand Up @@ -103,7 +103,7 @@ public void setProviderName(String providerName) {
this.providerName = providerName;
}

public void setDetails(Map<String, String> details) {
public void setDetails(Map<Integer, Map<String, String>> details) {
this.details = details;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public class CreateStoragePoolCmd extends BaseCmd {
private Long clusterId;

@Parameter(name = ApiConstants.DETAILS, type = CommandType.MAP, description = "The details for the storage pool")
private Map details;
private Map<Integer, Map<String, String>> details;

@Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true, description = "The name for the storage pool")
private String storagePoolName;
Expand Down Expand Up @@ -103,7 +103,7 @@ public Long getClusterId() {
return clusterId;
}

public Map getDetails() {
public Map<Integer, Map<String, String>> getDetails() {
return details;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public class UpdateCloudToUseObjectStoreCmd extends BaseCmd {
private String providerName;

@Parameter(name=ApiConstants.DETAILS, type=CommandType.MAP, description = "The details for the image store. Example: details[0].key=accesskey&details[0].value=s389ddssaa&details[1].key=secretkey&details[1].value=8dshfsss")
private Map details;
private Map<Integer, Map<String, String>> details;



Expand Down Expand Up @@ -99,7 +99,7 @@ public void setProviderName(String providerName) {
this.providerName = providerName;
}

public void setDetails(Map<String, String> details) {
public void setDetails(Map<Integer, Map<String, String>> details) {
this.details = details;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public class UpdateStoragePoolCmd extends BaseCmd {
required = false,
description = "the details for the storage pool",
since = "4.19.0")
private Map details;
private Map<Integer, Map<String, String>> details;

@Parameter(name = ApiConstants.URL,
type = CommandType.STRING,
Expand Down Expand Up @@ -131,11 +131,11 @@ public ApiCommandResourceType getApiResourceType() {
return ApiCommandResourceType.StoragePool;
}

public Map<String,String> getDetails() {
public Map<Integer, Map<String, String>> getDetails() {
return details;
}

public void setDetails(Map<String,String> details) {
public void setDetails(Map<Integer, Map<String, String>> details) {
this.details = details;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@

@Parameter(name = ApiConstants.DETAILS, type = CommandType.MAP,
description = "optional service offering custom parameters and migration details")
private Map details;
private Map<Integer, Map<String, String>> details;

public Long getZoneId() {
return zoneId;
Expand Down Expand Up @@ -174,7 +174,7 @@
return params;
}

for (Object value : details.values()) {

Check warning on line 177 in api/src/main/java/org/apache/cloudstack/api/command/admin/vm/CheckVmwareCbtMigrationPrerequisitesCmd.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Change "Object" to the type handled by the Collection.

See more on https://sonarcloud.io/project/issues?id=apache_cloudstack&issues=AaGx6uTq-57qWf52Kway&open=AaGx6uTq-57qWf52Kway&pullRequest=14580
if (!(value instanceof Map)) {
continue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@

@Parameter(name = ApiConstants.DETAILS, type = CommandType.MAP,
description = "optional migration details, including VDDK settings such as vddk.lib.dir, vddk.transports and vddk.thumbprint")
private Map details;
private Map<Integer, Map<String, String>> details;

@Parameter(name = ApiConstants.NIC_NETWORK_LIST, type = CommandType.MAP,
description = "VM NIC to network id mapping using keys NIC and network")
Expand Down Expand Up @@ -259,7 +259,7 @@
return params;
}

for (Object value : details.values()) {

Check warning on line 262 in api/src/main/java/org/apache/cloudstack/api/command/admin/vm/StartVmwareCbtMigrationCmd.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Change "Object" to the type handled by the Collection.

See more on https://sonarcloud.io/project/issues?id=apache_cloudstack&issues=AaGx6uJ3-57qWf52Kwax&open=AaGx6uJ3-57qWf52Kwax&pullRequest=14580
if (!(value instanceof Map)) {
continue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public class UpdateZoneCmd extends BaseCmd {
private String allocationState;

@Parameter(name = ApiConstants.DETAILS, type = CommandType.MAP, description = "The details for the Zone")
private Map details;
private Map<Integer, Map<String, String>> details;

@Parameter(name = ApiConstants.DHCP_PROVIDER, type = CommandType.STRING, description = "The DHCP Provider for the Zone")
private String dhcpProvider;
Expand Down Expand Up @@ -143,7 +143,7 @@ public String getAllocationState() {
return allocationState;
}

public Map getDetails() {
public Map<Integer, Map<String, String>> getDetails() {
return details;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public class CreateAutoScaleVmProfileCmd extends BaseAsyncCreateCmd {
private Long userDataId;

@Parameter(name = ApiConstants.USER_DATA_DETAILS, type = CommandType.MAP, description = "used to specify the parameters values for the variables in userdata.", since = "4.18.1")
private Map userDataDetails;
private Map<Integer, Map<String, String>> userDataDetails;

@Parameter(name = ApiConstants.AUTOSCALE_USER_ID,
type = CommandType.UUID,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public class UpdateAutoScaleVmProfileCmd extends BaseAsyncCustomIdCmd {

@Parameter(name = ApiConstants.USER_DATA_DETAILS, type = CommandType.MAP, description = "used to specify the parameters values for the variables in userdata.",
since = "4.18.1")
private Map userDataDetails;
private Map<Integer, Map<String, String>> userDataDetails;

@Parameter(name = ApiConstants.AUTOSCALE_USER_ID,
type = CommandType.UUID,
Expand Down
Loading
Loading