Exemplo n.º 1
0
        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;
            }
        }
Exemplo n.º 2
0
        //
        // 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));
            }
        }