/// <summary> /// Initializes a new instance of the KeyVaultSecretReference class /// with required arguments. /// </summary> public KeyVaultSecretReference(string secretUrl, SourceVaultReference sourceVault) : this() { if (secretUrl == null) { throw new ArgumentNullException("secretUrl"); } if (sourceVault == null) { throw new ArgumentNullException("sourceVault"); } this.SecretUrl = secretUrl; this.SourceVault = sourceVault; }
/// <summary> /// Initializes a new instance of the KeyVaultKeyReference class with /// required arguments. /// </summary> public KeyVaultKeyReference(string keyUrl, SourceVaultReference sourceVault) : this() { if (keyUrl == null) { throw new ArgumentNullException("keyUrl"); } if (sourceVault == null) { throw new ArgumentNullException("sourceVault"); } this.KeyUrl = keyUrl; this.SourceVault = sourceVault; }
public override void ExecuteCmdlet() { if (this.VM.OSProfile == null) { this.VM.OSProfile = new OSProfile(); } if (this.VM.OSProfile.Secrets == null) { this.VM.OSProfile.Secrets = new List<VaultSecretGroup>(); } int i = 0; for(; i <= this.VM.OSProfile.Secrets.Count; i++) { if (i == this.VM.OSProfile.Secrets.Count) { var sourceVault = new SourceVaultReference { ReferenceUri = this.SourceVaultId }; var vaultCertificates = new List<VaultCertificate>{ new VaultCertificate() { CertificateStore = this.CertificateStore, CertificateUrl = this.CertificateUrl, } }; this.VM.OSProfile.Secrets.Add( new VaultSecretGroup() { SourceVault = sourceVault, VaultCertificates = vaultCertificates, }); break; } if (this.VM.OSProfile.Secrets[i].SourceVault != null && this.VM.OSProfile.Secrets[i].SourceVault.ReferenceUri.Equals(this.SourceVaultId)) { if (this.VM.OSProfile.Secrets[i].VaultCertificates == null) { this.VM.OSProfile.Secrets[i].VaultCertificates = new List<VaultCertificate>(); } this.VM.OSProfile.Secrets[i].VaultCertificates.Add( new VaultCertificate() { CertificateStore = this.CertificateStore, CertificateUrl = this.CertificateUrl, }); break; } } WriteObject(this.VM); }