Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(sdk): support discrete magnitude checking #218

Merged
merged 4 commits into from
Nov 21, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -178,18 +178,18 @@ spec:
- rejected
valueMapping:
CREATING: acknowledged,
ACTIVATING: inProgress,
ACCEPTED: inProgress,
MANUAL: inProgress,
DELETING: inProgress,
DISABLING: inProgress,
DENIED: rejected,
ERROR: failed,
ACTIVE: completed,
DISABLED: disabled,
CANCELLED: disabled,
PENDING: pending,
PENDING_ACCEPTANCE: pending,
ACTIVATING: inProgress
ACCEPTED: inProgress
MANUAL: inProgress
DELETING: inProgress
DISABLING: inProgress
DENIED: rejected
ERROR: failed
ACTIVE: completed
DISABLED: disabled
CANCELLED: disabled
PENDING: pending
PENDING_ACCEPTANCE: pending
DELETED: completed
source: "@{{responseBody.status}}"
sourceLocation: BODY
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ spec:
- name: mapper.order.uni.add.bandwidth
title: "Bandwidth of the UNI"
source: "@{{productOrderItem[0].product.productConfiguration.bandwidth}}"
sourceType: customized_enum
sourceValues:
- 1000
- 10000
target: "@{{speed}}"
sourceLocation: BODY
targetLocation: BODY
Expand Down Expand Up @@ -143,21 +147,21 @@ spec:
- partial
- rejected
valueMapping:
progressing: inProgress,
created: acknowledged,
CREATING: acknowledged,
ACTIVATING: inProgress,
ACCEPTED: inProgress,
MANUAL: inProgress,
DELETING: inProgress,
DISABLING: inProgress,
DENIED: rejected,
ERROR: failed,
ACTIVE: completed,
DISABLED: disabled,
CANCELLED: disabled,
PENDING: pending,
PENDING_ACCEPTANCE: pending,
progressing: inProgress
created: acknowledged
CREATING: acknowledged
ACTIVATING: inProgress
ACCEPTED: inProgress
MANUAL: inProgress
DELETING: inProgress
DISABLING: inProgress
DENIED: rejected
ERROR: failed
ACTIVE: completed
DISABLED: disabled
CANCELLED: disabled
PENDING: pending
PENDING_ACCEPTANCE: pending
DELETED: completed
source: "@{{responseBody.status}}"
sourceLocation: BODY
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.consoleconnect.kraken.operator.core.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

@Getter
@AllArgsConstructor
public enum MappingTypeEnum {
ENUM("enum"),
CUSTOMIZED_ENUM("customized_enum");
private final String name;
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import com.consoleconnect.kraken.operator.core.dto.UnifiedAssetDto;
import com.consoleconnect.kraken.operator.core.enums.ActionTypeEnum;
import com.consoleconnect.kraken.operator.core.enums.ExpectTypeEnum;
import com.consoleconnect.kraken.operator.core.enums.MappingTypeEnum;
import com.consoleconnect.kraken.operator.core.enums.ParamLocationEnum;
import com.consoleconnect.kraken.operator.core.exception.KrakenException;
import com.consoleconnect.kraken.operator.core.model.AppProperty;
Expand Down Expand Up @@ -41,7 +42,6 @@ public class MappingMatrixCheckerActionRunner extends AbstractActionRunner {
public static final String MESSAGE_ALERT = "api use case is not supported %s";
public static final String CHECK_NAME_ENABLED = "enabled";
public static final String PARAM_NAME = "param";
public static final String ENUM = "enum";
public static final String NOT_FOUND = "notFound";
public static final String COLON = ":";
private final UnifiedAssetService unifiedAssetService;
Expand Down Expand Up @@ -217,7 +217,8 @@ public void checkRequestConstraints(String targetKey, Map<String, Object> inputs
|| ParamLocationEnum.HYBRID.name().equals(mapper.getTargetLocation())) {
continue;
}
if (Objects.equals(mapper.getSourceType(), ENUM)) {
if (MappingTypeEnum.ENUM.getName().equals(mapper.getSourceType())
|| MappingTypeEnum.CUSTOMIZED_ENUM.getName().equals(mapper.getSourceType())) {
checkEnumValue(mapper.getSource(), mapper.getTarget(), inputs, mapper.getSourceValues());
} else if (mapper.getTarget() != null && !mapper.getTarget().contains("@{{")) {
checkConstantValue(mapper.getSource(), mapper.getTarget(), inputs);
Expand Down
Loading