|
22 | 22 | namespace Microsoft.Azure.Commands.TrustedSigning |
23 | 23 | { |
24 | 24 | [Alias("Invoke-" + ResourceManager.Common.AzureRMConstants.AzurePrefix + "CodeSigningCIPolicySigning")] |
25 | | - [Cmdlet(VerbsLifecycle.Invoke, ResourceManager.Common.AzureRMConstants.AzurePrefix + "TrustedSigningCIPolicySigning", DefaultParameterSetName = ByAccountProfileNameParameterSet)] |
| 25 | + [Cmdlet(VerbsLifecycle.Invoke, ResourceManager.Common.AzureRMConstants.AzurePrefix + "TrustedSigningCIPolicySigning", DefaultParameterSetName = ByAccountProfileNameParameterSet, SupportsShouldProcess = true)] |
26 | 26 | [OutputType(typeof(string))] |
27 | 27 | public class InvokeCIPolicySigning : CodeSigningCmdletBase |
28 | 28 | { |
@@ -118,21 +118,23 @@ public class InvokeCIPolicySigning : CodeSigningCmdletBase |
118 | 118 |
|
119 | 119 | public override void ExecuteCmdlet() |
120 | 120 | { |
121 | | - ValidateFileType(ResolvePath(Path)); |
| 121 | + if (ShouldProcess(Destination, string.Format("Signing '{0}'", Path))) |
| 122 | + { |
| 123 | + ValidateFileType(ResolvePath(Path)); |
122 | 124 |
|
| 125 | + WriteMessage("CI Policy signing in progress...."); |
123 | 126 |
|
124 | | - WriteMessage("CI Policy signing in progress...."); |
| 127 | + if (!string.IsNullOrEmpty(AccountName)) |
| 128 | + { |
| 129 | + CodeSigningServiceClient.SubmitCIPolicySigning(AccountName, ProfileName, EndpointUrl, ResolvePath(Path), ResolvePath(Destination), TimeStamperUrl); |
| 130 | + } |
| 131 | + else if (!string.IsNullOrEmpty(MetadataFilePath)) |
| 132 | + { |
| 133 | + CodeSigningServiceClient.SubmitCIPolicySigning(MetadataFilePath, ResolvePath(Path), ResolvePath(Destination), TimeStamperUrl); |
| 134 | + } |
125 | 135 |
|
126 | | - if (!string.IsNullOrEmpty(AccountName)) |
127 | | - { |
128 | | - CodeSigningServiceClient.SubmitCIPolicySigning(AccountName, ProfileName, EndpointUrl, ResolvePath(Path), ResolvePath(Destination), TimeStamperUrl); |
129 | | - } |
130 | | - else if (!string.IsNullOrEmpty(MetadataFilePath)) |
131 | | - { |
132 | | - CodeSigningServiceClient.SubmitCIPolicySigning(MetadataFilePath, ResolvePath(Path), ResolvePath(Destination), TimeStamperUrl); |
| 136 | + WriteMessage("CI Policy is successfully signed. " + ResolvePath(Destination)); |
133 | 137 | } |
134 | | - |
135 | | - WriteMessage("CI Policy is successfully signed. " + ResolvePath(Destination)); |
136 | 138 | } |
137 | 139 | private void WriteMessage(string message) |
138 | 140 | { |
|
0 commit comments