示例#1
0
        /// <summary>
        /// Parse ResourceRecommendationBase to equivalent PSObject
        /// </summary>
        /// <param name="recommendationBase">ResourceRecommendationBase to be parsed</param>
        /// <returns>PsAzureAdvisorResourceRecommendationBase generated</returns>
        internal static PsAzureAdvisorResourceRecommendationBase GetFromResourceRecommendationBase(ResourceRecommendationBase recommendationBase)
        {
            if (recommendationBase == null)
            {
                return(null);
            }

            return(new PsAzureAdvisorResourceRecommendationBase()
            {
                Id = recommendationBase.Id,
                Category = recommendationBase.Category,
                ExtendedProperties = recommendationBase.ExtendedProperties != null ? new Dictionary <string, string>(recommendationBase.ExtendedProperties) : new Dictionary <string, string>(),
                Impact = recommendationBase.Impact,
                ImpactedField = recommendationBase.ImpactedField,
                ImpactedValue = recommendationBase.ImpactedValue,
                LastUpdated = recommendationBase.LastUpdated,
                Metadata = recommendationBase.Metadata != null ? new Dictionary <string, object>(recommendationBase.Metadata) : new Dictionary <string, object>(),
                RecommendationTypeId = recommendationBase.RecommendationTypeId,
                Risk = recommendationBase.Risk,
                ShortDescription = recommendationBase.ShortDescription != null?PsRecommendationBaseShortDescription.FromShortDescription(recommendationBase.ShortDescription) : null,
                                       SuppressionIds = recommendationBase.SuppressionIds == null ? new List <Guid?>() : recommendationBase.SuppressionIds,
                                       Name = recommendationBase.Name,
                                       Type = recommendationBase.Type,
            });
        }
示例#2
0
        /// <summary>
        /// Parse the ShortDescription into PsObject
        /// </summary>
        /// <param name="shortDescription">ShortDescription to be converted</param>
        /// <returns>PsRecommendationBaseShortDescription generated</returns>
        internal static PsRecommendationBaseShortDescription FromShortDescription(ShortDescription shortDescription)
        {
            if (shortDescription == null)
            {
                return(null);
            }

            PsRecommendationBaseShortDescription psRecommendationBaseShortDescription = new PsRecommendationBaseShortDescription();

            if (!string.IsNullOrEmpty(shortDescription.Problem))
            {
                psRecommendationBaseShortDescription.Problem = shortDescription.Problem;
            }

            if (!string.IsNullOrEmpty(shortDescription.Solution))
            {
                psRecommendationBaseShortDescription.Solution = shortDescription.Solution;
            }

            return(psRecommendationBaseShortDescription);
        }