Skip to content

Commit

Permalink
Developer experience
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielHougaard committed Dec 21, 2023
1 parent 7e3acca commit ea959db
Showing 1 changed file with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,51 +36,53 @@ public GetSecretResponseSecret getSecret(GetSecretOptions options) {
InfisicalClient.throwingFunctionWrapper(Converter::ResponseForGetSecretResponseFromJsonString));

errorCheck(response.getSuccess(), response.getErrorMessage());

return response.getData().getSecret();
}

public ListSecretsResponse listSecrets(ListSecretsOptions options) {
public SecretElement[] listSecrets(ListSecretsOptions options) {
Command command = new Command();
command.setListSecrets(options);

ResponseForListSecretsResponse response = commandRunner.runCommand(command,
InfisicalClient.throwingFunctionWrapper(Converter::ResponseForListSecretsResponseFromJsonString));

errorCheck(response.getSuccess(), response.getErrorMessage());
return response.getData();

return response.getData().getSecrets();
}

public CreateSecretResponse createSecret(CreateSecretOptions options) {
public CreateSecretResponseSecret createSecret(CreateSecretOptions options) {
Command command = new Command();
command.setCreateSecret(options);

ResponseForCreateSecretResponse response = commandRunner.runCommand(command,
InfisicalClient.throwingFunctionWrapper(Converter::ResponseForCreateSecretResponseFromJsonString));

errorCheck(response.getSuccess(), response.getErrorMessage());
return response.getData();
return response.getData().getSecret();
}

public UpdateSecretResponse updateSecret(UpdateSecretOptions options) {
public UpdateSecretResponseSecret updateSecret(UpdateSecretOptions options) {
Command command = new Command();
command.setUpdateSecret(options);

ResponseForUpdateSecretResponse response = commandRunner.runCommand(command,
InfisicalClient.throwingFunctionWrapper(Converter::ResponseForUpdateSecretResponseFromJsonString));

errorCheck(response.getSuccess(), response.getErrorMessage());
return response.getData();
return response.getData().getSecret();
}

public DeleteSecretResponse deleteSecret(DeleteSecretOptions options) {
public DeleteSecretResponseSecret deleteSecret(DeleteSecretOptions options) {
Command command = new Command();
command.setDeleteSecret(options);

ResponseForDeleteSecretResponse response = commandRunner.runCommand(command,
InfisicalClient.throwingFunctionWrapper(Converter::ResponseForDeleteSecretResponseFromJsonString));

errorCheck(response.getSuccess(), response.getErrorMessage());
return response.getData();
return response.getData().getSecret();
}

private void errorCheck(boolean success, String errorMessage) {
Expand Down

0 comments on commit ea959db

Please sign in to comment.