Esempio n. 1
0
        protected override void ProcessRecord()
        {
            Types.returnServer result = new Types.returnServer();

            base.ProcessRecord();
            try
            {
                bool rsDestroyServer = RightScale.netClient.Server.destroy(serverID);

                if (rsDestroyServer == true)
                {
                    result.ServerID = serverID;
                    result.Message  = "Server destroyed";
                    result.Result   = true;

                    WriteObject(result);
                }
                else
                {
                    result.ServerID = serverID;
                    result.Message  = "Error destroying server";
                    result.Result   = false;

                    WriteObject(result);
                }
            }
            catch (RightScaleAPIException rse)
            {
                result.Message = "Error destroying server";
                result.ErrData = rse.ErrorData;
                result.Result  = false;

                WriteObject(result);
            }
        }
Esempio n. 2
0
        protected override void ProcessRecord()
        {
            Types.returnServer result = new Types.returnServer();

            base.ProcessRecord();

            try
            {
                string rsNewServerID = RightScale.netClient.Server.create(cloudID, deploymentID, serverTemplateID, serverName);

                if (rsNewServerID != "")
                {
                    result.ServerID = rsNewServerID;
                    result.Message = "Server created";
                    result.Result = true;
                    result.DeploymentID = deploymentID;
                    result.ServerTemplateID = serverTemplateID;

                    WriteObject(result);
                }
                else
                {
                    result.Message = "Error creating server";
                    result.Result = false;
                    result.ServerID = rsNewServerID;
                    result.DeploymentID = deploymentID;
                    result.ServerTemplateID = serverTemplateID;

                    WriteObject(result);
                }
            }
            catch (RightScaleAPIException errCreate)
            {
                result.ErrData = errCreate.ErrorData;
                result.APIHref = errCreate.APIHref;
                result.Message = errCreate.InnerException.Message;
                result.Result = false;
                result.DeploymentID = deploymentID;
                result.ServerTemplateID = serverTemplateID;

                WriteObject(result);
            }
        }
Esempio n. 3
0
        protected override void ProcessRecord()
        {
            Types.returnServer result = new Types.returnServer();

            base.ProcessRecord();

            try
            {
                string rsNewServerID = RightScale.netClient.Server.create(cloudID, deploymentID, serverTemplateID, serverName);

                if (rsNewServerID != "")
                {
                    result.ServerID         = rsNewServerID;
                    result.Message          = "Server created";
                    result.Result           = true;
                    result.DeploymentID     = deploymentID;
                    result.ServerTemplateID = serverTemplateID;

                    WriteObject(result);
                }
                else
                {
                    result.Message          = "Error creating server";
                    result.Result           = false;
                    result.ServerID         = rsNewServerID;
                    result.DeploymentID     = deploymentID;
                    result.ServerTemplateID = serverTemplateID;

                    WriteObject(result);
                }
            }
            catch (RightScaleAPIException errCreate)
            {
                result.ErrData          = errCreate.ErrorData;
                result.APIHref          = errCreate.APIHref;
                result.Message          = errCreate.InnerException.Message;
                result.Result           = false;
                result.DeploymentID     = deploymentID;
                result.ServerTemplateID = serverTemplateID;

                WriteObject(result);
            }
        }
Esempio n. 4
0
        protected override void ProcessRecord()
        {
            Types.returnServer result = new Types.returnServer();

            base.ProcessRecord();

            try
            {
                bool rsUpdateServer = RightScale.netClient.Server.update(serverID, description, name, optimizedvolumes);

                if (rsUpdateServer == true)
                {
                    result.ServerID = serverID;
                    result.Message  = "Server Updated";
                    result.Result   = true;

                    WriteObject(result);
                }
                else
                {
                    result.ServerID = serverID;
                    result.Message  = "Error Updating server";
                    result.Result   = false;

                    WriteObject(result);
                }
            }
            catch (RightScaleAPIException rex)
            {
                WriteObject(rex.Message);
                WriteObject(rex.ErrorData);
                WriteObject(rex.APIHref);
            }
            catch (Exception ex)
            {
                WriteObject(ex.Message);
            }
        }
Esempio n. 5
0
        protected override void ProcessRecord()
        {
            Types.returnServer result = new Types.returnServer();

            base.ProcessRecord();

            try
            {
                bool rsUpdateServer = RightScale.netClient.Server.update(serverID,description,name,optimizedvolumes);

                if (rsUpdateServer == true)
                {
                    result.ServerID = serverID;
                    result.Message = "Server Updated";
                    result.Result = true;

                    WriteObject(result);
                }
                else
                {
                    result.ServerID = serverID;
                    result.Message = "Error Updating server";
                    result.Result = false;

                    WriteObject(result);

                }
            }
            catch (RightScaleAPIException rex)
            {
                WriteObject(rex.Message);
                WriteObject(rex.ErrorData);
                WriteObject(rex.APIHref);
            }
            catch (Exception ex)
            {
                WriteObject(ex.Message);
            }
        }
Esempio n. 6
0
        protected override void ProcessRecord()
        {
            Types.returnServer result = new Types.returnServer();

            base.ProcessRecord();
            try
            {
              bool rsDestroyServer = RightScale.netClient.Server.destroy(serverID);

              if (rsDestroyServer == true)
              {
                  result.ServerID = serverID;
                  result.Message = "Server destroyed";
                  result.Result = true;

                  WriteObject(result);
              }
              else
              {
                  result.ServerID = serverID;
                  result.Message = "Error destroying server";
                  result.Result = false;

                  WriteObject(result);
              }
               }
               catch(RightScaleAPIException rse)
               {
               result.Message = "Error destroying server";
               result.ErrData = rse.ErrorData;
               result.Result = false;

               WriteObject(result);
               }
        }