public ApAllocateAddressResponse AllocateAddress(ApAllocateAddressRequest request) { Log.Debug(this, "AllocateAddress()"); try { Authenticate(request); ApAllocateAddressResponse response = new ApAllocateAddressResponse(); response.Address = IaasClient.AllocateAddress(); return(response); } catch (Exception e) { Log.Error(this, e); throw e; } }
// // GET: /applicationgrid/assignpublicip/{instanceId} public ActionResult AssignPublicIp(string instanceId) { try { ApAllocateAddressRequest allocateRequest = new ApAllocateAddressRequest(Credentials); ApAllocateAddressResponse allocateResponse = EndPoints.ApDashboardService.AllocateAddress(allocateRequest); ApAssociateAddressRequest associateRequest = new ApAssociateAddressRequest(Credentials); associateRequest.InstanceId = instanceId; associateRequest.IpAddress = allocateResponse.Address; EndPoints.ApDashboardService.AssociateAddress(associateRequest); return(RedirectToAction("Instances")); } catch (Exception e) { return(ShowError(e)); } }