use of org.wso2.carbon.identity.api.server.secret.management.v1.model.SecretUpdateRequest in project identity-api-server by wso2.
the class SecretTypeManagementService method updateTypeSecret.
/**
* Update secret details by name.
*
* @param name Secret name.
* @param secretUpdateRequest Secret's updated details.
* @return Updated secret.
*/
public SecretTypeResponse updateTypeSecret(String name, SecretTypeUpdateRequest secretUpdateRequest) {
SecretType requestDTO, responseDTO;
SecretTypeAddRequest secretAdd = buildSecretTypeAddFromSecretTypeUpdateRequest(name, secretUpdateRequest);
try {
requestDTO = buildSecretTypeRequestDTOFromSecretTypeAddRequest(secretAdd);
responseDTO = SecretManagementServiceHolder.getSecretConfigManager().replaceSecretType(requestDTO);
} catch (SecretManagementException e) {
throw handleSecretMgtException(e, SecretManagementConstants.ErrorMessage.ERROR_CODE_ERROR_UPDATING_SECRET, name);
}
return buildSecretTypeResponseFromResponseDTO(responseDTO);
}
use of org.wso2.carbon.identity.api.server.secret.management.v1.model.SecretUpdateRequest in project identity-api-server by wso2.
the class SecretManagementService method buildSecretAddFromSecretUpdateRequest.
/**
* Build secretAdd object from secret update request.
*
* @param name Secret name.
* @param secretUpdateRequest Secret's update request body.
* @return secretAdd object
*/
private SecretAddRequest buildSecretAddFromSecretUpdateRequest(String name, SecretUpdateRequest secretUpdateRequest) {
SecretAddRequest secretAddRequest = new SecretAddRequest();
secretAddRequest.setName(name);
secretAddRequest.setValue(secretUpdateRequest.getValue());
if (!StringUtils.isEmpty(secretUpdateRequest.getDescription())) {
secretAddRequest.setDescription(secretUpdateRequest.getDescription());
}
return secretAddRequest;
}
use of org.wso2.carbon.identity.api.server.secret.management.v1.model.SecretUpdateRequest in project identity-api-server by wso2.
the class SecretManagementService method updateSecret.
/**
* Update secret details by name.
*
* @param secretType Secret type name.
* @param name Secret name.
* @param secretUpdateRequest Secret's updated details.
* @return Updated secret.
*/
public SecretResponse updateSecret(String secretType, String name, SecretUpdateRequest secretUpdateRequest) {
Secret requestDTO, responseDTO;
SecretAddRequest secretAddRequest = buildSecretAddFromSecretUpdateRequest(name, secretUpdateRequest);
try {
requestDTO = buildSecretRequestDTOFromSecretAddRequest(secretAddRequest);
responseDTO = SecretManagementServiceHolder.getSecretConfigManager().replaceSecret(secretType, requestDTO);
} catch (SecretManagementException e) {
throw handleSecretMgtException(e, SecretManagementConstants.ErrorMessage.ERROR_CODE_ERROR_UPDATING_SECRET, name);
}
return buildSecretResponseFromResponseDTO(responseDTO);
}
Aggregations