/** * This class will handle cache remove operation. */ @BallerinaFunction( packageName = "org.wso2.carbon.apimgt.ballerina.maps", functionName = "removeMapEntry", args = {@Argument(name = "key", type = TypeEnum.STRING)}, returnType = {@ReturnType(type = TypeEnum.STRING)}, isPublic = true ) @BallerinaAnnotation(annotationName = "Description", attributes = {@Attribute(name = "value", value = "Remove map entry by providing key")}) @BallerinaAnnotation(annotationName = "Param", attributes = {@Attribute(name = "key", value = "")}) @BallerinaAnnotation(annotationName = "Return", attributes = {@Attribute(name = "string", value = "map key")}) public class RemoveMapEntry extends AbstractNativeFunction { @Override public BValue[] execute(Context context) { String key = getStringArgument(context, 0); MapManagerHolder.getInstance().getMapManager().remove(key); return getBValues(new BString(key)); } }
/** * Native function ballerina.utils:base64decode. * This function will be used to get cache entry by providing cacheName and cacheKey * * @since 0.10-SNAPSHOT */ @BallerinaFunction( packageName = "org.wso2.carbon.apimgt.ballerina.maps", functionName = "getMapEntry", args = {@Argument(name = "key", type = TypeEnum.STRING)}, returnType = {@ReturnType(type = TypeEnum.ANY)}, isPublic = true ) @BallerinaAnnotation(annotationName = "Description", attributes = {@Attribute(name = "value", value = "Get map entry by providing key")}) @BallerinaAnnotation(annotationName = "Param", attributes = {@Attribute(name = "key", value = "Map Key")}) @BallerinaAnnotation(annotationName = "Return", attributes = {@Attribute(name = "value", value = "Value")}) public class GetMapEntry extends AbstractNativeFunction { @Override public BValue[] execute(Context context) { String key = getStringArgument(context, 0); BValue value = MapManagerHolder.getInstance().getMapManager().get(key); return getBValues(value); } }
/** * Ballerina function to convert ip into Long value * <br> * org.wso2.carbon.apimgt.ballerina.util:convertIpToLong */ @BallerinaFunction( packageName = "org.wso2.carbon.apimgt.ballerina.util", functionName = "convertIpToLong", args = {@Argument(name = "value", type = TypeEnum.STRING)}, returnType = {@ReturnType(type = TypeEnum.INT)}, isPublic = true ) @BallerinaAnnotation(annotationName = "Description", attributes = {@Attribute(name = "value", value = "Convert ip into long value")}) @BallerinaAnnotation(annotationName = "Param", attributes = {@Attribute(name = "value", value = "String value of ip")}) @BallerinaAnnotation(annotationName = "Return", attributes = {@Attribute(name = "int", value = "long value of ip")}) public class IPToLongConversion extends AbstractNativeFunction { @Override public BValue[] execute(Context context) { String value = getStringArgument(context, 0); long longValue = Util.ipToLong(value); return getBValues(new BInteger(longValue)); } }
@BallerinaAnnotation(annotationName = "Description", attributes = {@Attribute(name = "value", value = "Stop a " + "service skeleton and cleanup created directories of a given ballerina module.")}) @BallerinaAnnotation(annotationName = "Param", attributes = {@Attribute(name = "moduleName", value = "Name of the " + "module")}) public class StopServiceSkeleton extends BlockingNativeCallableUnit {
@BallerinaAnnotation(annotationName = "Description", attributes = {@Attribute(name = "value", value = "Stops all the " + "" + "services defined in the module specified in the 'moduleName' argument")}) @BallerinaAnnotation(annotationName = "Param", attributes = {@Attribute(name = "moduleName", value = "Name of the " + "module")}) public class StopServices extends BlockingNativeCallableUnit {
isPublic = true @BallerinaAnnotation(annotationName = "Description", attributes = {@Attribute(name = "value", value = "Remove cache entry by providing cacheName and cacheKey") }) @BallerinaAnnotation(annotationName = "Param", attributes = {@Attribute(name = "cacheName", value = "Cache Manager name") }) @BallerinaAnnotation(annotationName = "Param", attributes = {@Attribute(name = "cacheKey", value = "String cache key") }) @BallerinaAnnotation(annotationName = "Return", attributes = {@Attribute(name = "string", value = "Cache Manager reference") })
isPublic = true @BallerinaAnnotation(annotationName = "Description", attributes = {@Attribute(name = "value", value = "Sets a message property") }) @BallerinaAnnotation(annotationName = "Param", attributes = {@Attribute(name = "msg", value = "The current message object") }) @BallerinaAnnotation(annotationName = "Param", attributes = {@Attribute(name = "propertyName", value = "The name of the property") }) @BallerinaAnnotation(annotationName = "Param", attributes = {@Attribute(name = "propertyValue", value = "The value of the property") }) public class SetProperty extends AbstractNativeFunction {
isPublic = true @BallerinaAnnotation(annotationName = "Description", attributes = {@Attribute(name = "value", value = "Returns an array of keys contained in the specified JSON")}) @BallerinaAnnotation(annotationName = "Param", attributes = {@Attribute(name = "json", value = "JSON object")}) @BallerinaAnnotation(annotationName = "Return", attributes = {@Attribute(name = "string[]", value = "string[] of keys")})
isPublic = true @BallerinaAnnotation(annotationName = "Description", attributes = {@Attribute(name = "value", value = "Retrieve a message property")}) @BallerinaAnnotation(annotationName = "Param", attributes = {@Attribute(name = "value", value = "The name of the property")}) @BallerinaAnnotation(annotationName = "Return", attributes = {@Attribute(name = "json", value = "")}) public class ParseJson extends AbstractNativeFunction {
isPublic = true @BallerinaAnnotation(annotationName = "Description", attributes = {@Attribute(name = "value", value = "Retrieve a message property")}) @BallerinaAnnotation(annotationName = "Param", attributes = {@Attribute(name = "msg", value = "The current message object")}) @BallerinaAnnotation(annotationName = "Param", attributes = {@Attribute(name = "propertyName", value = "The name of the property")}) @BallerinaAnnotation(annotationName = "Return", attributes = {@Attribute(name = "string", value = "The property value")}) public class GetProperty extends AbstractNativeFunction {
isPublic = true @BallerinaAnnotation(annotationName = "Description", attributes = {@Attribute(name = "value", value = "Get cache entry by providing cacheName and cacheKey")}) @BallerinaAnnotation(annotationName = "Param", attributes = {@Attribute(name = "cacheName", value = "Cache Manager name")}) @BallerinaAnnotation(annotationName = "Param", attributes = {@Attribute(name = "cacheKey", value = "String cache key")}) @BallerinaAnnotation(annotationName = "Return", attributes = {@Attribute(name = "cacheEntry", value = "Cache entry object")})
isPublic = true @BallerinaAnnotation(annotationName = "Description", attributes = {@Attribute(name = "value", value = " deployment service")}) @BallerinaAnnotation(annotationName = "Param", attributes = {@Attribute(name = "fileName", value = "path to the service file")}) @BallerinaAnnotation(annotationName = "Param", attributes = {@Attribute(name = "config", value = "ballerina source")}) @BallerinaAnnotation(annotationName = "Param", attributes = {@Attribute(name = "path", value = "ballerina package")}) @BallerinaAnnotation(annotationName = "Return", attributes = {@Attribute(name = "string", value = "status of the deployment")}) public class DeployFile extends AbstractNativeFunction {
isPublic = true @BallerinaAnnotation(annotationName = "Description", attributes = {@Attribute(name = "value", value = " Create cache as per user requirement")}) @BallerinaAnnotation(annotationName = "Param", attributes = {@Attribute(name = "cacheName", value = "Cache Manager name")}) @BallerinaAnnotation(annotationName = "Param", attributes = {@Attribute(name = "cacheTimeout", value = "Cache Timeout value in minutes")}) @BallerinaAnnotation(annotationName = "Return", attributes = {@Attribute(name = "string", value = "Cache Manager reference")})
isPublic = true @BallerinaAnnotation(annotationName = "Description", attributes = {@Attribute(name = "value", value = "Returns an array of json file names")}) @BallerinaAnnotation(annotationName = "Param", attributes = {@Attribute(name = "folderPath", value = "The path of the folder")}) @BallerinaAnnotation(annotationName = "Return", attributes = {@Attribute(name = "list", value = "json file array")})
.STRING), @Argument(name = "swaggerFilePath", type = TypeKind.STRING)}, returnType = {@ReturnType (type = TypeKind.BOOLEAN)}, isPublic = true) @BallerinaAnnotation(annotationName = "Description", attributes = {@Attribute(name = "value", value = "Start a " + "service skeleton from a given Swagger definition in the given ballerina module.")}) @BallerinaAnnotation(annotationName = "Param", attributes = {@Attribute(name = "moduleName", value = "Name of " + "the module"), @Attribute(name = "swaggerFilePath", value = "Path to the Swagger definition")}) public class StartServiceSkeleton extends BlockingNativeCallableUnit {
isPublic = true @BallerinaAnnotation(annotationName = "Description", attributes = {@Attribute(name = "value", value = "Analyzes json/xml payloads for threats")}) @BallerinaAnnotation(annotationName = "Param", attributes = {@Attribute(name = "payloadType", value = "Type of the payload (xml/json)")}) @BallerinaAnnotation(annotationName = "Param", attributes = {@Attribute(name = "payload", value = "Payload string")}) @BallerinaAnnotation(annotationName = "Param", attributes = {@Attribute(name = "apiContext", value = "API Context")}) @BallerinaAnnotation(annotationName = "Param", attributes = {@Attribute(name = "apiId", value = "API ID")}) @BallerinaAnnotation(annotationName = "Return", attributes = {@Attribute(name = "boolean", value = "true if no threats detected, false otherwise")}) @BallerinaAnnotation(annotationName = "Return", attributes = {@Attribute(name = "string", value = "error information if found")}) public class Analyze extends AbstractNativeFunction {
isPublic = true @BallerinaAnnotation(annotationName = "Description", attributes = {@Attribute(name = "value", value = "Configures the xml analyzers ")}) @BallerinaAnnotation(annotationName = "Param", attributes = {@Attribute(name = "xmlInfo", value = "XMLThreatProtectionInfoDTO struct")}) @BallerinaAnnotation(annotationName = "Param", attributes = {@Attribute(name = "event", value = "Threat Protection Policy Event")}) @BallerinaAnnotation(annotationName = "Return", attributes = {@Attribute(name = "boolean", value = "true if success, false otherwise")}) public class ConfigureXmlAnalyzer extends AbstractNativeFunction {
isPublic = true @BallerinaAnnotation(annotationName = "Description", attributes = {@Attribute(name = "value", value = "Configures the json analyzers")}) @BallerinaAnnotation(annotationName = "Param", attributes = {@Attribute(name = "jsonInfo", value = "JSONThreatProtectionInfoDTO struct")}) @BallerinaAnnotation(annotationName = "Param", attributes = {@Attribute(name = "event", value = "Threat Protection Policy Event")}) @BallerinaAnnotation(annotationName = "Return", attributes = {@Attribute(name = "boolean", value = "true if success, false otherwise")}) public class ConfigureJsonAnalyzer extends AbstractNativeFunction {
(name = "moduleName", type = TypeKind.STRING)}, returnType = {@ReturnType(type = TypeKind.BOOLEAN)}, isPublic = true) @BallerinaAnnotation(annotationName = "Description", attributes = {@Attribute(name = "value", value = "Starts all " + "the" + " services defined in the module specified in the 'moduleName' argument")}) @BallerinaAnnotation(annotationName = "Param", attributes = {@Attribute(name = "moduleName", value = "Name of the " + "module")}) public class StartServices extends BlockingNativeCallableUnit {
isPublic = true @BallerinaAnnotation(annotationName = "Description", attributes = {@Attribute(name = "value", value = " deployment service")}) @BallerinaAnnotation(annotationName = "Param", attributes = {@Attribute(name = "fileName", value = "path to the service file")}) @BallerinaAnnotation(annotationName = "Param", attributes = {@Attribute(name = "serviceName", value = "serviceName")}) @BallerinaAnnotation(annotationName = "Param", attributes = {@Attribute(name = "config", value = "ballerina source")}) @BallerinaAnnotation(annotationName = "Param", attributes = {@Attribute(name = "path", value = "ballerina package")}) @BallerinaAnnotation(annotationName = "Return", attributes = {@Attribute(name = "string", value = "status of the deployment")}) public class DeployService extends AbstractNativeFunction {