|
| 1 | +namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation |
| 2 | +{ |
| 3 | + using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters; |
| 4 | + using System; |
| 5 | + using System.Collections.Generic; |
| 6 | + using System.Management.Automation; |
| 7 | + using System.Text; |
| 8 | + |
| 9 | + [Cmdlet("New", Common.AzureRMConstants.AzureRMPrefix + "DeploymentStack", |
| 10 | + SupportsShouldProcess = true, DefaultParameterSetName = NewAzDeploymentStack.ParameterlessTemplateFileParameterSetName), OutputType(typeof(PSDeploymentStack))] |
| 11 | + public class NewAzDeploymentStack : DeploymentStacksCmdletBase |
| 12 | + { |
| 13 | + |
| 14 | + #region Cmdlet Parameters and Parameter Set Definitions |
| 15 | + |
| 16 | + internal const string ParameterlessTemplateFileParameterSetName = "ByTemplateFileWithNoParameters"; |
| 17 | + internal const string ParameterlessTemplateUriParameterSetName = "ByTemplateUriWithNoParameters"; |
| 18 | + internal const string ParameterlessTemplateSpecParameterSetName = "ByTemplateSpecWithNoParameters"; |
| 19 | + |
| 20 | + internal const string ParameterFileTemplateFileParameterSetName = "ByTemplateFileWithParameterFile"; |
| 21 | + internal const string ParameterFileTemplateUriParameterSetName = "ByTemplateUriWithParameterFile"; |
| 22 | + internal const string ParameterFileTemplateSpecParameterSetName = "ByTemplateSpecWithParameterFile"; |
| 23 | + |
| 24 | + internal const string ParameterUriTemplateFileParameterSetName = "ByTemplateFileWithParameterUri"; |
| 25 | + internal const string ParameterUriTemplateUriParameterSetName = "ByTemplateUriWithParameterUri"; |
| 26 | + internal const string ParameterUriTemplateSpecParameterSetName = "ByTemplateSpecWithParameterUri"; |
| 27 | + |
| 28 | + [Parameter(Position = 0, Mandatory = true, ValueFromPipelineByPropertyName = true, |
| 29 | + HelpMessage = "The name of the deploymentStack to create")] |
| 30 | + [ValidateNotNullOrEmpty] |
| 31 | + public string Name { get; set; } |
| 32 | + |
| 33 | + [Parameter(Position = 1, Mandatory = true, ValueFromPipelineByPropertyName = true, |
| 34 | + HelpMessage = "The name of the ResourceGroup to be used")] |
| 35 | + [ResourceGroupCompleter] |
| 36 | + [ValidateNotNullOrEmpty] |
| 37 | + public string ResourceGroupName { get; set; } |
| 38 | + |
| 39 | + [Parameter(Position = 2, ParameterSetName = ParameterFileTemplateFileParameterSetName, |
| 40 | + Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "TemplateFile to be used to create the stack")] |
| 41 | + [Parameter(Position = 2, ParameterSetName = ParameterUriTemplateFileParameterSetName, |
| 42 | + Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "TemplateFile to be used to create the stack")] |
| 43 | + [Parameter(Position = 2, ParameterSetName = ParameterlessTemplateFileParameterSetName, |
| 44 | + Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "TemplateFile to be used to create the stack")] |
| 45 | + public string TemplateFile { get; set; } |
| 46 | + |
| 47 | + [Parameter(Position = 2, ParameterSetName = ParameterFileTemplateUriParameterSetName, |
| 48 | + Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "Location of the Template to be used to create the stack")] |
| 49 | + [Parameter(Position = 2, ParameterSetName = ParameterUriTemplateUriParameterSetName, |
| 50 | + Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "Location of the Template to be used to create the stack")] |
| 51 | + [Parameter(Position = 2, ParameterSetName = ParameterlessTemplateUriParameterSetName, |
| 52 | + Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "Location of the Template to be used to create the stack")] |
| 53 | + public string TemplateUri { get; set; } |
| 54 | + |
| 55 | + [Parameter(Position = 2, ParameterSetName = ParameterFileTemplateSpecParameterSetName, |
| 56 | + Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "ResourceId of the TemplateSpec to be used to create the stack")] |
| 57 | + [Parameter(Position = 2, ParameterSetName = ParameterUriTemplateSpecParameterSetName, |
| 58 | + Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "ResourceId of the TemplateSpec to be used to create the stack")] |
| 59 | + [Parameter(Position = 2, ParameterSetName = ParameterlessTemplateSpecParameterSetName, |
| 60 | + Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "ResourceId of the TemplateSpec to be used to create the stack")] |
| 61 | + public string TemplateSpec { get; set; } |
| 62 | + |
| 63 | + [Parameter(Position = 3, ParameterSetName = ParameterFileTemplateFileParameterSetName, |
| 64 | + Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "Parameter file to use for the template")] |
| 65 | + [Parameter(Position = 3, ParameterSetName = ParameterFileTemplateUriParameterSetName, |
| 66 | + Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "Parameter file to use for the template")] |
| 67 | + [Parameter(Position = 3, ParameterSetName = ParameterFileTemplateSpecParameterSetName, |
| 68 | + Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "Parameter file to use for the template")] |
| 69 | + public string ParameterFile { get; set; } |
| 70 | + |
| 71 | + [Parameter(Position = 3, ParameterSetName = ParameterUriTemplateFileParameterSetName, |
| 72 | + Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "Location of the Parameter file to use for the template")] |
| 73 | + [Parameter(Position = 3, ParameterSetName = ParameterUriTemplateUriParameterSetName, |
| 74 | + Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "Location of the Parameter file to use for the template")] |
| 75 | + [Parameter(Position = 3, ParameterSetName = ParameterUriTemplateSpecParameterSetName, |
| 76 | + Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "Location of the Parameter file to use for the template")] |
| 77 | + public string ParameterUri { get; set; } |
| 78 | + |
| 79 | + [Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, |
| 80 | + HelpMessage = "Description for the stack")] |
| 81 | + public string Description { get; set; } |
| 82 | + |
| 83 | + #endregion |
| 84 | + |
| 85 | + #region Cmdlet Overrides |
| 86 | + |
| 87 | + public override void ExecuteCmdlet() |
| 88 | + { |
| 89 | + try |
| 90 | + { |
| 91 | + switch (ParameterSetName) |
| 92 | + { |
| 93 | + default: |
| 94 | + throw new PSNotSupportedException(); |
| 95 | + } |
| 96 | + } |
| 97 | + catch |
| 98 | + { |
| 99 | + |
| 100 | + } |
| 101 | + } |
| 102 | + |
| 103 | + #endregion |
| 104 | + |
| 105 | + } |
| 106 | +} |
0 commit comments