/// <summary>
 /// Lists the plugins in the catalog.
 /// </summary>
 public static async Task <ReadResponse <KeysData> > ListPluginsAsync(
     this VaultClient client,
     SystemBackendOptions options = null)
 {
     return(await client.ListAsync <ReadResponse <KeysData> >("sys/plugins/catalog",
                                                              on404 : resp => null,
                                                              options : options));
 }
 public static async Task <ReadResponse <KeysData> > ListCubbyholeSecretsAsync(
     this VaultClient client,
     string path         = null,
     CallOptions options = null)
 {
     return(await client.ListAsync <ReadResponse <KeysData> >(
                $"{MountName}/{path}",
                on404 : resp => null,
                //on404: () => new ReadResponse<KeysData> { Data = new KeysData { Keys = new string[0] } },
                options : options));
 }
        /// <summary>
        /// Returns a list of key names at the specified <i>folder</i> location.
        /// </summary>
        /// <remarks>
        /// Folders are suffixed with /.
        /// The input must be a folder; list on a file will not return a value.
        /// Note that no policy-based filtering is performed on keys; do not encode sensitive information in key names.
        /// The values themselves are not accessible via this command.
        /// </remarks>
        /// <param name="path">Specifies the path of the secrets to list.</param>
        public static async Task <ReadResponse <KeysData> > ListGenericSecretsAsync(
            this VaultClient client,
            string path = null,
            GenericSecretOptions options = null)
        {
            var mountName = options?.MountName ?? DefaultMountName;

            return(await client.ListAsync <ReadResponse <KeysData> >(
                       $"{mountName}/{path}",
                       on404 : resp => null,
                       //on404: () => new ReadResponse<KeysData> { Data = new KeysData { Keys = new string[0] } },
                       options : options));
        }
        /// <summary>
        /// Returns a list of lease IDs.
        /// </summary>
        /// <param name="prefix">Optional prefix to filter the list of leases.</param>
        /// <remarks>
        /// <b><i>This operation requires 'sudo' capability.</i></b>
        /// </remarks>
        public static async Task <ReadResponse <KeysData> > ListLeasesAsync(
            this VaultClient client,
            string prefix = null,
            SystemBackendOptions options = null)
        {
            var path = "sys/leases/lookup/";

            if (!string.IsNullOrEmpty(prefix))
            {
                path += $"{prefix.TrimStart('/')}";
            }

            return(await client.ListAsync <ReadResponse <KeysData> >(path,
                                                                     on404 : resp => null,
                                                                     options : options));
        }