// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 using System.Collections.Generic; using AWS.Deploy.Common.Recipes.Validation; using Newtonsoft.Json; using Newtonsoft.Json.Converters; namespace AWS.Deploy.Common.Recipes { /// /// Used to deserialize a JSON recipe definition into. /// public class RecipeDefinition { /// /// The unique id of the recipe. That value will be persisted in other config files so it should never be changed once the recipe definition is released. /// public string Id { get; set; } /// /// The version of the recipe /// public string Version { get; set; } /// /// The display friendly name of the recipe definition /// public string Name { get; set; } /// /// Indicates if this recipe should be presented as an option during new deployments. /// public bool DisableNewDeployments { get; set; } /// /// Description of the recipe informing the user what this recipe does and why it is recommended. /// public string Description { get; set; } /// /// Short Description of the recipe informing the user what this recipe does and why it is recommended. /// public string ShortDescription { get; set; } /// /// A runtime property set when the recipe definition is loaded to the location of the definition. This property is used to find /// other assets like the CDK template project in relation to the recipe definition. /// public string? RecipePath { get; set; } /// /// The name of the AWS service the recipe deploys to. This is used for display purposes back to the user to inform then what AWS service the project /// will be deployed to. /// public string TargetService { get; set; } /// /// The environment platform the recipe deploys to. This is used to publish a self-contained .NET application for that platform. /// public TargetPlatform? TargetPlatform { get; set; } /// /// The list of DisplayedResources that lists logical CloudFormation IDs with a description. /// public List? DisplayedResources { get; set; } /// /// Confirmation messages to display to the user before performing deployment. /// public DeploymentConfirmationType? DeploymentConfirmation { get; set; } /// /// The type of deployment to perform. This controls what other tool to use to perform the deployment. For example a value of `CdkProject` means that CDK should /// be used to perform the deployment. /// [JsonConverter(typeof(StringEnumConverter))] public DeploymentTypes DeploymentType { get; set; } /// /// The type of deployment bundle the project should be converted into before deploying. For example turning the project into a build container or a zip file of the build binaries. /// [JsonConverter(typeof(StringEnumConverter))] public DeploymentBundleTypes DeploymentBundle { get; set; } /// /// The location of the CDK project template relative from the recipe definition file. /// public string? CdkProjectTemplate { get; set; } /// /// The ID of the CDK project template for the template generator. /// public string? CdkProjectTemplateId { get; set; } /// /// The rules used by the recommendation engine to determine if the recipe definition is compatible with the project. /// public List RecommendationRules { get; set; } = new (); /// /// The list of categories for the recipes. /// public List Categories { get; set; } = new (); /// /// The settings that can be configured by the user before deploying. /// public List OptionSettings { get; set; } = new (); /// /// List of all validators that should be run against this recipe before deploying. /// public List Validators { get; set; } = new (); /// /// The priority of the recipe. The highest priority is the top choice for deploying to. /// public int RecipePriority { get; set; } /// /// Flag to indicate if this recipe is generated while saving a deployment project. /// public bool PersistedDeploymentProject { get; set; } /// /// The recipe ID of the parent recipe which was used to create the CDK deployment project. /// public string? BaseRecipeId { get; set; } /// /// The settings that are specific to the Deployment Bundle. /// These settings are populated by the . /// public List DeploymentBundleSettings = new(); public RecipeDefinition( string id, string version, string name, DeploymentTypes deploymentType, DeploymentBundleTypes deploymentBundle, string cdkProjectTemplate, string cdkProjectTemplateId, string description, string shortDescription, string targetService) { Id = id; Version = version; Name = name; DeploymentType = deploymentType; DeploymentBundle = deploymentBundle; CdkProjectTemplate = cdkProjectTemplate; CdkProjectTemplateId = cdkProjectTemplateId; Description = description; ShortDescription = shortDescription; TargetService = targetService; } public override string ToString() { return $"{Name} ({Id})"; } } }