JCLOUDS-220. Adding projectId to a bunch of CloudStack API options

This commit is contained in:
Andrew Bayer 2013-08-01 15:25:46 -07:00
parent 375cb2075d
commit 2fcd90c394
26 changed files with 401 additions and 0 deletions

View File

@ -40,6 +40,15 @@ public class AssociateIPAddressOptions extends AccountInDomainOptions {
}
/**
* @param projectId
* Project for the IP
*/
public AssociateIPAddressOptions projectId(String projectId) {
this.queryParameters.replaceValues("projectid", ImmutableSet.of(projectId + ""));
return this;
}
public static class Builder {
/**
@ -65,6 +74,14 @@ public class AssociateIPAddressOptions extends AccountInDomainOptions {
AssociateIPAddressOptions options = new AssociateIPAddressOptions();
return options.domainId(domainId);
}
/**
* @see AssociateIPAddressOptions#projectId(String)
*/
public static AssociateIPAddressOptions projectId(String projectId) {
AssociateIPAddressOptions options = new AssociateIPAddressOptions();
return options.projectId(projectId);
}
}
/**

View File

@ -102,6 +102,15 @@ public class CreateNetworkOptions extends AccountInDomainOptions {
return this;
}
/**
* @param projectId
* the project this network will be in.
*/
public CreateNetworkOptions projectId(String projectId) {
this.queryParameters.replaceValues("projectid", ImmutableSet.of(projectId + ""));
return this;
}
public static class Builder {
/**
* @see CreateNetworkOptions#isDefault
@ -182,6 +191,14 @@ public class CreateNetworkOptions extends AccountInDomainOptions {
CreateNetworkOptions options = new CreateNetworkOptions();
return options.domainId(domainId);
}
/**
* @see CreateNetworkOptions#projectId(String)
*/
public static CreateNetworkOptions projectId(String projectId) {
CreateNetworkOptions options = new CreateNetworkOptions();
return options.projectId(projectId);
}
}
/**

View File

@ -48,6 +48,14 @@ public class CreateVMGroupOptions extends BaseHttpRequestOptions {
return this;
}
/**
* @param projectId the project the vm group will be in
*/
public CreateVMGroupOptions projectId(String projectId) {
this.queryParameters.replaceValues("projectid", ImmutableSet.of(projectId + ""));
return this;
}
public static class Builder {
/**
* @see org.jclouds.cloudstack.options.CreateVMGroupOptions#account
@ -64,6 +72,14 @@ public class CreateVMGroupOptions extends BaseHttpRequestOptions {
CreateVMGroupOptions options = new CreateVMGroupOptions();
return options.domainId(id);
}
/**
* @see org.jclouds.cloudstack.options.CreateVMGroupOptions#projectId(String)
*/
public static CreateVMGroupOptions projectId(String id) {
CreateVMGroupOptions options = new CreateVMGroupOptions();
return options.projectId(id);
}
}
}

View File

@ -67,6 +67,10 @@ public class CreateVlanIPRangeOptions extends AccountInDomainOptions {
return new CreateVlanIPRangeOptions().networkId(networkId);
}
public static CreateVlanIPRangeOptions projectId(String projectId) {
return new CreateVlanIPRangeOptions().projectId(projectId);
}
}
@Override
@ -118,4 +122,9 @@ public class CreateVlanIPRangeOptions extends AccountInDomainOptions {
this.queryParameters.replaceValues("networkid", ImmutableSet.of(networkId+""));
return this;
}
public CreateVlanIPRangeOptions projectId(String projectId) {
this.queryParameters.replaceValues("projectid", ImmutableSet.of(projectId+""));
return this;
}
}

View File

@ -169,6 +169,14 @@ public class DeployVirtualMachineOptions extends AccountInDomainOptions {
}
}
/**
* @param projectId The project this VM will be in.
*/
public DeployVirtualMachineOptions projectId(String projectId) {
this.queryParameters.replaceValues("projectid", ImmutableSet.of(projectId + ""));
return this;
}
/**
* @param securityGroupId
* security group applied to the virtual machine. Should be passed
@ -298,6 +306,14 @@ public class DeployVirtualMachineOptions extends AccountInDomainOptions {
return options.networkIds(networkIds);
}
/**
* @see DeployVirtualMachineOptions#projectId(String)
*/
public static DeployVirtualMachineOptions projectId(String id) {
DeployVirtualMachineOptions options = new DeployVirtualMachineOptions();
return options.projectId(id);
}
/**
* @see DeployVirtualMachineOptions#securityGroupId
*/

View File

