コード例 #1
0
 /// <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;
 }
コード例 #2
0
 /// <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;
 }
コード例 #3
0
 /// <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;
 }
コード例 #4
0
 /// <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;
 }
コード例 #5
0
        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);
        }