public void SasDefinitionIdentifierTest() { var storageName = "mystorage"; string baseId = string.Format("{0}/storage/{1}/sas/{2}", vault, storageName, name); var id = new SasDefinitionIdentifier(baseId); Assert.Equal(baseId, id.BaseIdentifier); Assert.Equal(baseId, id.Identifier); Assert.Equal(vault, id.Vault); Assert.Equal(name, id.Name); Assert.Equal(storageName, id.StorageAccount); Assert.True(SasDefinitionIdentifier.IsSasDefinitionIdentifier(baseId)); }
internal ManagedStorageSasDefinitionListItem(Azure.KeyVault.Models.SasDefinitionItem storageSasDefinitionItem, VaultUriHelper vaultUriHelper) { if (storageSasDefinitionItem == null) { throw new ArgumentNullException("storageSasDefinitionItem"); } if (vaultUriHelper == null) { throw new ArgumentNullException("vaultUriHelper"); } var identifier = new SasDefinitionIdentifier(storageSasDefinitionItem.Id); Id = identifier.Identifier; VaultName = vaultUriHelper.GetVaultName(identifier.Identifier); Name = identifier.Name; Attributes = storageSasDefinitionItem.Attributes == null ? null : new ManagedStorageSasDefinitionAttributes(storageSasDefinitionItem.Attributes.Enabled, storageSasDefinitionItem.Attributes.Created, storageSasDefinitionItem.Attributes.Updated); Tags = storageSasDefinitionItem.Tags == null ? null : storageSasDefinitionItem.Tags.ConvertToHashtable(); Sid = storageSasDefinitionItem.SecretId; AccountName = identifier.StorageAccount; }
internal PSKeyVaultManagedStorageSasDefinition(Azure.KeyVault.Models.SasDefinitionBundle storageSasDefinitionBundle, VaultUriHelper vaultUriHelper) { if (storageSasDefinitionBundle == null) { throw new ArgumentNullException(nameof(storageSasDefinitionBundle)); } if (vaultUriHelper == null) { throw new ArgumentNullException(nameof(vaultUriHelper)); } var identifier = new SasDefinitionIdentifier(storageSasDefinitionBundle.Id); SetObjectIdentifier(vaultUriHelper, identifier); Attributes = storageSasDefinitionBundle.Attributes == null ? null : new PSKeyVaultManagedStorageSasDefinitionAttributes(storageSasDefinitionBundle.Attributes); Tags = storageSasDefinitionBundle.Tags == null ? null : storageSasDefinitionBundle.Tags.ConvertToHashtable(); Sid = storageSasDefinitionBundle.SecretId; TemplateUri = storageSasDefinitionBundle.TemplateUri; SasType = storageSasDefinitionBundle.SasType; ValidityPeriod = storageSasDefinitionBundle.ValidityPeriod; AccountName = identifier.StorageAccount; }