@ -63,6 +63,11 @@ public class ListEventsOptions extends BaseHttpRequestOptions {
return this;
}
public ListEventsOptions projectId(String projectId) {
this.queryParameters.replaceValues("projectid", ImmutableSet.of(projectId + ""));
return this;
}
public ListEventsOptions keyword(String keyword) {
this.queryParameters.replaceValues("keyword", ImmutableSet.of(keyword));
return this;
@ -110,6 +115,11 @@ public class ListEventsOptions extends BaseHttpRequestOptions {
return options.id(id);
}
public static ListEventsOptions projectId(String projectId) {
final ListEventsOptions options = new ListEventsOptions();
return options.projectId(projectId);
}
public static ListEventsOptions keyword(String keyword) {
final ListEventsOptions options = new ListEventsOptions();
return options.keyword(keyword);

View File

@ -48,6 +48,15 @@ public class ListFirewallRulesOptions extends AccountInDomainOptions {
return this;
}
/**
* @param projectId
* List firewall rules in this project.
*/
public ListFirewallRulesOptions projectId(String projectId) {
this.queryParameters.replaceValues("projectid", ImmutableSet.of(projectId + ""));
return this;
}
/**
* @param keyword
* list by keyword
@ -85,6 +94,14 @@ public class ListFirewallRulesOptions extends AccountInDomainOptions {
return options.ipAddressId(ipAddressId);
}
/**
* @see ListFirewallRulesOptions#projectId(String)
*/
public static ListFirewallRulesOptions projectId(String projectId) {
ListFirewallRulesOptions options = new ListFirewallRulesOptions();
return options.projectId(projectId);
}
/**
* @see ListFirewallRulesOptions#keyword
*/

View File

@ -59,6 +59,16 @@ public class ListIPForwardingRulesOptions extends AccountInDomainOptions {
}
/**
* @param projectId
* Lists all rules applied to VMs in the given project.
*/
public ListIPForwardingRulesOptions projectId(String projectId) {
this.queryParameters.replaceValues("projectid", ImmutableSet.of(projectId + ""));
return this;
}
public static class Builder {
/**
@ -100,6 +110,14 @@ public class ListIPForwardingRulesOptions extends AccountInDomainOptions {
ListIPForwardingRulesOptions options = new ListIPForwardingRulesOptions();
return options.virtualMachineId(virtualMachineId);
}
/**
* @see ListIPForwardingRulesOptions#projectId(String)
*/
public static ListIPForwardingRulesOptions projectId(String projectId) {
ListIPForwardingRulesOptions options = new ListIPForwardingRulesOptions();
return options.projectId(projectId);
}
}
/**

View File

@ -67,6 +67,14 @@ public class ListISOsOptions extends AccountInDomainOptions {
return this;
}
/**
* @param projectId list ISOs in the given project
*/
public ListISOsOptions projectId(String projectId) {
this.queryParameters.replaceValues("projectid", ImmutableSet.of(projectId + ""));
return this;
}
/**
* @param isoFilter possible values are "featured", "self", "self-executable","executable", and "community".
*/
@ -174,6 +182,13 @@ public class ListISOsOptions extends AccountInDomainOptions {
return new ListISOsOptions().id(id);
}
/**
* @param projectId list ISOs in project
*/
public static ListISOsOptions projectId(String projectId) {
return new ListISOsOptions().projectId(projectId);
}
/**
* @param isoFilter possible values are "featured", "self", "self-executable","executable", and "community".
*/

View File

@ -74,6 +74,14 @@ public class ListLoadBalancerRulesOptions extends AccountInDomainOptions {
return this;
}
/**
* @param projectId the project ID
*/
public ListLoadBalancerRulesOptions projectId(String projectId) {
this.queryParameters.replaceValues("projectid", ImmutableSet.of(projectId + ""));
return this;
}
/**
* @param page the number of the page
*/
@ -148,6 +156,14 @@ public class ListLoadBalancerRulesOptions extends AccountInDomainOptions {
return options.zoneId(zoneId);
}
/**
* @see ListLoadBalancerRulesOptions#projectId(String)
*/
public static ListLoadBalancerRulesOptions projectId(String projectId) {
ListLoadBalancerRulesOptions options = new ListLoadBalancerRulesOptions();
return options.projectId(projectId);
}
/**
* @see ListLoadBalancerRulesOptions#page
*/

View File

@ -88,6 +88,16 @@ public class ListNetworksOptions extends AccountInDomainOptions {
}
/**
* @param projectId
* the project ID of the network
*/
public ListNetworksOptions projectId(String projectId) {
this.queryParameters.replaceValues("projectid", ImmutableSet.of(projectId + ""));
return this;
}
/**
* @param trafficType
* type of the traffic
@ -162,6 +172,14 @@ public class ListNetworksOptions extends AccountInDomainOptions {
return options.zoneId(id);
}
/**
* @see ListNetworksOptions#projectId(String)
*/
public static ListNetworksOptions projectId(String id) {
ListNetworksOptions options = new ListNetworksOptions();
return options.projectId(id);
}
/**
* @see ListNetworksOptions#trafficType
*/

View File

@ -49,6 +49,15 @@ public class ListPortForwardingRulesOptions extends AccountInDomainOptions {
}
/**
* @param projectId
* list the rules in this project
*/
public ListPortForwardingRulesOptions projectId(String projectId) {
this.queryParameters.replaceValues("projectid", ImmutableSet.of(projectId + ""));
return this;
}
public static class Builder {
/**
@ -67,6 +76,14 @@ public class ListPortForwardingRulesOptions extends AccountInDomainOptions {
return options.ipAddressId(ipAddressId);
}
/**
* @see ListPortForwardingRulesOptions#projectId(String)
*/
public static ListPortForwardingRulesOptions projectId(String projectId) {
ListPortForwardingRulesOptions options = new ListPortForwardingRulesOptions();
return options.projectId(projectId);
}
/**
* @see ListPortForwardingRulesOptions#accountInDomain
*/

View File

@ -59,6 +59,16 @@ public class ListPublicIPAddressesOptions extends AccountInDomainOptions {
}
/**
* @param projectId
* list ip addresss by project.
*/
public ListPublicIPAddressesOptions projectId(String projectId) {
this.queryParameters.replaceValues("projectid", ImmutableSet.of(projectId + ""));
return this;
}
/**
* @param VLANId
* lists all public IP addresses by VLAN ID
@ -147,6 +157,14 @@ public class ListPublicIPAddressesOptions extends AccountInDomainOptions {
return options.networkId(id);
}
/**
* @see ListPublicIPAddressesOptions#projectId(String)
*/
public static ListPublicIPAddressesOptions projectId(String id) {
ListPublicIPAddressesOptions options = new ListPublicIPAddressesOptions();
return options.projectId(id);
}
/**
* @see ListPublicIPAddressesOptions#VLANId
*/

View File

@ -61,6 +61,17 @@ public class ListResourceLimitsOptions extends BaseHttpRequestOptions {
return this;
}
/**
* Lists resource limits by project.
*
* @param projectId the project
* @return ListResourceLimitsOptions
*/
public ListResourceLimitsOptions projectId(String projectId) {
this.queryParameters.replaceValues("projectid", ImmutableSet.of(String.valueOf(projectId + "")));
return this;
}
/**
* List by keyword
*
@ -116,6 +127,14 @@ public class ListResourceLimitsOptions extends BaseHttpRequestOptions {
return options.id(id);
}
/**
* @see ListResourceLimitsOptions#projectId(String)
*/
public static ListResourceLimitsOptions projectId(String projectId) {
ListResourceLimitsOptions options = new ListResourceLimitsOptions();
return options.projectId(projectId);
}
/**
* @see ListResourceLimitsOptions#keyword(String)
*/

View File

@ -36,6 +36,15 @@ public class ListSSHKeyPairsOptions extends BaseHttpRequestOptions {
return this;
}
/**
* @param projectId
* the project to list in
*/
public ListSSHKeyPairsOptions projectId(String projectId) {
this.queryParameters.replaceValues("projectId", ImmutableSet.of(projectId + ""));
return this;
}
public static class Builder {
/**
* @see ListSSHKeyPairsOptions#name
@ -45,5 +54,13 @@ public class ListSSHKeyPairsOptions extends BaseHttpRequestOptions {
return options.name(name);
}
/**
* @see ListSSHKeyPairsOptions#projectId(String)
*/
public static ListSSHKeyPairsOptions projectId(String projectId) {
ListSSHKeyPairsOptions options = new ListSSHKeyPairsOptions();
return options.projectId(projectId);
}
}
}

View File

@ -60,6 +60,15 @@ public class ListSecurityGroupsOptions extends AssociateIPAddressOptions {
}
/**
* @param projectId
* the ID of the project to search in.
*/
public ListSecurityGroupsOptions projectId(String projectId) {
this.queryParameters.replaceValues("projectid", ImmutableSet.of(projectId + ""));
return this;
}
public static class Builder {
/**
@ -86,6 +95,14 @@ public class ListSecurityGroupsOptions extends AssociateIPAddressOptions {
return options.virtualMachineId(virtualMachineId);
}
/**
* @see ListSecurityGroupsOptions#projectId(String)
*/
public static ListSecurityGroupsOptions projectId(String projectId) {
ListSecurityGroupsOptions options = new ListSecurityGroupsOptions();
return options.projectId(projectId);
}
/**
* @see DeployVirtualMachineOptions#accountInDomain
*/

View File

@ -87,6 +87,14 @@ public class ListSnapshotsOptions extends AccountInDomainOptions {
return this;
}
/**
* @param projectId the project to list in
*/
public ListSnapshotsOptions projectId(String projectId) {
this.queryParameters.replaceValues("projectid", ImmutableSet.of(projectId + ""));
return this;
}
public static class Builder {
/**
@ -152,6 +160,13 @@ public class ListSnapshotsOptions extends AccountInDomainOptions {
public static ListSnapshotsOptions volumeId(String volumeId) {
return new ListSnapshotsOptions().volumeId(volumeId);
}
/**
* @param projectId the project to list in
*/
public static ListSnapshotsOptions projectId(String projectId) {
return new ListSnapshotsOptions().projectId(projectId);
}
}
}

View File

@ -72,6 +72,16 @@ public class ListTemplatesOptions extends AccountInDomainOptions {
}
/**
* @param projectId
* list templates by projectId.
*/
public ListTemplatesOptions projectId(String projectId) {
this.queryParameters.replaceValues("projectid", ImmutableSet.of(projectId + ""));
return this;
}
/**
* @param hypervisor
* the hypervisor for which to restrict the search
@ -131,6 +141,14 @@ public class ListTemplatesOptions extends AccountInDomainOptions {
return options.zoneId(id);
}
/**
* @see ListTemplatesOptions#projectId(String)
*/
public static ListTemplatesOptions projectId(String projectId) {
ListTemplatesOptions options = new ListTemplatesOptions();
return options.projectId(projectId);
}
/**
* @see ListTemplatesOptions#hypervisor
*/

View File

@ -43,6 +43,11 @@ public class ListUsageRecordsOptions extends AccountInDomainOptions {
return options.accountId(accountId);
}
public static ListUsageRecordsOptions projectId(String projectId) {
ListUsageRecordsOptions options = new ListUsageRecordsOptions();
return options.projectId(projectId);
}
public static ListUsageRecordsOptions keyword(String keyword) {
ListUsageRecordsOptions options = new ListUsageRecordsOptions();
return options.keyword(keyword);
@ -64,6 +69,11 @@ public class ListUsageRecordsOptions extends AccountInDomainOptions {
return this;
}
public ListUsageRecordsOptions projectId(String projectId) {
this.queryParameters.replaceValues("projectid", ImmutableSet.of(projectId + ""));
return this;
}
public ListUsageRecordsOptions keyword(String keyword) {
this.queryParameters.replaceValues("keyword", ImmutableSet.of(keyword));
return this;

View File

@ -56,6 +56,14 @@ public class ListVMGroupsOptions extends BaseHttpRequestOptions {
return this;
}
/**
* @param projectId id of the project the vm group is in
*/
public ListVMGroupsOptions projectId(String projectId) {
this.queryParameters.replaceValues("projectid", ImmutableSet.of(projectId + ""));
return this;
}
/**
* @param keyword keyword to search on
*/
@ -97,6 +105,14 @@ public class ListVMGroupsOptions extends BaseHttpRequestOptions {
return options.domainId(id);
}
/**
* @see org.jclouds.cloudstack.options.ListVMGroupsOptions#projectId(String)
*/
public static ListVMGroupsOptions projectId(String id) {
ListVMGroupsOptions options = new ListVMGroupsOptions();
return options.projectId(id);
}
/**
* @see org.jclouds.cloudstack.options.ListVMGroupsOptions#keyword
*/

View File

@ -97,6 +97,16 @@ public class ListVirtualMachinesOptions extends AccountInDomainOptions {
}
/**
* @param projectId
* list virtual machines by projectId.
*/
public ListVirtualMachinesOptions projectId(String projectId) {
this.queryParameters.replaceValues("projectid", ImmutableSet.of(projectId + ""));
return this;
}
/**
* @param zoneId
* list virtual machines by zoneId.
@ -191,6 +201,14 @@ public class ListVirtualMachinesOptions extends AccountInDomainOptions {
return options.podId(id);
}
/**
* @see ListVirtualMachinesOptions#projectId(String)
*/
public static ListVirtualMachinesOptions projectId(String id) {
ListVirtualMachinesOptions options = new ListVirtualMachinesOptions();
return options.projectId(id);
}
/**
* @see ListVirtualMachinesOptions#zoneId
*/

View File

@ -55,6 +55,10 @@ public class ListVlanIPRangesOptions extends AccountInDomainOptions {
return new ListVlanIPRangesOptions().podId(podId);
}
public static ListVlanIPRangesOptions projectId(String projectId) {
return new ListVlanIPRangesOptions().projectId(projectId);
}
public static ListVlanIPRangesOptions vlan(long vlan) {
return new ListVlanIPRangesOptions().vlan(vlan);
}
@ -103,6 +107,11 @@ public class ListVlanIPRangesOptions extends AccountInDomainOptions {
return this;
}
public ListVlanIPRangesOptions projectId(String projectId) {
this.queryParameters.replaceValues("projectid", ImmutableSet.of(projectId+""));
return this;
}
public ListVlanIPRangesOptions vlan(String vlan) {
this.queryParameters.replaceValues("vlan", ImmutableSet.of(vlan));
return this;

View File

@ -107,6 +107,15 @@ public class ListVolumesOptions extends AccountInDomainOptions {
}
/**
* @param projectId list volumes by projectId.
*/
public ListVolumesOptions projectId(String projectId) {
this.queryParameters.replaceValues("projectid", ImmutableSet.of(projectId + ""));
return this;
}
public static class Builder {
@ -198,6 +207,14 @@ public class ListVolumesOptions extends AccountInDomainOptions {
ListVolumesOptions options = new ListVolumesOptions();
return options.zoneId(id);
}
/**
* @see ListVolumesOptions#projectId(String)
*/
public static ListVolumesOptions projectId(String id) {
ListVolumesOptions options = new ListVolumesOptions();
return options.projectId(id);
}
}
/**

View File

@ -69,6 +69,14 @@ public class RegisterISOOptions extends AccountInDomainOptions {
return this;
}
/**
* @param projectId the project this ISO will be in.
*/
public RegisterISOOptions projectId(String projectId) {
this.queryParameters.replaceValues("projectid", ImmutableSet.of(projectId + ""));
return this;
}
public static class Builder {
/**
@ -119,6 +127,13 @@ public class RegisterISOOptions extends AccountInDomainOptions {
public static RegisterISOOptions osTypeId(String osTypeId) {
return new RegisterISOOptions().osTypeId(osTypeId);
}
/**
* @param projectId the project this ISO will be in.
*/
public static RegisterISOOptions projectId(String projectId) {
return new RegisterISOOptions().projectId(projectId);
}
}
}

View File

@ -46,6 +46,14 @@ public class RegisterTemplateOptions extends AccountInDomainOptions {
return this;
}
/**
* the project for this template.
*/
public RegisterTemplateOptions projectId(String projectId) {
this.queryParameters.replaceValues("projectid", ImmutableSet.of(projectId + ""));
return this;
}
/**
* true if the template or its derivatives are extractable; default is true
*/
@ -98,6 +106,11 @@ public class RegisterTemplateOptions extends AccountInDomainOptions {
return options.checksum(checksum);
}
public static RegisterTemplateOptions projectId(String projectId) {
RegisterTemplateOptions options = new RegisterTemplateOptions();
return options.projectId(projectId);
}
public static RegisterTemplateOptions isExtractable(boolean isExtractable) {
RegisterTemplateOptions options = new RegisterTemplateOptions();
return options.isExtractable(isExtractable);

View File

@ -39,6 +39,14 @@ public class UpdateTemplatePermissionsOptions extends BaseHttpRequestOptions {
return this;
}
/**
* a list of projects. If specified, "op" parameter has to be passed in.
*/
public UpdateTemplatePermissionsOptions projectIds(Iterable<String> projectIds) {
this.queryParameters.replaceValues("projectids", ImmutableSet.of(Joiner.on(',').join(projectIds)));
return this;
}
/**
* true if the template/iso is extractable, false other wise. Can be set only by root admin
*/
@ -82,6 +90,11 @@ public class UpdateTemplatePermissionsOptions extends BaseHttpRequestOptions {
return options.accounts(accounts);
}
public static UpdateTemplatePermissionsOptions projectIds(Iterable<String> projectIds) {
UpdateTemplatePermissionsOptions options = new UpdateTemplatePermissionsOptions();
return options.projectIds(projectIds);
}
public static UpdateTemplatePermissionsOptions isExtractable(boolean isExtractable) {
UpdateTemplatePermissionsOptions options = new UpdateTemplatePermissionsOptions();
return options.isExtractable(isExtractable);