/// <summary> /// Internal constructor used by KeyVaultDataServiceClient /// </summary> /// <param name="managedStorageAccountBundle">managed storage bundle returned from service</param> /// <param name="vaultUriHelper">helper class</param> internal PSKeyVaultManagedStorageAccount(Azure.KeyVault.Models.StorageBundle managedStorageAccountBundle, VaultUriHelper vaultUriHelper) { if (managedStorageAccountBundle == null) { throw new ArgumentNullException(nameof(managedStorageAccountBundle)); } if (vaultUriHelper == null) { throw new ArgumentNullException(nameof(vaultUriHelper)); } if (managedStorageAccountBundle.ResourceId == null || managedStorageAccountBundle.Attributes == null) { throw new ArgumentException(KeyVaultProperties.Resources.InvalidManagedStorageAccountBundle); } SetObjectIdentifier(vaultUriHelper, new Azure.KeyVault.StorageAccountIdentifier(managedStorageAccountBundle.Id)); AccountName = this.Name; AccountResourceId = managedStorageAccountBundle.ResourceId; ActiveKeyName = managedStorageAccountBundle.ActiveKeyName; AutoRegenerateKey = managedStorageAccountBundle.AutoRegenerateKey; RegenerationPeriod = string.IsNullOrWhiteSpace(managedStorageAccountBundle.RegenerationPeriod) ? (TimeSpan?)null : XmlConvert.ToTimeSpan(managedStorageAccountBundle.RegenerationPeriod); Attributes = managedStorageAccountBundle.Attributes == null ? null : new PSKeyVaultManagedStorageAccountAttributes(managedStorageAccountBundle.Attributes); Tags = managedStorageAccountBundle.Tags == null ? null : managedStorageAccountBundle.Tags.ConvertToHashtable(); }
/// <summary> /// Internal constructor used by KeyVaultDataServiceClient /// </summary> /// <param name="managedStorageAccountBundle">managed storage bundle returned from service</param> /// <param name="vaultUriHelper">helper class</param> internal ManagedStorageAccount(Azure.KeyVault.Models.StorageBundle managedStorageAccountBundle, VaultUriHelper vaultUriHelper) { if (managedStorageAccountBundle == null) { throw new ArgumentNullException("managedStorageAccountBundle"); } if (vaultUriHelper == null) { throw new ArgumentNullException("vaultUriHelper"); } var identifier = new StorageAccountIdentifier(managedStorageAccountBundle.Id); Id = identifier.Identifier; VaultName = vaultUriHelper.GetVaultName(identifier.Identifier); AccountName = identifier.Name; AccountResourceId = managedStorageAccountBundle.ResourceId; ActiveKeyName = managedStorageAccountBundle.ActiveKeyName; AutoRegenerateKey = managedStorageAccountBundle.AutoRegenerateKey; RegenerationPeriod = string.IsNullOrWhiteSpace(managedStorageAccountBundle.RegenerationPeriod) ? (TimeSpan?)null : XmlConvert.ToTimeSpan(managedStorageAccountBundle.RegenerationPeriod); Attributes = managedStorageAccountBundle.Attributes == null ? null : new ManagedStorageAccountAttributes(managedStorageAccountBundle.Attributes.Enabled, managedStorageAccountBundle.Attributes.Created, managedStorageAccountBundle.Attributes.Updated); Tags = managedStorageAccountBundle.Tags == null ? null : managedStorageAccountBundle.Tags.ConvertToHashtable(); }