protected override void ProcessRecord()
        {
            Types.returnDeploymentClone retResult = new Types.returnDeploymentClone();

            retResult.DeploymentID = deploymentID;

            base.ProcessRecord();

            try
            {
                string rsCloneDeployment = RightScale.netClient.Deployment.clone(deploymentID);

                retResult.DeploymentID = deploymentID;
                retResult.CloneID = rsCloneDeployment;
                retResult.Message = "Success";
                retResult.Details = "Deployment Cloned";
                retResult.Result = true;

                WriteObject(retResult);
            }
            catch (RightScaleAPIException rex)
            {
                retResult.DeploymentID = deploymentID;
                retResult.CloneID = null;
                retResult.Message = "Fail";
                retResult.Details = rex.ErrorData;
                retResult.APIHref = rex.APIHref;
                retResult.Result = false;

                WriteObject(retResult);
            }
            catch (System.Exception excp)
            {
                retResult.DeploymentID = deploymentID;
                retResult.CloneID = null;
                retResult.Message = "Fail";
                retResult.Details = "Exception cloning Deployment - " + excp.Message;
                retResult.APIHref = null;
                retResult.Result = false;

                WriteObject(retResult);
            }
        }
示例#2
0
        protected override void ProcessRecord()
        {
            Types.returnDeploymentClone retResult = new Types.returnDeploymentClone();

            retResult.DeploymentID = deploymentID;

            base.ProcessRecord();

            try
            {
                string rsCloneDeployment = RightScale.netClient.Deployment.clone(deploymentID);

                retResult.DeploymentID = deploymentID;
                retResult.CloneID      = rsCloneDeployment;
                retResult.Message      = "Success";
                retResult.Details      = "Deployment Cloned";
                retResult.Result       = true;

                WriteObject(retResult);
            }
            catch (RightScaleAPIException rex)
            {
                retResult.DeploymentID = deploymentID;
                retResult.CloneID      = null;
                retResult.Message      = "Fail";
                retResult.Details      = rex.ErrorData;
                retResult.APIHref      = rex.APIHref;
                retResult.Result       = false;

                WriteObject(retResult);
            }
            catch (System.Exception excp)
            {
                retResult.DeploymentID = deploymentID;
                retResult.CloneID      = null;
                retResult.Message      = "Fail";
                retResult.Details      = "Exception cloning Deployment - " + excp.Message;
                retResult.APIHref      = null;
                retResult.Result       = false;

                WriteObject(retResult);
            }
        }