应用与数据集成平台 ROMA CONNECT-创建插件:请求示例

时间:2023-11-29 17:31:40

请求示例

  • 创建一个跨域资源共享插件,可见范围为全局可见

    {
      "plugin_name" : "跨域插件",
      "plugin_type" : "cors",
      "plugin_scope" : "global",
      "plugin_content" : "{\\\"allow_origin\\\":\\\"*\\\",\\\"allow_methods\\\":\\\"GET,POST,PUT,DELETE,HEAD,PATCH\\\",\\\"allow_headers\\\":\\\"Content-Type,Accept,Accept-Ranges,Cache-Control\\\",\\\"expose_headers\\\":\\\"X-Request-Id,X-Apig-Latency\\\",\\\"max_age\\\":600,\\\"allow_credentials\\\":false}",
      "remark" : "CORS跨域资源访问"
    }
  • 创建一个HTTP响应头插件,可见范围为全局可见

    {
      "plugin_name" : "HTTP响应头插件",
      "plugin_type" : "set_resp_headers",
      "plugin_scope" : "global",
      "plugin_content" : "{\\\"response_headers\\\":[{\\\"name\\\":\\\"x-demo\\\",\\\"value\\\":\\\"sss\\\",\\\"action\\\":\\\"append\\\"}]}",
      "remark" : "HTTP响应头管理"
    }
  • 创建一个流控插件,可见范围为全局可见

    {
      "plugin_name" : "流控插件",
      "plugin_type" : "rate_limit",
      "plugin_scope" : "global",
      "plugin_content" : "{\\\"scope\\\":\\\"basic\\\",\\\"default_time_unit\\\":\\\"minute\\\",\\\"default_interval\\\":1,\\\"api_limit\\\":50,\\\"app_limit\\\":0,\\\"user_limit\\\":0,\\\"ip_limit\\\":0,\\\"algorithm\\\":\\\"counter\\\",\\\"specials\\\":[],\\\"parameters\\\":[],\\\"rules\\\":[]}",
      "remark" : "流量控制"
    }
  • 创建一个Kafka日志推送插件,可见范围为集成应用可见

    {
      "plugin_name" : "KAFKA日志插件",
      "plugin_type" : "kafka_log",
      "plugin_scope" : "app",
      "plugin_content" : "{\\\"broker_list\\\":[\\\"0.0.0.0:11\\\"],\\\"topic\\\":\\\"topic\\\",\\\"key\\\":\\\"\\\",\\\"max_retry_count\\\":0,\\\"retry_backoff\\\":1,\\\"sasl_config\\\":{\\\"security_protocol\\\":\\\"PLAINTEXT\\\",\\\"sasl_mechanisms\\\":\\\"PLAIN\\\",\\\"sasl_username\\\":\\\"\\\",\\\"sasl_password\\\":\\\"\\\",\\\"ssl_ca_content\\\":\\\"\\\"},\\\"meta_config\\\":{\\\"system\\\":{\\\"start_time\\\":true,\\\"request_id\\\":true,\\\"client_ip\\\":true,\\\"api_id\\\":false,\\\"user_name\\\":false,\\\"app_id\\\":false,\\\"access_model1\\\":false,\\\"request_time\\\":true,\\\"http_status\\\":true,\\\"server_protocol\\\":false,\\\"scheme\\\":true,\\\"request_method\\\":true,\\\"host\\\":false,\\\"api_uri_mode\\\":false,\\\"uri\\\":false,\\\"request_size\\\":false,\\\"response_size\\\":false,\\\"upstream_uri\\\":false,\\\"upstream_addr\\\":true,\\\"upstream_status\\\":true,\\\"upstream_connect_time\\\":false,\\\"upstream_header_time\\\":false,\\\"upstream_response_time\\\":true,\\\"all_upstream_response_time\\\":false,\\\"region_id\\\":false,\\\"auth_type\\\":false,\\\"http_x_forwarded_for\\\":true,\\\"http_user_agent\\\":true,\\\"error_type\\\":true,\\\"access_model2\\\":false,\\\"inner_time\\\":false,\\\"proxy_protocol_vni\\\":false,\\\"proxy_protocol_vpce_id\\\":false,\\\"proxy_protocol_addr\\\":false,\\\"body_bytes_sent\\\":false,\\\"api_name\\\":false,\\\"app_name\\\":false,\\\"provider_app_id\\\":false,\\\"provider_app_name\\\":false,\\\"custom_data_log01\\\":false,\\\"custom_data_log02\\\":false,\\\"custom_data_log03\\\":false,\\\"custom_data_log04\\\":false,\\\"custom_data_log05\\\":false,\\\"custom_data_log06\\\":false,\\\"custom_data_log07\\\":false,\\\"custom_data_log08\\\":false,\\\"custom_data_log09\\\":false,\\\"custom_data_log10\\\":false,\\\"response_source\\\":false},\\\"call_data\\\":{\\\"log_request_header\\\":false,\\\"request_header_filter\\\":\\\"\\\",\\\"log_request_query_string\\\":false,\\\"request_query_string_filter\\\":\\\"\\\",\\\"log_request_body\\\":false,\\\"log_response_header\\\":false,\\\"response_header_filter\\\":\\\"\\\",\\\"log_response_body\\\":false,\\\"custom_authorizer\\\":{\\\"frontend\\\":[],\\\"backend\\\":[]}}}}",
      "remark" : "KAFKA日志推送",
      "roma_app_id" : "df003efc-1ce7-41ef-a45a-b89dc431cb2d"
    }
  • 创建一个断路器插件,可见范围为集成应用可见

    {
      "plugin_name" : "断路器插件",
      "plugin_type" : "breaker",
      "plugin_scope" : "app",
      "plugin_content" : "{\\\"breaker_condition\\\":{\\\"breaker_type\\\":\\\"timeout\\\",\\\"breaker_mode\\\":\\\"counter\\\",\\\"unhealthy_condition\\\":\\\"\\\",\\\"unhealthy_threshold\\\":30,\\\"min_call_threshold\\\":20,\\\"unhealthy_percentage\\\":51,\\\"time_window\\\":15,\\\"open_breaker_time\\\":15},\\\"downgrade_default\\\":null,\\\"downgrade_parameters\\\":null,\\\"downgrade_rules\\\":null,\\\"scope\\\":\\\"basic\\\"}",
      "remark" : "断路器",
      "roma_app_id" : "df003efc-1ce7-41ef-a45a-b89dc431cb2d"
    }
  • 创建一个第三方认证插件,可见范围为全局可见

    {
      "plugin_name" : "第三方认证插件",
      "remark" : "这是一个包含规则表达式白名单的第三方认证插件",
      "plugin_type" : "third_auth",
      "plugin_scope" : "global",
      "plugin_content" : "{\\\"auth_request\\\":{\\\"method\\\":\\\"POST\\\",\\\"protocol\\\":\\\"HTTP\\\",\\\"url_domain\\\":\\\"100.85.217.114:1234\\\",\\\"timeout\\\":10,\\\"path\\\":\\\"/check\\\",\\\"vpc_channel_enabled\\\":false,\\\"vpc_channel_info\\\":{\\\"vpc_proxy_host\\\":\\\"abc.com\\\",\\\"vpc_id\\\":\\\"3c113f40a54a40369ceb1eb1409a32ee\\\"}},\\\"identities\\\":{\\\"headers\\\":[{\\\"name\\\":\\\"token\\\"}],\\\"query\\\":[{\\\"name\\\":\\\"user\\\"}]},\\\"carry_body\\\":{\\\"enabled\\\":true,\\\"max_body_size\\\":10000},\\\"carry_path_enabled\\\":false,\\\"return_resp_body_enabled\\\":true,\\\"carry_resp_headers\\\":[\\\"x-message-result\\\"],\\\"simple_auth_mode_enabled\\\":false,\\\"match_auth\\\":{\\\"key\\\":\\\"x-message-result\\\",\\\"value\\\":\\\"success\\\"},\\\"rule_enabled\\\":true,\\\"rule_type\\\":\\\"allow\\\",\\\"parameters\\\":[{\\\"value\\\":\\\"reqPath\\\",\\\"type\\\":\\\"path\\\",\\\"name\\\":\\\"reqPath\\\"},{\\\"value\\\":\\\"method\\\",\\\"type\\\":\\\"method\\\",\\\"name\\\":\\\"method\\\"},{\\\"value\\\":\\\"Host\\\",\\\"type\\\":\\\"header\\\",\\\"name\\\":\\\"Host\\\"}],\\\"rules\\\":[{\\\"match_regex\\\": \\\"[\\\\\\\"OR\\\\\\\", [\\\\\\\"reqPath\\\\\\\", \\\\\\\"~~\\\\\\\", \\\\\\\"/xxl-job-admin/*\\\\\\\"], [\\\\\\\"reqPath\\\\\\\", \\\\\\\"==\\\\\\\", \\\\\\\"/app/leave/infor/v1/addLeaveLnfor\\\\\\\"], [\\\\\\\"reqPath\\\\\\\", \\\\\\\"==\\\\\\\", \\\\\\\"/api/v1/charge/home/modifyChargeSync\\\\\\\"], [\\\\\\\"reqPath\\\\\\\", \\\\\\\"==\\\\\\\", \\\\\\\"/app/mweb/campaign/api/v1/getActivityConfig\\\\\\\"], [\\\\\\\"reqPath\\\\\\\", \\\\\\\"==\\\\\\\", \\\\\\\"/mp/vehicle/owner/home\\\\\\\"], [\\\\\\\"reqPath\\\\\\\", \\\\\\\"==\\\\\\\", \\\\\\\"/app/mweb/campaign/api/v1/getTime\\\\\\\"], [\\\\\\\"reqPath\\\\\\\", \\\\\\\"==\\\\\\\", \\\\\\\"/api/c-showroom-service/v1/vehicleDetails/upload\\\\\\\"], [\\\\\\\"reqPath\\\\\\\", \\\\\\\"~~\\\\\\\", \\\\\\\"/operation-charging-bff/carOwnerRights/certificate/*\\\\\\\"], [\\\\\\\"reqPath\\\\\\\", \\\\\\\"~~\\\\\\\", \\\\\\\"/api/2c/v1/sales-bff/*\\\\\\\"], [\\\\\\\"reqPath\\\\\\\", \\\\\\\"==\\\\\\\", \\\\\\\"/api/2c/v1/vehicleDetails/upload\\\\\\\"], [\\\\\\\"reqPath\\\\\\\", \\\\\\\"~~\\\\\\\", \\\\\\\"/operation-admin/*\\\\\\\"], [\\\\\\\"reqPath\\\\\\\", \\\\\\\"==\\\\\\\", \\\\\\\"/app/settings/api/v1/receiveClk\\\\\\\"], [\\\\\\\"reqPath\\\\\\\", \\\\\\\"==\\\\\\\", \\\\\\\"/api/vehicle/relative/yTSendVehicleControl.json\\\\\\\"], [\\\\\\\"reqPath\\\\\\\", \\\\\\\"==\\\\\\\", \\\\\\\"/appoint/getAppointmentByTestDrive\\\\\\\"], [\\\\\\\"reqPath\\\\\\\", \\\\\\\"==\\\\\\\", \\\\\\\"/api/evd/callBackEvdPay\\\\\\\"], [\\\\\\\"reqPath\\\\\\\", \\\\\\\"==\\\\\\\", \\\\\\\"/api/evd/callBackEvdOrder\\\\\\\"], [\\\\\\\"reqPath\\\\\\\", \\\\\\\"==\\\\\\\", \\\\\\\"/api/evd/getUserToken\\\\\\\"], [\\\\\\\"reqPath\\\\\\\", \\\\\\\"==\\\\\\\", \\\\\\\"/api/evd/callBackEvdCoupon\\\\\\\"], [\\\\\\\"reqPath\\\\\\\", \\\\\\\"==\\\\\\\", \\\\\\\"/api/task/busTriggerTaskEvent.json\\\\\\\"], [\\\\\\\"reqPath\\\\\\\", \\\\\\\"==\\\\\\\", \\\\\\\"/datacenter-log-center/api/trackApi/commonAdd.json\\\\\\\"]]\\\", \\\"rule_name\\\": \\\"allow2\\\"}],\\\"custom_forbid_limit\\\":100,\\\"auth_downgrade_enabled\\\":false}"
    }
support.huaweicloud.com/api-roma/CreatePlugin.html