Ejemplo n.º 1
0
        public static PSDeploymentOperation ToPSDeploymentOperation(this DeploymentOperation result)
        {
            if (result != null)
            {
                return(new PSDeploymentOperation()
                {
                    Id = result.Id,
                    OperationId = result.OperationId,
                    ProvisioningState = result.Properties.ProvisioningState,
                    StatusCode = result.Properties.StatusCode,
                    StatusMessage = DeploymentOperationErrorInfo.GetErrorMessageWithDetails(DeploymentOperationErrorInfo.DeserializeDeploymentOperationError(result.Properties?.StatusMessage?.ToString()))
                                    ?? ProjectResources.GenericDeploymentFailedWithErrors,
                    TargetResource = result.Properties.TargetResource?.Id
                });
            }

            return(null);
        }
        public static PSDeploymentOperation ToPSDeploymentOperation(this DeploymentOperation result)
        {
            if (result != null)
            {
                return(new PSDeploymentOperation()
                {
                    Id = result.Id,
                    OperationId = result.OperationId,
                    ProvisioningState = result.Properties.ProvisioningState,
                    StatusCode = result.Properties.StatusCode,
                    StatusMessage = DeploymentOperationErrorInfo
                                    .DeserializeDeploymentOperationError(result.Properties?.StatusMessage?.ToString())?
                                    .ToFormattedString()?
                                    .TrimEnd(System.Environment.NewLine.ToCharArray())
                                    ?? result.Properties.StatusMessage,     // To-Do: With the new API version this work will move to error model extensions.
                    TargetResource = result.Properties.TargetResource?.Id
                });
            }

            return(null);
        }