github.com/erda-project/erda-infra@v1.0.9/providers/component-protocol/protobuf/proto/cp/protocol.proto (about) 1 syntax = "proto3"; 2 3 package erda.cp; 4 5 import "google/api/annotations.proto"; 6 import "google/protobuf/struct.proto"; 7 8 option go_package = "github.com/erda-project/erda-infra/providers/component-protocol/protobuf/proto-go/cp/pb"; 9 10 service CPService { 11 rpc Render (RenderRequest) returns (RenderResponse) { 12 option (google.api.http) = { 13 post: "/api/component-protocol/actions/render", 14 }; 15 } 16 } 17 18 // component-protocol definition. 19 message ComponentProtocol { 20 // version is protocol version. 21 string version = 1; 22 23 // scenario used to distinguish concrete scenario. 24 string scenario = 2; 25 26 // globalState stores global states for all components. 27 map<string, google.protobuf.Value> globalState = 3 [json_name = "state"]; 28 29 // hierarchy represents components' hierarchy. 30 Hierarchy hierarchy = 4; 31 32 // components contains all rendered components. 33 map<string, Component> components = 5; 34 35 // rendering represents components rendering definitions. 36 map<string, google.protobuf.ListValue> rendering = 6; 37 38 // options 39 ProtocolOptions options = 7; 40 } 41 42 // Hierarchy represents components' hierarchy. 43 message Hierarchy { 44 // root component, required. 45 string root = 1; 46 47 // structure means concrete structure of components. 48 // value may be list or map. 49 map<string, google.protobuf.Value> structure = 2; 50 51 // parallel defines parallel components. 52 map<string, google.protobuf.Value> parallel = 3; 53 } 54 55 // Component defines a component. 56 message Component { 57 // type of the component. 58 string type = 1; 59 60 // name of the component. 61 string name = 2; 62 63 // props is component's fixed properties, such as: table columns definition. 64 google.protobuf.Value props = 3; 65 66 // state is component's flexible properties, such as: table pageNo/pageSize. 67 map<string, google.protobuf.Value> state = 4; 68 69 // data is component's business data. 70 map<string, google.protobuf.Value> data = 5; 71 72 // operations of the component. 73 map<string, google.protobuf.Value> operations = 6; 74 75 // options of the component. 76 ComponentOptions options = 7; 77 78 // version of the component. 79 string version = 8; 80 } 81 82 message ComponentOptions { 83 bool visible = 1; 84 bool asyncAtInit = 2; 85 bool flatMeta = 3; 86 bool removeMetaAfterFlat = 4; 87 } 88 89 // Scenario represents protocol scenario. 90 message Scenario { 91 // scenarioKey is the key of scenario. 92 // Required. 93 string scenarioKey = 1; 94 95 // scenarioType is the type of scenario. 96 // Optional. 97 string scenarioType = 2; 98 } 99 100 // ComponentEvent . 101 message ComponentEvent { 102 // component name. 103 string component = 1; 104 105 // operation key. 106 string operation = 2; 107 108 // operationData contains operation details. 109 map<string, google.protobuf.Value> operationData = 3; 110 } 111 112 // DebugOptions is debug options. 113 message DebugOptions { 114 // componentKey . 115 string componentKey = 1; 116 } 117 118 // ProtocolOptions . 119 message ProtocolOptions { 120 // sync interval second. 121 double syncIntervalSecond = 1; 122 } 123 124 // RenderRequest is protocol render request. 125 message RenderRequest { 126 // scenario of this render. 127 Scenario scenario = 1; 128 129 // event of this render. 130 // Optional. 131 ComponentEvent event = 2; 132 133 // inParams contains passed in params from request caller. 134 map<string, google.protobuf.Value> inParams = 3; 135 136 // protocol represent protocol detail. 137 // First time render is empty. 138 // Optional. 139 ComponentProtocol protocol = 4; 140 141 // debugOptions contains options for debug. 142 DebugOptions debugOptions = 5; 143 } 144 145 // RenderResponse 146 message RenderResponse { 147 // scenario of this render. 148 Scenario scenario = 1; 149 150 // protocol means rendered protocol detail. 151 ComponentProtocol protocol = 2; 152 } 153 154 // IdentityInfo 155 message IdentityInfo { 156 // UserID is user id. It must be provided in some cases. 157 // Cannot be null if InternalClient is null. 158 // +optional 159 string userID = 1; 160 161 // InternalClient records the internal client, such as: bundle. 162 // Cannot be null if UserID is null. 163 // +optional 164 string internalClient = 2; 165 166 // OrgID is org id. It must be provided in some cases. 167 // +optional 168 string orgID = 3; 169 }