public void AssociateAddress(ApAssociateAddressRequest request) { Log.Debug(this, "AssociateAddress()"); try { Authenticate(request); IaasClient.AssociateAddress(request.InstanceId, request.IpAddress); } 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); } }