BetterCloud / vault-java-driver

Zero-dependency Java client for HashiCorp's Vault
https://bettercloud.github.io/vault-java-driver/
336 stars 223 forks source link

List secrets method throwing error. #131

Open anarwal27 opened 6 years ago

anarwal27 commented 6 years ago

I have following List method written in my code

    private Vault vault;
    private String path;
    private VaultConfig config;
    private String folder;

    /**
     * Constructs an instance of the Vault driver with sensible defaults, configured to use the supplied token
     * for authentication.
     *
     * @param token {@link String}
     * @param address {@link String}
     * @throws VaultException
     */
    public VaultApp(final String address, final String token, String path, String folder)  {
        this.path = path;
        this.folder = folder;
        try {
            config = new VaultConfig()
                    .address(address)
                    .token(token)
                    .sslConfig(new SslConfig().verify(false))
                    .build();
            vault = new Vault(config);
        } catch (Exception e) {
            LOGGER.error(e.getMessage());
        }
    }

    public List<String> listSecrets() throws VaultException {
       return vault.logical().list(path);
    }

while using list method I am getting following error back: com.bettercloud.vault.VaultException: Vault responded with HTTP status code: 405 Response body: {"errors":["1 error occurred:\n\n* unsupported operation"]}

I tried to dig and use API directly from hashicorp and looks like LIST is case-sensitive, which might need to be updated here: https://github.com/BetterCloud/vault-java-driver/blob/master/src/main/java/com/bettercloud/vault/api/Logical.java#L198