mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-02 20:02:29 +01:00
Added isTagged parameter to listNetworkOfferings api. When set to true, it will return offerings with not null tag values
Reviewed-by: Jessica Wang
This commit is contained in:
parent
a8a36e785f
commit
798accae10
@ -331,6 +331,7 @@ public class ApiConstants {
|
|||||||
public static final String SORT_BY = "sortby";
|
public static final String SORT_BY = "sortby";
|
||||||
public static final String CHANGE_CIDR = "changecidr";
|
public static final String CHANGE_CIDR = "changecidr";
|
||||||
public static final String PURPOSE = "purpose";
|
public static final String PURPOSE = "purpose";
|
||||||
|
public static final String IS_TAGGED = "istagged";
|
||||||
|
|
||||||
public enum HostDetails {
|
public enum HostDetails {
|
||||||
all, capacity, events, stats, min;
|
all, capacity, events, stats, min;
|
||||||
|
|||||||
@ -28,7 +28,6 @@ import com.cloud.api.BaseListCmd;
|
|||||||
import com.cloud.api.IdentityMapper;
|
import com.cloud.api.IdentityMapper;
|
||||||
import com.cloud.api.Implementation;
|
import com.cloud.api.Implementation;
|
||||||
import com.cloud.api.Parameter;
|
import com.cloud.api.Parameter;
|
||||||
import com.cloud.api.BaseCmd.CommandType;
|
|
||||||
import com.cloud.api.response.ListResponse;
|
import com.cloud.api.response.ListResponse;
|
||||||
import com.cloud.api.response.NetworkOfferingResponse;
|
import com.cloud.api.response.NetworkOfferingResponse;
|
||||||
import com.cloud.offering.NetworkOffering;
|
import com.cloud.offering.NetworkOffering;
|
||||||
@ -88,7 +87,10 @@ public class ListNetworkOfferingsCmd extends BaseListCmd {
|
|||||||
private Boolean specifyIpRanges;
|
private Boolean specifyIpRanges;
|
||||||
|
|
||||||
@Parameter(name=ApiConstants.TAGS, type=CommandType.STRING, description="list network offerings by tags", length=4096)
|
@Parameter(name=ApiConstants.TAGS, type=CommandType.STRING, description="list network offerings by tags", length=4096)
|
||||||
private String tags;
|
private String tags;
|
||||||
|
|
||||||
|
@Parameter(name=ApiConstants.IS_TAGGED, type=CommandType.BOOLEAN, description="true if offering has tags specified")
|
||||||
|
private Boolean isTagged;
|
||||||
|
|
||||||
/////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////
|
||||||
/////////////////// Accessors ///////////////////////
|
/////////////////// Accessors ///////////////////////
|
||||||
@ -154,6 +156,10 @@ public class ListNetworkOfferingsCmd extends BaseListCmd {
|
|||||||
return tags;
|
return tags;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Boolean isTagged() {
|
||||||
|
return isTagged;
|
||||||
|
}
|
||||||
|
|
||||||
/////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////
|
||||||
/////////////// API Implementation///////////////////
|
/////////////// API Implementation///////////////////
|
||||||
/////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////
|
||||||
|
|||||||
@ -3392,6 +3392,7 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
|
|||||||
List<String> supportedServicesStr = cmd.getSupportedServices();
|
List<String> supportedServicesStr = cmd.getSupportedServices();
|
||||||
Object specifyIpRanges = cmd.getSpecifyIpRanges();
|
Object specifyIpRanges = cmd.getSpecifyIpRanges();
|
||||||
String tags = cmd.getTags();
|
String tags = cmd.getTags();
|
||||||
|
Boolean isTagged = cmd.isTagged();
|
||||||
|
|
||||||
if (zoneId != null) {
|
if (zoneId != null) {
|
||||||
zone = getZone(zoneId);
|
zone = getZone(zoneId);
|
||||||
@ -3486,10 +3487,14 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (tags != null) {
|
if (tags != null) {
|
||||||
if (tags.isEmpty()) {
|
sc.addAnd("tags", SearchCriteria.Op.EQ, tags);
|
||||||
sc.addAnd("tags", SearchCriteria.Op.NULL);
|
}
|
||||||
|
|
||||||
|
if (isTagged != null) {
|
||||||
|
if (isTagged) {
|
||||||
|
sc.addAnd("tags", SearchCriteria.Op.NNULL);
|
||||||
} else {
|
} else {
|
||||||
sc.addAnd("tags", SearchCriteria.Op.EQ, tags);
|
sc.addAnd("tags", SearchCriteria.Op.NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user