use of com.walmartlabs.concord.server.org.OrganizationEntry in project concord by walmartlabs.
the class SecretResourceV2 method update.
@POST
@ApiOperation("Updates an existing secret")
@Path("/{orgName}/secret/{secretName}")
@Consumes(MediaType.MULTIPART_FORM_DATA)
@Produces(MediaType.APPLICATION_JSON)
@Validate
public GenericOperationResult update(@ApiParam @PathParam("orgName") @ConcordKey String orgName, @ApiParam @PathParam("secretName") @ConcordKey String secretName, @ApiParam MultipartInput input) {
OrganizationEntry org = orgManager.assertAccess(orgName, true);
try {
SecretUpdateParams newSecretParams = SecretUpdateParams.builder().newOrgId(MultipartUtils.getUuid(input, Constants.Multipart.ORG_ID)).newOrgName(MultipartUtils.getString(input, Constants.Multipart.ORG_NAME)).newProjectId(MultipartUtils.getUuid(input, Constants.Multipart.PROJECT_ID)).newProjectName(MultipartUtils.getString(input, Constants.Multipart.PROJECT_NAME)).removeProjectLink(MultipartUtils.getBoolean(input, "removeProjectLink", false)).newOwnerId(MultipartUtils.getUuid(input, "ownerId")).currentPassword(MultipartUtils.getString(input, Constants.Multipart.STORE_PASSWORD)).newPassword(MultipartUtils.getString(input, "newStorePassword")).newSecret(buildSecret(input)).newName(MultipartUtils.getString(input, Constants.Multipart.NAME)).newVisibility(getVisibility(input)).build();
secretManager.update(org.getId(), secretName, newSecretParams);
} catch (IOException e) {
throw new ConcordApplicationException("Error while processing the request: " + e.getMessage(), e);
}
return new GenericOperationResult(OperationResult.UPDATED);
}
Aggregations