fun parse()

in src/main/kotlin/org/opensearch/commons/notifications/action/GetPluginFeaturesResponse.kt [67:94]


        fun parse(parser: XContentParser): GetPluginFeaturesResponse {
            var allowedConfigTypeList: List<String>? = null
            var allowedConfigFeatureList: List<String>? = null
            var pluginFeatures: Map<String, String>? = null

            XContentParserUtils.ensureExpectedToken(
                XContentParser.Token.START_OBJECT,
                parser.currentToken(),
                parser
            )
            while (parser.nextToken() != XContentParser.Token.END_OBJECT) {
                val fieldName = parser.currentName()
                parser.nextToken()
                when (fieldName) {
                    ALLOWED_CONFIG_TYPE_LIST_TAG -> allowedConfigTypeList = parser.stringList()
                    ALLOWED_CONFIG_FEATURE_LIST_TAG -> allowedConfigFeatureList = parser.stringList()
                    PLUGIN_FEATURES_TAG -> pluginFeatures = parser.mapStrings()
                    else -> {
                        parser.skipChildren()
                        log.info("Unexpected field: $fieldName, while parsing DeleteNotificationConfigResponse")
                    }
                }
            }
            allowedConfigTypeList ?: throw IllegalArgumentException("$ALLOWED_CONFIG_TYPE_LIST_TAG field absent")
            allowedConfigFeatureList ?: throw IllegalArgumentException("$ALLOWED_CONFIG_TYPE_LIST_TAG field absent")
            pluginFeatures ?: throw IllegalArgumentException("$PLUGIN_FEATURES_TAG field absent")
            return GetPluginFeaturesResponse(allowedConfigTypeList, allowedConfigFeatureList, pluginFeatures)
        }