in Notation.Plugin.AzureKeyVault/KeyVault/KeyVaultClient.cs [116:151]
private static KeyVaultMetadata ParseId(string id)
{
if (string.IsNullOrEmpty(id))
{
throw new ValidationException("Input passed to \"--id\" must not be empty");
}
var uri = new Uri(id.TrimEnd('/'));
// Validate uri
if (uri.Segments.Length < 3 || uri.Segments.Length > 4)
{
throw new ValidationException("Invalid input passed to \"--id\". Please follow this format to input the ID \"https://<vault-name>.vault.azure.net/certificates/<certificate-name>/[certificate-version]\"");
}
var type = uri.Segments[1].TrimEnd('/');
if (type != "keys" && type != "certificates")
{
throw new ValidationException($"Unsupported key vualt object type {type}.");
}
if (uri.Scheme != "https")
{
throw new ValidationException($"Unsupported scheme {uri.Scheme}. The scheme must be https.");
}
string? version = null;
if (uri.Segments.Length == 4)
{
version = uri.Segments[3].TrimEnd('/');
}
return new KeyVaultMetadata(
KeyVaultUrl: $"{uri.Scheme}://{uri.Host}",
Name: uri.Segments[2].TrimEnd('/'),
Version: version
);
}