shenyu_client_rust/model.rs
1// Licensed to the Apache Software Foundation (ASF) under one
2// or more contributor license agreements. See the NOTICE file
3// distributed with this work for additional information
4// regarding copyright ownership. The ASF licenses this file
5// to you under the Apache License, Version 2.0 (the
6// "License"); you may not use this file except in compliance
7// with the License. You may obtain a copy of the License at
8//
9// http://www.apache.org/licenses/LICENSE-2.0
10//
11// Unless required by applicable law or agreed to in writing,
12// software distributed under the License is distributed on an
13// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14// KIND, either express or implied. See the License for the
15// specific language governing permissions and limitations
16// under the License.
17
18use std::fmt::{Display, Formatter};
19
20/**
21{
22 "appName":"springCloud-test",
23 "contextPath":"/springcloud",
24 "path":"/springcloud/order/path/{id}/name",
25 "pathDesc":"",
26 "rpcType":"springCloud",
27 "serviceName":"org.apache.shenyu.examples.springcloud.controller.OrderController",
28 "methodName":"testRestFul",
29 "rule_name":"/springcloud/order/path/{id}/name",
30 "parameterTypes":"java.lang.String",
31 "enabled":true,
32 "pluginNames":[],
33 "registerMetaData":false,
34 "timeMillis":1724062308618,
35 "addPrefixed":false
36}
37*/
38#[allow(clippy::doc_markdown)]
39#[derive(Debug, Clone)]
40pub struct UriInfo {
41 /// The shenyu rule path.
42 pub path: String,
43 /// The shenyu rule name.
44 pub rule_name: String,
45 /// The handler mod name.
46 pub service_name: Option<String>,
47 /// The handler method name.
48 pub method_name: String,
49}
50
51/// The enum Event type.
52#[derive(Debug, Copy, Clone)]
53pub enum EventType {
54 ///Register event type.
55 REGISTER,
56
57 ///Updated event type.
58 UPDATED,
59
60 ///Deleted event type.
61 DELETED,
62
63 /// Ignored event type.
64 IGNORED,
65
66 /// Offline event type.
67 OFFLINE,
68}
69
70impl Display for EventType {
71 fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
72 match self {
73 EventType::REGISTER => write!(f, "REGISTER"),
74 EventType::UPDATED => write!(f, "UPDATED"),
75 EventType::DELETED => write!(f, "DELETED"),
76 EventType::IGNORED => write!(f, "IGNORED"),
77 EventType::OFFLINE => write!(f, "OFFLINE"),
78 }
79 }
80}