From 588499521dd7ef1e3ecc45b000184a74c98d3bb9 Mon Sep 17 00:00:00 2001 From: Dragos Avadanei Date: Fri, 28 Apr 2017 16:15:52 -0700 Subject: [PATCH] addressing CR feedback: using nameof, discarding redundant parameter set clauses --- .../Resource.Designer.cs | 2 - .../Commands.KeyVault.csproj | 4 - .../Commands/BackupAzureKeyVaultKey.cs | 12 -- .../Commands/BackupAzureKeyVaultSecret.cs | 12 -- .../Commands/RestoreAzureKeyVaultSecret.cs | 4 +- .../Models/KeyVaultCmdletBase.cs | 4 +- .../Models/KeyVaultDataServiceClient.cs | 164 +++++++++--------- .../Properties/Resources.Designer.cs | 2 - 8 files changed, 85 insertions(+), 119 deletions(-) diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault.Test/Resource.Designer.cs b/src/ResourceManager/KeyVault/Commands.KeyVault.Test/Resource.Designer.cs index e6ee07174dcb..ce99094ff6a5 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault.Test/Resource.Designer.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault.Test/Resource.Designer.cs @@ -10,8 +10,6 @@ namespace Microsoft.Azure.Commands.KeyVault.Test { using System; - - /// /// A strongly-typed resource class, for looking up localized strings, etc. /// diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands.KeyVault.csproj b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands.KeyVault.csproj index 4acd90f22366..83d3be93e6ab 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands.KeyVault.csproj +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands.KeyVault.csproj @@ -263,10 +263,6 @@ {3819d8a7-c62c-4c47-8ddd-0332d9ce1252} Commands.ResourceManager.Common - - {142d7b0b-388a-4ceb-a228-7f6d423c5c2e} - Commands.Profile - {e1f5201d-6067-430e-b303-4e367652991b} Commands.Resources diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/BackupAzureKeyVaultKey.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/BackupAzureKeyVaultKey.cs index 293872589865..0d776900eaf3 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/BackupAzureKeyVaultKey.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/BackupAzureKeyVaultKey.cs @@ -85,13 +85,7 @@ public class BackupAzureKeyVaultKey : KeyVaultCmdletBase [Parameter( Mandatory = false, Position = 2, ValueFromPipelineByPropertyName = true, - ParameterSetName = ByKeyNameParameterSet, HelpMessage = "Output file. The output file to store the backed up key blob in. If not present, a default filename is chosen.")] - [Parameter( Mandatory = false, - Position = 2, - ValueFromPipelineByPropertyName = true, - ParameterSetName = ByKeyObjectParameterSet, - HelpMessage = "Output file. The output file to store the backed up key blob in. If not present, a default filename is chosen." )] [ValidateNotNullOrEmpty] public string OutputFile { get; set; } @@ -101,12 +95,6 @@ public class BackupAzureKeyVaultKey : KeyVaultCmdletBase [Parameter( Mandatory = false, Position = 3, ValueFromPipelineByPropertyName = true, - ParameterSetName = ByKeyNameParameterSet, - HelpMessage = "Overwrite the given file if it exists" )] - [Parameter( Mandatory = false, - Position = 3, - ValueFromPipelineByPropertyName = true, - ParameterSetName = ByKeyObjectParameterSet, HelpMessage = "Overwrite the given file if it exists" )] public SwitchParameter Force { get; set; } diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/BackupAzureKeyVaultSecret.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/BackupAzureKeyVaultSecret.cs index 79ee36fda151..8c510f19fb59 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/BackupAzureKeyVaultSecret.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/BackupAzureKeyVaultSecret.cs @@ -86,12 +86,6 @@ public class BackupAzureKeyVaultSecret : KeyVaultCmdletBase [Parameter( Mandatory = false, Position = 2, ValueFromPipelineByPropertyName = true, - ParameterSetName = BySecretNameParameterSet, - HelpMessage = "Output file. The output file to store the backed up secret blob in. If not present, a default filename is chosen." )] - [Parameter( Mandatory = false, - Position = 2, - ValueFromPipelineByPropertyName = true, - ParameterSetName = BySecretObjectParameterSet, HelpMessage = "Output file. The output file to store the backed up secret blob in. If not present, a default filename is chosen." )] [ValidateNotNullOrEmpty] public string OutputFile { get; set; } @@ -102,12 +96,6 @@ public class BackupAzureKeyVaultSecret : KeyVaultCmdletBase [Parameter( Mandatory = false, Position = 3, ValueFromPipelineByPropertyName = true, - ParameterSetName = BySecretNameParameterSet, - HelpMessage = "Overwrite the given file if it exists" )] - [Parameter( Mandatory = false, - Position = 3, - ValueFromPipelineByPropertyName = true, - ParameterSetName = BySecretObjectParameterSet, HelpMessage = "Overwrite the given file if it exists" )] public SwitchParameter Force { get; set; } diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RestoreAzureKeyVaultSecret.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RestoreAzureKeyVaultSecret.cs index 9a549190f0c4..b98def2cbe18 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RestoreAzureKeyVaultSecret.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RestoreAzureKeyVaultSecret.cs @@ -12,11 +12,11 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.Azure.Commands.KeyVault.Models; using System.IO; using System.Management.Automation; -using KeyVaultProperties = Microsoft.Azure.Commands.KeyVault.Properties; using Microsoft.Azure.Commands.Common.Authentication; +using Microsoft.Azure.Commands.KeyVault.Models; +using KeyVaultProperties = Microsoft.Azure.Commands.KeyVault.Properties; namespace Microsoft.Azure.Commands.KeyVault { diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/KeyVaultCmdletBase.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/KeyVaultCmdletBase.cs index cefaaa93f1b0..5c117a763c97 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/KeyVaultCmdletBase.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/KeyVaultCmdletBase.cs @@ -13,11 +13,9 @@ // ---------------------------------------------------------------------------------- using System; -using System.IO; +using System.Collections.Generic; using Microsoft.Azure.Commands.Common.Authentication; using Microsoft.Azure.Commands.ResourceManager.Common; -using System.Collections.Generic; -using System.Net.Http; namespace Microsoft.Azure.Commands.KeyVault.Models { diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/KeyVaultDataServiceClient.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/KeyVaultDataServiceClient.cs index 9e6a94f57efe..156be9f89da7 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/KeyVaultDataServiceClient.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/KeyVaultDataServiceClient.cs @@ -34,9 +34,9 @@ internal class KeyVaultDataServiceClient : IKeyVaultDataServiceClient public KeyVaultDataServiceClient(IAuthenticationFactory authFactory, AzureContext context) { if (authFactory == null) - throw new ArgumentNullException("authFactory"); + throw new ArgumentNullException(nameof(authFactory)); if (context == null) - throw new ArgumentNullException("context"); + throw new ArgumentNullException(nameof(context)); if (context.Environment == null) throw new ArgumentException(KeyVaultProperties.Resources.InvalidAzureEnvironment); @@ -58,11 +58,11 @@ public KeyVaultDataServiceClient() public KeyBundle CreateKey(string vaultName, string keyName, KeyAttributes keyAttributes) { if (string.IsNullOrEmpty(vaultName)) - throw new ArgumentNullException("vaultName"); + throw new ArgumentNullException(nameof(vaultName)); if (string.IsNullOrEmpty(keyName)) - throw new ArgumentNullException("keyName"); + throw new ArgumentNullException(nameof(keyName)); if (keyAttributes == null) - throw new ArgumentNullException("keyAttributes"); + throw new ArgumentNullException(nameof(keyAttributes)); string vaultAddress = this.vaultUriHelper.CreateVaultAddress(vaultName); var attributes = (Azure.KeyVault.Models.KeyAttributes)keyAttributes; @@ -89,11 +89,11 @@ public KeyBundle CreateKey(string vaultName, string keyName, KeyAttributes keyAt public CertificateBundle MergeCertificate(string vaultName, string certName, X509Certificate2Collection certs, IDictionary tags) { if (string.IsNullOrEmpty(vaultName)) - throw new ArgumentNullException("vaultName"); + throw new ArgumentNullException(nameof(vaultName)); if (string.IsNullOrEmpty(certName)) - throw new ArgumentNullException("certName"); + throw new ArgumentNullException(nameof(certName)); if (null == certs) - throw new ArgumentNullException("certs"); + throw new ArgumentNullException(nameof(certs)); CertificateBundle certBundle; @@ -115,11 +115,11 @@ public CertificateBundle MergeCertificate(string vaultName, string certName, X50 public CertificateBundle ImportCertificate(string vaultName, string certName, string base64CertColl, SecureString certPassword, IDictionary tags) { if (string.IsNullOrEmpty(vaultName)) - throw new ArgumentNullException("vaultName"); + throw new ArgumentNullException(nameof(vaultName)); if (string.IsNullOrEmpty(certName)) - throw new ArgumentNullException("certName"); + throw new ArgumentNullException(nameof(certName)); if (string.IsNullOrEmpty(base64CertColl)) - throw new ArgumentNullException("base64CertColl"); + throw new ArgumentNullException(nameof(base64CertColl)); CertificateBundle certBundle; @@ -149,11 +149,11 @@ public CertificateBundle ImportCertificate(string vaultName, string certName, st public CertificateBundle ImportCertificate(string vaultName, string certName, X509Certificate2Collection certificateCollection, IDictionary tags) { if (string.IsNullOrEmpty(vaultName)) - throw new ArgumentNullException("vaultName"); + throw new ArgumentNullException(nameof(vaultName)); if (string.IsNullOrEmpty(certName)) - throw new ArgumentNullException("certName"); + throw new ArgumentNullException(nameof(certName)); if (null == certificateCollection) - throw new ArgumentNullException("certificateCollection"); + throw new ArgumentNullException(nameof(certificateCollection)); CertificateBundle certBundle; var vaultAddress = this.vaultUriHelper.CreateVaultAddress(vaultName); @@ -179,13 +179,13 @@ public CertificateBundle ImportCertificate(string vaultName, string certName, X5 public KeyBundle ImportKey(string vaultName, string keyName, KeyAttributes keyAttributes, JsonWebKey webKey, bool? importToHsm) { if (string.IsNullOrEmpty(vaultName)) - throw new ArgumentNullException("vaultName"); + throw new ArgumentNullException(nameof(vaultName)); if (string.IsNullOrEmpty(keyName)) - throw new ArgumentNullException("keyName"); + throw new ArgumentNullException(nameof(keyName)); if (keyAttributes == null) - throw new ArgumentNullException("keyAttributes"); + throw new ArgumentNullException(nameof(keyAttributes)); if (webKey == null) - throw new ArgumentNullException("webKey"); + throw new ArgumentNullException(nameof(webKey)); if (webKey.Kty == JsonWebKeyType.RsaHsm && (importToHsm.HasValue && !importToHsm.Value)) throw new ArgumentException(KeyVaultProperties.Resources.ImportByokAsSoftkeyError); @@ -214,11 +214,11 @@ public KeyBundle ImportKey(string vaultName, string keyName, KeyAttributes keyAt public KeyBundle UpdateKey(string vaultName, string keyName, string keyVersion, KeyAttributes keyAttributes) { if (string.IsNullOrEmpty(vaultName)) - throw new ArgumentNullException("vaultName"); + throw new ArgumentNullException(nameof(vaultName)); if (string.IsNullOrEmpty(keyName)) - throw new ArgumentNullException("keyName"); + throw new ArgumentNullException(nameof(keyName)); if (keyAttributes == null) - throw new ArgumentNullException("keyAttributes"); + throw new ArgumentNullException(nameof(keyAttributes)); var attributes = (Azure.KeyVault.Models.KeyAttributes)keyAttributes; var keyIdentifier = new KeyIdentifier(this.vaultUriHelper.CreateVaultAddress(vaultName), keyName, keyVersion); @@ -240,7 +240,7 @@ public KeyBundle UpdateKey(string vaultName, string keyName, string keyVersion, public Contacts GetCertificateContacts(string vaultName) { if (string.IsNullOrEmpty(vaultName)) - throw new ArgumentNullException("vaultName"); + throw new ArgumentNullException(nameof(vaultName)); string vaultAddress = this.vaultUriHelper.CreateVaultAddress(vaultName); @@ -268,9 +268,9 @@ public Contacts GetCertificateContacts(string vaultName) public CertificateBundle GetCertificate(string vaultName, string certName, string certificateVersion) { if (string.IsNullOrEmpty(vaultName)) - throw new ArgumentNullException("vaultName"); + throw new ArgumentNullException(nameof(vaultName)); if (string.IsNullOrEmpty(certName)) - throw new ArgumentNullException("certName"); + throw new ArgumentNullException(nameof(certName)); string vaultAddress = this.vaultUriHelper.CreateVaultAddress(vaultName); @@ -298,9 +298,9 @@ public CertificateBundle GetCertificate(string vaultName, string certName, strin public KeyBundle GetKey(string vaultName, string keyName, string keyVersion) { if (string.IsNullOrEmpty(vaultName)) - throw new ArgumentNullException("vaultName"); + throw new ArgumentNullException(nameof(vaultName)); if (string.IsNullOrEmpty(keyName)) - throw new ArgumentNullException("keyName"); + throw new ArgumentNullException(nameof(keyName)); string vaultAddress = this.vaultUriHelper.CreateVaultAddress(vaultName); @@ -327,7 +327,7 @@ public KeyBundle GetKey(string vaultName, string keyName, string keyVersion) public IEnumerable GetCertificates(KeyVaultObjectFilterOptions options) { if (options == null) - throw new ArgumentNullException("options"); + throw new ArgumentNullException(nameof(options)); if (string.IsNullOrEmpty(options.VaultName)) throw new ArgumentException(KeyVaultProperties.Resources.InvalidVaultName); @@ -356,7 +356,7 @@ public IEnumerable GetCertificates(KeyVaultObjectFilter public IEnumerable GetCertificateVersions(KeyVaultObjectFilterOptions options) { if (options == null) - throw new ArgumentNullException("options"); + throw new ArgumentNullException(nameof(options)); if (string.IsNullOrEmpty(options.VaultName)) throw new ArgumentException(KeyVaultProperties.Resources.InvalidVaultName); @@ -387,7 +387,7 @@ public IEnumerable GetCertificateVersions(KeyVaultObjec public IEnumerable GetKeys(KeyVaultObjectFilterOptions options) { if (options == null) - throw new ArgumentNullException("options"); + throw new ArgumentNullException(nameof(options)); if (string.IsNullOrEmpty(options.VaultName)) throw new ArgumentException(KeyVaultProperties.Resources.InvalidVaultName); @@ -416,7 +416,7 @@ public IEnumerable GetKeys(KeyVaultObjectFilterOptions options) public IEnumerable GetKeyVersions(KeyVaultObjectFilterOptions options) { if (options == null) - throw new ArgumentNullException("options"); + throw new ArgumentNullException(nameof(options)); if (string.IsNullOrEmpty(options.VaultName)) throw new ArgumentException(KeyVaultProperties.Resources.InvalidVaultName); @@ -447,9 +447,9 @@ public IEnumerable GetKeyVersions(KeyVaultObjectFilterOptions o public DeletedKeyBundle DeleteKey(string vaultName, string keyName) { if (string.IsNullOrEmpty(vaultName)) - throw new ArgumentNullException("vaultName"); + throw new ArgumentNullException(nameof(vaultName)); if (string.IsNullOrEmpty(keyName)) - throw new ArgumentNullException("keyName"); + throw new ArgumentNullException(nameof(keyName)); string vaultAddress = this.vaultUriHelper.CreateVaultAddress(vaultName); @@ -469,9 +469,9 @@ public DeletedKeyBundle DeleteKey(string vaultName, string keyName) public Contacts SetCertificateContacts(string vaultName, Contacts contacts) { if (string.IsNullOrEmpty(vaultName)) - throw new ArgumentNullException("vaultName"); + throw new ArgumentNullException(nameof(vaultName)); if (null == contacts) - throw new ArgumentNullException("contacts"); + throw new ArgumentNullException(nameof(contacts)); string vaultAddress = this.vaultUriHelper.CreateVaultAddress(vaultName); @@ -492,13 +492,13 @@ public Contacts SetCertificateContacts(string vaultName, Contacts contacts) public Secret SetSecret(string vaultName, string secretName, SecureString secretValue, SecretAttributes secretAttributes) { if (string.IsNullOrEmpty(vaultName)) - throw new ArgumentNullException("vaultName"); + throw new ArgumentNullException(nameof(vaultName)); if (string.IsNullOrEmpty(secretName)) - throw new ArgumentNullException("secretName"); + throw new ArgumentNullException(nameof(secretName)); if (secretValue == null) - throw new ArgumentNullException("secretValue"); + throw new ArgumentNullException(nameof(secretValue)); if (secretAttributes == null) - throw new ArgumentNullException("secretAttributes"); + throw new ArgumentNullException(nameof(secretAttributes)); string value = secretValue.ConvertToString(); string vaultAddress = this.vaultUriHelper.CreateVaultAddress(vaultName); @@ -521,11 +521,11 @@ public Secret SetSecret(string vaultName, string secretName, SecureString secret public Secret UpdateSecret(string vaultName, string secretName, string secretVersion, SecretAttributes secretAttributes) { if (string.IsNullOrEmpty(vaultName)) - throw new ArgumentNullException("vaultName"); + throw new ArgumentNullException(nameof(vaultName)); if (string.IsNullOrEmpty(secretName)) - throw new ArgumentNullException("secretName"); + throw new ArgumentNullException(nameof(secretName)); if (secretAttributes == null) - throw new ArgumentNullException("secretAttributes"); + throw new ArgumentNullException(nameof(secretAttributes)); var secretIdentifier = new SecretIdentifier(this.vaultUriHelper.CreateVaultAddress(vaultName), secretName, secretVersion); @@ -548,9 +548,9 @@ public Secret UpdateSecret(string vaultName, string secretName, string secretVer public Secret GetSecret(string vaultName, string secretName, string secretVersion) { if (string.IsNullOrEmpty(vaultName)) - throw new ArgumentNullException("vaultName"); + throw new ArgumentNullException(nameof(vaultName)); if (string.IsNullOrEmpty(secretName)) - throw new ArgumentNullException("secretName"); + throw new ArgumentNullException(nameof(secretName)); var secretIdentifier = new SecretIdentifier(this.vaultUriHelper.CreateVaultAddress(vaultName), secretName, secretVersion); SecretBundle secret; @@ -576,7 +576,7 @@ public Secret GetSecret(string vaultName, string secretName, string secretVersio public IEnumerable GetSecrets(KeyVaultObjectFilterOptions options) { if (options == null) - throw new ArgumentNullException("options"); + throw new ArgumentNullException(nameof(options)); if (string.IsNullOrEmpty(options.VaultName)) throw new ArgumentException(KeyVaultProperties.Resources.InvalidVaultName); @@ -604,7 +604,7 @@ public IEnumerable GetSecrets(KeyVaultObjectFilterOptions op public IEnumerable GetSecretVersions(KeyVaultObjectFilterOptions options) { if (options == null) - throw new ArgumentNullException("options"); + throw new ArgumentNullException(nameof(options)); if (string.IsNullOrEmpty(options.VaultName)) throw new ArgumentException(KeyVaultProperties.Resources.InvalidVaultName); if (string.IsNullOrEmpty(options.Name)) @@ -633,9 +633,9 @@ public IEnumerable GetSecretVersions(KeyVaultObjectFilterOpt public CertificateOperation EnrollCertificate(string vaultName, string certificateName, CertificatePolicy certificatePolicy, IDictionary tags) { if (string.IsNullOrEmpty(vaultName)) - throw new ArgumentNullException("vaultName"); + throw new ArgumentNullException(nameof(vaultName)); if (string.IsNullOrEmpty(certificateName)) - throw new ArgumentNullException("certificateName"); + throw new ArgumentNullException(nameof(certificateName)); string vaultAddress = this.vaultUriHelper.CreateVaultAddress(vaultName); @@ -656,9 +656,9 @@ public CertificateOperation EnrollCertificate(string vaultName, string certifica public CertificateBundle UpdateCertificate(string vaultName, string certificateName, string certificateVersion, CertificateAttributes certificateAttributes, IDictionary tags) { if (string.IsNullOrEmpty(vaultName)) - throw new ArgumentNullException("vaultName"); + throw new ArgumentNullException(nameof(vaultName)); if (string.IsNullOrEmpty(certificateName)) - throw new ArgumentNullException("certificateName"); + throw new ArgumentNullException(nameof(certificateName)); var certificateIdentifier = new CertificateIdentifier(this.vaultUriHelper.CreateVaultAddress(vaultName), certificateName, certificateVersion); @@ -679,9 +679,9 @@ public CertificateBundle UpdateCertificate(string vaultName, string certificateN public CertificateBundle DeleteCertificate(string vaultName, string certName) { if (string.IsNullOrEmpty(vaultName)) - throw new ArgumentNullException("vaultName"); + throw new ArgumentNullException(nameof(vaultName)); if (string.IsNullOrEmpty(certName)) - throw new ArgumentNullException("certName"); + throw new ArgumentNullException(nameof(certName)); string vaultAddress = this.vaultUriHelper.CreateVaultAddress(vaultName); @@ -702,9 +702,9 @@ public CertificateBundle DeleteCertificate(string vaultName, string certName) public CertificateOperation GetCertificateOperation(string vaultName, string certificateName) { if (string.IsNullOrEmpty(vaultName)) - throw new ArgumentNullException("vaultName"); + throw new ArgumentNullException(nameof(vaultName)); if (string.IsNullOrEmpty(certificateName)) - throw new ArgumentNullException("certificateName"); + throw new ArgumentNullException(nameof(certificateName)); string vaultAddress = this.vaultUriHelper.CreateVaultAddress(vaultName); @@ -732,9 +732,9 @@ public CertificateOperation GetCertificateOperation(string vaultName, string cer public CertificateOperation CancelCertificateOperation(string vaultName, string certificateName) { if (string.IsNullOrEmpty(vaultName)) - throw new ArgumentNullException("vaultName"); + throw new ArgumentNullException(nameof(vaultName)); if (string.IsNullOrEmpty(certificateName)) - throw new ArgumentNullException("certificateName"); + throw new ArgumentNullException(nameof(certificateName)); string vaultAddress = this.vaultUriHelper.CreateVaultAddress(vaultName); @@ -755,9 +755,9 @@ public CertificateOperation CancelCertificateOperation(string vaultName, string public CertificateOperation DeleteCertificateOperation(string vaultName, string certificateName) { if (string.IsNullOrEmpty(vaultName)) - throw new ArgumentNullException("vaultName"); + throw new ArgumentNullException(nameof(vaultName)); if (string.IsNullOrEmpty(certificateName)) - throw new ArgumentNullException("certificateName"); + throw new ArgumentNullException(nameof(certificateName)); string vaultAddress = this.vaultUriHelper.CreateVaultAddress(vaultName); @@ -778,9 +778,9 @@ public CertificateOperation DeleteCertificateOperation(string vaultName, string public DeletedSecret DeleteSecret(string vaultName, string secretName) { if (string.IsNullOrEmpty(vaultName)) - throw new ArgumentNullException("vaultName"); + throw new ArgumentNullException(nameof(vaultName)); if (string.IsNullOrEmpty(secretName)) - throw new ArgumentNullException("secretName"); + throw new ArgumentNullException(nameof(secretName)); string vaultAddress = this.vaultUriHelper.CreateVaultAddress(vaultName); @@ -800,11 +800,11 @@ public DeletedSecret DeleteSecret(string vaultName, string secretName) public string BackupKey(string vaultName, string keyName, string outputBlobPath) { if (string.IsNullOrEmpty(vaultName)) - throw new ArgumentNullException("vaultName"); + throw new ArgumentNullException(nameof(vaultName)); if (string.IsNullOrEmpty(keyName)) - throw new ArgumentNullException("keyName"); + throw new ArgumentNullException(nameof(keyName)); if (string.IsNullOrEmpty(outputBlobPath)) - throw new ArgumentNullException("outputBlobPath"); + throw new ArgumentNullException(nameof(outputBlobPath)); string vaultAddress = this.vaultUriHelper.CreateVaultAddress(vaultName); @@ -826,9 +826,9 @@ public string BackupKey(string vaultName, string keyName, string outputBlobPath) public KeyBundle RestoreKey(string vaultName, string inputBlobPath) { if (string.IsNullOrEmpty(vaultName)) - throw new ArgumentNullException("vaultName"); + throw new ArgumentNullException(nameof(vaultName)); if (string.IsNullOrEmpty(inputBlobPath)) - throw new ArgumentNullException("inputBlobPath"); + throw new ArgumentNullException(nameof(inputBlobPath)); var backupBlob = File.ReadAllBytes(inputBlobPath); @@ -850,11 +850,11 @@ public KeyBundle RestoreKey(string vaultName, string inputBlobPath) public string BackupSecret( string vaultName, string secretName, string outputBlobPath ) { if ( string.IsNullOrEmpty( vaultName ) ) - throw new ArgumentNullException( "vaultName" ); + throw new ArgumentNullException(nameof(vaultName)); if ( string.IsNullOrEmpty( secretName ) ) - throw new ArgumentNullException( "secretName" ); + throw new ArgumentNullException(nameof(secretName)); if ( string.IsNullOrEmpty( outputBlobPath ) ) - throw new ArgumentNullException( "outputBlobPath" ); + throw new ArgumentNullException(nameof(outputBlobPath)); string vaultAddress = this.vaultUriHelper.CreateVaultAddress(vaultName); @@ -876,9 +876,9 @@ public string BackupSecret( string vaultName, string secretName, string outputBl public Secret RestoreSecret( string vaultName, string inputBlobPath ) { if ( string.IsNullOrEmpty( vaultName ) ) - throw new ArgumentNullException( "vaultName" ); + throw new ArgumentNullException(nameof(vaultName)); if ( string.IsNullOrEmpty( inputBlobPath ) ) - throw new ArgumentNullException( "inputBlobPath" ); + throw new ArgumentNullException(nameof(inputBlobPath)); var backupBlob = File.ReadAllBytes(inputBlobPath); @@ -900,9 +900,9 @@ public Secret RestoreSecret( string vaultName, string inputBlobPath ) public CertificatePolicy GetCertificatePolicy(string vaultName, string certificateName) { if (string.IsNullOrEmpty(vaultName)) - throw new ArgumentNullException("vaultName"); + throw new ArgumentNullException(nameof(vaultName)); if (string.IsNullOrEmpty(certificateName)) - throw new ArgumentNullException("certificateName"); + throw new ArgumentNullException(nameof(certificateName)); string vaultAddress = this.vaultUriHelper.CreateVaultAddress(vaultName); @@ -929,11 +929,11 @@ public CertificatePolicy GetCertificatePolicy(string vaultName, string certifica public CertificatePolicy UpdateCertificatePolicy(string vaultName, string certificateName, CertificatePolicy certificatePolicy) { if (string.IsNullOrEmpty(vaultName)) - throw new ArgumentNullException("vaultName"); + throw new ArgumentNullException(nameof(vaultName)); if (string.IsNullOrEmpty(certificateName)) - throw new ArgumentNullException("certificateName"); + throw new ArgumentNullException(nameof(certificateName)); if (certificatePolicy == null) - throw new ArgumentNullException("certificatePolicy"); + throw new ArgumentNullException(nameof(certificatePolicy)); string vaultAddress = this.vaultUriHelper.CreateVaultAddress(vaultName); CertificatePolicy resultantCertificatePolicy; @@ -953,9 +953,9 @@ public CertificatePolicy UpdateCertificatePolicy(string vaultName, string certif public IssuerBundle GetCertificateIssuer(string vaultName, string issuerName) { if (string.IsNullOrEmpty(vaultName)) - throw new ArgumentNullException("vaultName"); + throw new ArgumentNullException(nameof(vaultName)); if (string.IsNullOrEmpty(issuerName)) - throw new ArgumentNullException("issuerName"); + throw new ArgumentNullException(nameof(issuerName)); string vaultAddress = this.vaultUriHelper.CreateVaultAddress(vaultName); @@ -982,7 +982,7 @@ public IssuerBundle GetCertificateIssuer(string vaultName, string issuerName) public IEnumerable GetCertificateIssuers(KeyVaultObjectFilterOptions options) { if (options == null) - throw new ArgumentNullException("options"); + throw new ArgumentNullException(nameof(options)); if (string.IsNullOrEmpty(options.VaultName)) throw new ArgumentException(KeyVaultProperties.Resources.InvalidVaultName); @@ -1017,11 +1017,11 @@ public IssuerBundle SetCertificateIssuer( KeyVaultCertificateOrganizationDetails organizationDetails) { if (string.IsNullOrEmpty(vaultName)) - throw new ArgumentNullException("vaultName"); + throw new ArgumentNullException(nameof(vaultName)); if (string.IsNullOrEmpty(issuerName)) - throw new ArgumentNullException("issuerName"); + throw new ArgumentNullException(nameof(issuerName)); if (string.IsNullOrEmpty(issuerProvider)) - throw new ArgumentNullException("issuerProvider"); + throw new ArgumentNullException(nameof(issuerProvider)); string vaultAddress = this.vaultUriHelper.CreateVaultAddress(vaultName); var issuer = new IssuerBundle @@ -1061,9 +1061,9 @@ public IssuerBundle SetCertificateIssuer( public IssuerBundle DeleteCertificateIssuer(string vaultName, string issuerName) { if (string.IsNullOrEmpty(vaultName)) - throw new ArgumentNullException("vaultName"); + throw new ArgumentNullException(nameof(vaultName)); if (string.IsNullOrEmpty(issuerName)) - throw new ArgumentNullException("issuerName"); + throw new ArgumentNullException(nameof(issuerName)); string vaultAddress = this.vaultUriHelper.CreateVaultAddress(vaultName); diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Properties/Resources.Designer.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Properties/Resources.Designer.cs index ff63cf4038df..478d7887ceae 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Properties/Resources.Designer.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Properties/Resources.Designer.cs @@ -10,8 +10,6 @@ namespace Microsoft.Azure.Commands.KeyVault.Properties { using System; - - /// /// A strongly-typed resource class, for looking up localized strings, etc. ///