| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -17,6 +17,7 @@ | |||
| 17 | 17 | ||
| 18 | 18 | package com.cloud.region.ha; | |
| 19 | 19 | ||
| 20 | + import com.cloud.network.rules.LoadBalancer; | ||
| 20 | 21 | import org.apache.cloudstack.api.command.user.region.ha.gslb.*; | |
| 21 | 22 | ||
| 22 | 23 | import java.util.List; | |
@@ -44,4 +45,6 @@ public interface GlobalLoadBalancingRulesService { | |||
| 44 | 45 | ||
| 45 | 46 | List<GlobalLoadBalancerRule> listGlobalLoadBalancerRule(ListGlobalLoadBalancerRuleCmd listGslbCmd); | |
| 46 | 47 | ||
| 48 | + List<LoadBalancer> listSiteLoadBalancers(long gslbRuleId); | ||
| 49 | + | ||
| 47 | 50 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -21,9 +21,22 @@ | |||
| 21 | 21 | ||
| 22 | 22 | import javax.naming.InsufficientResourcesException; | |
| 23 | 23 | ||
| 24 | + import org.apache.cloudstack.api.BaseCmd.HTTPMethod; | ||
| 24 | 25 | import org.apache.cloudstack.api.command.admin.vm.AssignVMCmd; | |
| 25 | 26 | import org.apache.cloudstack.api.command.admin.vm.RecoverVMCmd; | |
| 26 | - import org.apache.cloudstack.api.command.user.vm.*; | ||
| 27 | + import org.apache.cloudstack.api.command.user.vm.AddNicToVMCmd; | ||
| 28 | + import org.apache.cloudstack.api.command.user.vm.DeployVMCmd; | ||
| 29 | + import org.apache.cloudstack.api.command.user.vm.DestroyVMCmd; | ||
| 30 | + import org.apache.cloudstack.api.command.user.vm.RebootVMCmd; | ||
| 31 | + import org.apache.cloudstack.api.command.user.vm.RemoveNicFromVMCmd; | ||
| 32 | + import org.apache.cloudstack.api.command.user.vm.ResetVMPasswordCmd; | ||
| 33 | + import org.apache.cloudstack.api.command.user.vm.ResetVMSSHKeyCmd; | ||
| 34 | + import org.apache.cloudstack.api.command.user.vm.RestoreVMCmd; | ||
| 35 | + import org.apache.cloudstack.api.command.user.vm.ScaleVMCmd; | ||
| 36 | + import org.apache.cloudstack.api.command.user.vm.StartVMCmd; | ||
| 37 | + import org.apache.cloudstack.api.command.user.vm.UpdateDefaultNicForVMCmd; | ||
| 38 | + import org.apache.cloudstack.api.command.user.vm.UpdateVMCmd; | ||
| 39 | + import org.apache.cloudstack.api.command.user.vm.UpgradeVMCmd; | ||
| 27 | 40 | import org.apache.cloudstack.api.command.user.vmgroup.CreateVMGroupCmd; | |
| 28 | 41 | import org.apache.cloudstack.api.command.user.vmgroup.DeleteVMGroupCmd; | |
| 29 | 42 | import com.cloud.dc.DataCenter; | |
@@ -185,8 +198,8 @@ UserVm startVirtualMachine(StartVMCmd cmd) throws StorageUnavailableException, E | |||
| 185 | 198 | */ | |
| 186 | 199 | UserVm createBasicSecurityGroupVirtualMachine(DataCenter zone, ServiceOffering serviceOffering, VirtualMachineTemplate template, List<Long> securityGroupIdList, Account owner, String hostName, | |
| 187 | 200 | String displayName, Long diskOfferingId, Long diskSize, String group, HypervisorType hypervisor, | |
| 188 | - String userData, String sshKeyPair, Map<Long, IpAddresses> requestedIps, IpAddresses defaultIp, | ||
| 189 | - String keyboard, List<Long> affinityGroupIdList) | ||
| 201 | + HTTPMethod httpmethod, String userData, String sshKeyPair, Map<Long, IpAddresses> requestedIps, | ||
| 202 | + IpAddresses defaultIp, String keyboard, List<Long> affinityGroupIdList) | ||
| 190 | 203 | throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException, StorageUnavailableException, ResourceAllocationException; | |
| 191 | 204 | ||
| 192 | 205 | /** | |
@@ -257,8 +270,8 @@ UserVm createBasicSecurityGroupVirtualMachine(DataCenter zone, ServiceOffering s | |||
| 257 | 270 | * @throws InsufficientResourcesException | |
| 258 | 271 | */ | |
| 259 | 272 | UserVm createAdvancedSecurityGroupVirtualMachine(DataCenter zone, ServiceOffering serviceOffering, VirtualMachineTemplate template, List<Long> networkIdList, List<Long> securityGroupIdList, | |
| 260 | - Account owner, String hostName, String displayName, Long diskOfferingId, Long diskSize, String group, HypervisorType hypervisor, String userData, String sshKeyPair, Map<Long, IpAddresses> requestedIps, | ||
| 261 | - IpAddresses defaultIps, String keyboard, List<Long> affinityGroupIdList) | ||
| 273 | + Account owner, String hostName, String displayName, Long diskOfferingId, Long diskSize, String group, HypervisorType hypervisor, HTTPMethod httpmethod, String userData, String sshKeyPair, | ||
| 274 | + Map<Long, IpAddresses> requestedIps, IpAddresses defaultIps, String keyboard, List<Long> affinityGroupIdList) | ||
| 262 | 275 | throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException, StorageUnavailableException, ResourceAllocationException; | |
| 263 | 276 | ||
| 264 | 277 | /** | |
@@ -327,8 +340,8 @@ UserVm createAdvancedSecurityGroupVirtualMachine(DataCenter zone, ServiceOfferin | |||
| 327 | 340 | */ | |
| 328 | 341 | UserVm createAdvancedVirtualMachine(DataCenter zone, ServiceOffering serviceOffering, VirtualMachineTemplate template, List<Long> networkIdList, Account owner, String hostName, | |
| 329 | 342 | String displayName, Long diskOfferingId, Long diskSize, String group, HypervisorType hypervisor, | |
| 330 | - String userData, String sshKeyPair, Map<Long, IpAddresses> requestedIps, IpAddresses defaultIps, | ||
| 331 | - String keyboard, List<Long> affinityGroupIdList) | ||
| 343 | + HTTPMethod httpmethod, String userData, String sshKeyPair, Map<Long, IpAddresses> requestedIps, | ||
| 344 | + IpAddresses defaultIps, String keyboard, List<Long> affinityGroupIdList) | ||
| 332 | 345 | throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException, StorageUnavailableException, ResourceAllocationException; | |
| 333 | 346 | ||
| 334 | 347 | /** | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -335,6 +335,7 @@ public class ApiConstants { | |||
| 335 | 335 | public static final String LOAD_BALANCER_DEVICE_STATE = "lbdevicestate"; | |
| 336 | 336 | public static final String LOAD_BALANCER_DEVICE_CAPACITY = "lbdevicecapacity"; | |
| 337 | 337 | public static final String LOAD_BALANCER_DEVICE_DEDICATED = "lbdevicededicated"; | |
| 338 | + public static final String LOAD_BALANCER_RULE = "loadbalancerrule"; | ||
| 338 | 339 | public static final String LOAD_BALANCER_RULE_LIST = "loadbalancerrulelist"; | |
| 339 | 340 | public static final String FIREWALL_DEVICE_ID = "fwdeviceid"; | |
| 340 | 341 | public static final String FIREWALL_DEVICE_NAME = "fwdevicename"; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -95,6 +95,11 @@ public enum CommandType { | |||
| 95 | 95 | private Object _responseObject = null; | |
| 96 | 96 | private Map<String, String> fullUrlParams; | |
| 97 | 97 | ||
| 98 | + public enum HTTPMethod { | ||
| 99 | + GET, POST, PUT, DELETE | ||
| 100 | + } | ||
| 101 | + private HTTPMethod httpMethod; | ||
| 102 | + | ||
| 98 | 103 | @Parameter(name = "response", type = CommandType.STRING) | |
| 99 | 104 | private String responseType; | |
| 100 | 105 | ||
@@ -140,6 +145,25 @@ public enum CommandType { | |||
| 140 | 145 | public void configure() { | |
| 141 | 146 | } | |
| 142 | 147 | ||
| 148 | + public HTTPMethod getHttpMethod() { | ||
| 149 | + return httpMethod; | ||
| 150 | + } | ||
| 151 | + | ||
| 152 | + public void setHttpMethod(String method) { | ||
| 153 | + if (method != null) { | ||
| 154 | + if (method.equalsIgnoreCase("GET")) | ||
| 155 | + httpMethod = HTTPMethod.GET; | ||
| 156 | + else if (method.equalsIgnoreCase("PUT")) | ||
| 157 | + httpMethod = HTTPMethod.PUT; | ||
| 158 | + else if (method.equalsIgnoreCase("POST")) | ||
| 159 | + httpMethod = HTTPMethod.POST; | ||
| 160 | + else if (method.equalsIgnoreCase("DELETE")) | ||
| 161 | + httpMethod = HTTPMethod.DELETE; | ||
| 162 | + } else { | ||
| 163 | + httpMethod = HTTPMethod.GET; | ||
| 164 | + } | ||
| 165 | + } | ||
| 166 | + | ||
| 143 | 167 | public String getResponseType() { | |
| 144 | 168 | if (responseType == null) { | |
| 145 | 169 | return RESPONSE_TYPE_XML; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -16,9 +16,9 @@ | |||
| 16 | 16 | // under the License. | |
| 17 | 17 | package org.apache.cloudstack.api.command.admin.account; | |
| 18 | 18 | ||
| 19 | - import java.util.Collection; | ||
| 20 | - import java.util.Map; | ||
| 21 | - | ||
| 19 | + import com.cloud.user.Account; | ||
| 20 | + import com.cloud.user.UserAccount; | ||
| 21 | + import com.cloud.user.UserContext; | ||
| 22 | 22 | import org.apache.cloudstack.api.APICommand; | |
| 23 | 23 | import org.apache.cloudstack.api.ApiConstants; | |
| 24 | 24 | import org.apache.cloudstack.api.ApiErrorCode; | |
@@ -27,14 +27,12 @@ | |||
| 27 | 27 | import org.apache.cloudstack.api.ServerApiException; | |
| 28 | 28 | import org.apache.cloudstack.api.response.AccountResponse; | |
| 29 | 29 | import org.apache.cloudstack.api.response.DomainResponse; | |
| 30 | - import org.apache.cloudstack.api.response.UserResponse; | ||
| 31 | 30 | import org.apache.log4j.Logger; | |
| 32 | 31 | ||
| 33 | - import com.cloud.user.Account; | ||
| 34 | - import com.cloud.user.UserAccount; | ||
| 35 | - import com.cloud.user.UserContext; | ||
| 32 | + import java.util.Collection; | ||
| 33 | + import java.util.Map; | ||
| 36 | 34 | ||
| 37 | - @APICommand(name = "createAccount", description="Creates an account", responseObject=UserResponse.class) | ||
| 35 | + @APICommand(name = "createAccount", description="Creates an account", responseObject=AccountResponse.class) | ||
| 38 | 36 | public class CreateAccountCmd extends BaseCmd { | |
| 39 | 37 | public static final Logger s_logger = Logger.getLogger(CreateAccountCmd.class.getName()); | |
| 40 | 38 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -58,7 +58,7 @@ public class MigrateVMCmd extends BaseAsyncCmd { | |||
| 58 | 58 | required=true, description="the ID of the virtual machine") | |
| 59 | 59 | private Long virtualMachineId; | |
| 60 | 60 | ||
| 61 | - @Parameter(name=ApiConstants.STORAGE_ID, type=CommandType.LONG, entityType=StoragePoolResponse.class, | ||
| 61 | + @Parameter(name=ApiConstants.STORAGE_ID, type=CommandType.UUID, entityType=StoragePoolResponse.class, | ||
| 62 | 62 | required=false, description="Destination storage pool ID to migrate VM volumes to. Required for migrating the root disk volume") | |
| 63 | 63 | private Long storageId; | |
| 64 | 64 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -128,7 +128,7 @@ public class DeployVMCmd extends BaseAsyncCreateCmd { | |||
| 128 | 128 | @Parameter(name=ApiConstants.HYPERVISOR, type=CommandType.STRING, description="the hypervisor on which to deploy the virtual machine") | |
| 129 | 129 | private String hypervisor; | |
| 130 | 130 | ||
| 131 | - @Parameter(name=ApiConstants.USER_DATA, type=CommandType.STRING, description="an optional binary data that can be sent to the virtual machine upon a successful deployment. This binary data must be base64 encoded before adding it to the request. Currently only HTTP GET is supported. Using HTTP GET (via querystring), you can send up to 2KB of data after base64 encoding.", length=2048) | ||
| 131 | + @Parameter(name=ApiConstants.USER_DATA, type=CommandType.STRING, description="an optional binary data that can be sent to the virtual machine upon a successful deployment. This binary data must be base64 encoded before adding it to the request. Using HTTP GET (via querystring), you can send up to 2KB of data after base64 encoding. Using HTTP POST(via POST body), you can send up to 32K of data after base64 encoding.", length=32768) | ||
| 132 | 132 | private String userData; | |
| 133 | 133 | ||
| 134 | 134 | @Parameter(name=ApiConstants.SSH_KEYPAIR, type=CommandType.STRING, description="name of the ssh key pair used to login to the virtual machine") | |
@@ -312,8 +312,8 @@ private Map<Long, IpAddresses> getIpToNetworkMap() { | |||
| 312 | 312 | throw new InvalidParameterValueException("Unable to translate and find entity with networkId: " + ips.get("networkid")); | |
| 313 | 313 | } | |
| 314 | 314 | } | |
| 315 | - String requestedIp = (String) ips.get("ip"); | ||
| 316 | - String requestedIpv6 = (String) ips.get("ipv6"); | ||
| 315 | + String requestedIp = ips.get("ip"); | ||
| 316 | + String requestedIpv6 = ips.get("ipv6"); | ||
| 317 | 317 | if (requestedIpv6 != null) { | |
| 318 | 318 | requestedIpv6 = requestedIpv6.toLowerCase(); | |
| 319 | 319 | } | |
@@ -481,18 +481,18 @@ public void create() throws ResourceAllocationException{ | |||
| 481 | 481 | throw new InvalidParameterValueException("Can't specify network Ids in Basic zone"); | |
| 482 | 482 | } else { | |
| 483 | 483 | vm = _userVmService.createBasicSecurityGroupVirtualMachine(zone, serviceOffering, template, getSecurityGroupIdList(), owner, name, | |
| 484 | - displayName, diskOfferingId, size, group, getHypervisor(), userData, sshKeyPairName, getIpToNetworkMap(), addrs, keyboard, getAffinityGroupIdList()); | ||
| 484 | + displayName, diskOfferingId, size, group, getHypervisor(), this.getHttpMethod(), userData, sshKeyPairName, getIpToNetworkMap(), addrs, keyboard, getAffinityGroupIdList()); | ||
| 485 | 485 | } | |
| 486 | 486 | } else { | |
| 487 | 487 | if (zone.isSecurityGroupEnabled()) { | |
| 488 | 488 | vm = _userVmService.createAdvancedSecurityGroupVirtualMachine(zone, serviceOffering, template, getNetworkIds(), getSecurityGroupIdList(), | |
| 489 | - owner, name, displayName, diskOfferingId, size, group, getHypervisor(), userData, sshKeyPairName, getIpToNetworkMap(), addrs, keyboard, getAffinityGroupIdList()); | ||
| 489 | + owner, name, displayName, diskOfferingId, size, group, getHypervisor(), this.getHttpMethod(), userData, sshKeyPairName, getIpToNetworkMap(), addrs, keyboard, getAffinityGroupIdList()); | ||
| 490 | 490 | } else { | |
| 491 | 491 | if (getSecurityGroupIdList() != null && !getSecurityGroupIdList().isEmpty()) { | |
| 492 | 492 | throw new InvalidParameterValueException("Can't create vm with security groups; security group feature is not enabled per zone"); | |
| 493 | 493 | } | |
| 494 | 494 | vm = _userVmService.createAdvancedVirtualMachine(zone, serviceOffering, template, getNetworkIds(), owner, name, displayName, | |
| 495 | - diskOfferingId, size, group, getHypervisor(), userData, sshKeyPairName, getIpToNetworkMap(), addrs, keyboard, getAffinityGroupIdList()); | ||
| 495 | + diskOfferingId, size, group, getHypervisor(), this.getHttpMethod(), userData, sshKeyPairName, getIpToNetworkMap(), addrs, keyboard, getAffinityGroupIdList()); | ||
| 496 | 496 | } | |
| 497 | 497 | } | |
| 498 | 498 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -75,10 +75,12 @@ public class ListVMsCmd extends BaseListTaggedResourcesCmd { | |||
| 75 | 75 | @Parameter(name=ApiConstants.STATE, type=CommandType.STRING, description="state of the virtual machine") | |
| 76 | 76 | private String state; | |
| 77 | 77 | ||
| 78 | - @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.UUID, entityType=ZoneResponse.class, | ||
| 79 | - description="the availability zone ID") | ||
| 78 | + @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.UUID, entityType=ZoneResponse.class, description="the availability zone ID") | ||
| 80 | 79 | private Long zoneId; | |
| 81 | 80 | ||
| 81 | + @Parameter(name=ApiConstants.ZONE_TYPE, type=CommandType.STRING, description="the network type of the zone that the virtual machine belongs to") | ||
| 82 | + private String zoneType; | ||
| 83 | + | ||
| 82 | 84 | @Parameter(name=ApiConstants.FOR_VIRTUAL_NETWORK, type=CommandType.BOOLEAN, | |
| 83 | 85 | description="list by network type; true if need to list vms using Virtual Network, false otherwise") | |
| 84 | 86 | private Boolean forVirtualNetwork; | |
@@ -147,6 +149,10 @@ public Long getZoneId() { | |||
| 147 | 149 | return zoneId; | |
| 148 | 150 | } | |
| 149 | 151 | ||
| 152 | + public String getZoneType() { | ||
| 153 | + return zoneType; | ||
| 154 | + } | ||
| 155 | + | ||
| 150 | 156 | public Boolean getForVirtualNetwork() { | |
| 151 | 157 | return forVirtualNetwork; | |
| 152 | 158 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -61,7 +61,7 @@ public class UpdateVMCmd extends BaseCmd{ | |||
| 61 | 61 | description="the ID of the OS type that best represents this VM.") | |
| 62 | 62 | private Long osTypeId; | |
| 63 | 63 | ||
| 64 | - @Parameter(name=ApiConstants.USER_DATA, type=CommandType.STRING, description="an optional binary data that can be sent to the virtual machine upon a successful deployment. This binary data must be base64 encoded before adding it to the request. Currently only HTTP GET is supported. Using HTTP GET (via querystring), you can send up to 2KB of data after base64 encoding.", length=2048) | ||
| 64 | + @Parameter(name=ApiConstants.USER_DATA, type=CommandType.STRING, description="an optional binary data that can be sent to the virtual machine upon a successful deployment. This binary data must be base64 encoded before adding it to the request. Using HTTP GET (via querystring), you can send up to 2KB of data after base64 encoding. Using HTTP POST(via POST body), you can send up to 32K of data after base64 encoding.", length=32768) | ||
| 65 | 65 | private String userData; | |
| 66 | 66 | ||
| 67 | 67 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -67,6 +67,9 @@ public class ListVolumesCmd extends BaseListTaggedResourcesCmd { | |||
| 67 | 67 | description="the ID of the availability zone") | |
| 68 | 68 | private Long zoneId; | |
| 69 | 69 | ||
| 70 | + @Parameter(name=ApiConstants.ZONE_TYPE, type=CommandType.STRING, description="the network type of the zone that the virtual machine belongs to") | ||
| 71 | + private String zoneType; | ||
| 72 | + | ||
| 70 | 73 | ///////////////////////////////////////////////////// | |
| 71 | 74 | /////////////////// Accessors /////////////////////// | |
| 72 | 75 | ///////////////////////////////////////////////////// | |
@@ -100,6 +103,10 @@ public Long getZoneId() { | |||
| 100 | 103 | return zoneId; | |
| 101 | 104 | } | |
| 102 | 105 | ||
| 106 | + public String getZoneType() { | ||
| 107 | + return zoneType; | ||
| 108 | + } | ||
| 109 | + | ||
| 103 | 110 | ///////////////////////////////////////////////////// | |
| 104 | 111 | /////////////// API Implementation/////////////////// | |
| 105 | 112 | ///////////////////////////////////////////////////// | |
| Back | FazBrowse Home | New Git URL |
0 commit comments