External ref for actions and status-update events (#830)

* Add feature to listen to rollout status update
* With this feature, extensions can update back the status of a given rollout using an event(containing distributionSetId and targetId).
* In future, AmqpMessageHandlerService can make use of this feature and de-couple its own implementation from performing status update of an action.
* Implement ActionStatusUpdateHandlerService using actionId
* Extend actions to support externalRef
* Update the action status using externalRef.
* Update securityContext to support running a callable under specific authorities.
* Fixing the review comments
* Increase length of externalRef to 128 chars
* Remove actionStatusUpdateEvent and the handler service
* Use 256 chars for externalRef
* Increment the version for migration script
* Another feature had use v1_12_12 in a recent PR. So incrementing the version.
* Create length limit for externalRef and add it to index
* Externalref will be much longer than 256 chars if controllerId is as long as 256 chars
* Adding tests for verifying externalRef in controllerManagement
* Improve test to consider multiple externalRefs
* Fix issue in migration script for mssql server
* Fix documentation

Signed-off-by: Ravindranath Sandeep (INST-IOT/ESW-Imb) <Sandeep.Ravindranath@bosch-si.com>
This commit is contained in:
Sandeep Ravindranath
2019-07-25 09:45:07 +02:00
committed by Stefan Behl
parent e80399bc79
commit fba6cf9787
11 changed files with 196 additions and 0 deletions

View File

@@ -429,4 +429,26 @@ public interface ControllerManagement {
*/
@PreAuthorize(SpringEvalExpressions.IS_CONTROLLER)
Action cancelAction(long actionId);
/**
* Updates given {@link Action} with its external id.
*
* @param actionId
* to be updated
* @param externalRef
* of the action
*/
@PreAuthorize(SpringEvalExpressions.IS_CONTROLLER)
void updateActionExternalRef(long actionId, @NotEmpty String externalRef);
/**
* Retrieves list of {@link Action}s which matches the provided
* externalRefs.
*
* @param externalRefs
* for which the actions need to be fetched.
* @return list of {@link Action}s matching the externalRefs.
*/
@PreAuthorize(SpringEvalExpressions.IS_CONTROLLER)
List<Action> getActiveActionsByExternalRef(@NotNull List<String> externalRefs);
}

View File

@@ -12,6 +12,8 @@ import java.time.ZonedDateTime;
import java.util.Optional;
import java.util.concurrent.TimeUnit;
import javax.validation.constraints.NotEmpty;
/**
* Update operations to be executed by the target.
*/
@@ -32,6 +34,11 @@ public interface Action extends TenantAwareBaseEntity {
*/
int MAINTENANCE_WINDOW_TIMEZONE_LENGTH = 8;
/**
* Maximum length of external reference.
*/
int EXTERNAL_REF_MAX_LENGTH = 512;
/**
* @return the distributionSet
*/
@@ -98,6 +105,16 @@ public interface Action extends TenantAwareBaseEntity {
*/
String getMaintenanceWindowTimeZone();
/**
* @param externalRef associated with this action
*/
void setExternalRef(@NotEmpty String externalRef);
/**
* @return externalRef of the action
*/
String getExternalRef();
/**
* checks if the {@link #getForcedTime()} is hit by the given
* {@code hitTimeMillis}, by means if the given milliseconds are greater