APISonar


keywhiz.cli.configs.UpdateActionConfig.json

> keywhiz > cli > configs > UpdateActionConfig > json
keywhiz APIs cli APIs configs APIs UpdateActionConfig APIs json APIs

Example 1
UpdateActionConfig updateActionConfig;

  public void updateThrowsIfMetadataHasBadKeys() throws Exception {
    updateActionConfig.name = secret.getDisplayName();
    updateActionConfig.json = "{\"ThisIsABadKey\":\"doh\"}";

    updateAction.stream = new ByteArrayInputStream(base64Decoder.decode(secret.getSecret()));
    when(keywhizClient.getSanitizedSecretByName(secret.getName()))
        .thenThrow(new NotFoundException()); // Call checks for existence.

    updateAction.run();
  }
Example 2
private final UpdateActionConfig config;

  private void partialUpdateSecret(String secretName, byte[] content,
      AddOrUpdateActionConfig config) {
    try {
      keywhizClient.updateSecret(secretName, config.description != null,
          config.getDescription(), content.length > 0, content, config.json != null,
          config.getMetadata(mapper), config.expiry != null, config.getExpiry());
      logger.info("partialUpdate secret '{}'.", secretName);
    } catch (IOException e) {
      throw Throwables.propagate(e);
    }
  }