github.com/erda-project/erda-infra@v1.0.9/providers/component-protocol/protobuf/proto-go/cp/pb/protocol.form.pb.go (about) 1 // Code generated by protoc-gen-go-form. DO NOT EDIT. 2 // Source: protocol.proto 3 4 package pb 5 6 import ( 7 json "encoding/json" 8 url "net/url" 9 strconv "strconv" 10 strings "strings" 11 12 urlenc "github.com/erda-project/erda-infra/pkg/urlenc" 13 structpb "google.golang.org/protobuf/types/known/structpb" 14 ) 15 16 // This is a compile-time assertion to ensure that this generated file 17 // is compatible with the "github.com/erda-project/erda-infra/pkg/urlenc" package it is being compiled against. 18 var _ urlenc.URLValuesUnmarshaler = (*ComponentProtocol)(nil) 19 var _ urlenc.URLValuesUnmarshaler = (*Hierarchy)(nil) 20 var _ urlenc.URLValuesUnmarshaler = (*Component)(nil) 21 var _ urlenc.URLValuesUnmarshaler = (*ComponentOptions)(nil) 22 var _ urlenc.URLValuesUnmarshaler = (*Scenario)(nil) 23 var _ urlenc.URLValuesUnmarshaler = (*ComponentEvent)(nil) 24 var _ urlenc.URLValuesUnmarshaler = (*DebugOptions)(nil) 25 var _ urlenc.URLValuesUnmarshaler = (*ProtocolOptions)(nil) 26 var _ urlenc.URLValuesUnmarshaler = (*RenderRequest)(nil) 27 var _ urlenc.URLValuesUnmarshaler = (*RenderResponse)(nil) 28 var _ urlenc.URLValuesUnmarshaler = (*IdentityInfo)(nil) 29 30 // ComponentProtocol implement urlenc.URLValuesUnmarshaler. 31 func (m *ComponentProtocol) UnmarshalURLValues(prefix string, values url.Values) error { 32 for key, vals := range values { 33 if len(vals) > 0 { 34 switch prefix + key { 35 case "version": 36 m.Version = vals[0] 37 case "scenario": 38 m.Scenario = vals[0] 39 case "hierarchy": 40 if m.Hierarchy == nil { 41 m.Hierarchy = &Hierarchy{} 42 } 43 case "hierarchy.root": 44 if m.Hierarchy == nil { 45 m.Hierarchy = &Hierarchy{} 46 } 47 m.Hierarchy.Root = vals[0] 48 case "options": 49 if m.Options == nil { 50 m.Options = &ProtocolOptions{} 51 } 52 case "options.syncIntervalSecond": 53 if m.Options == nil { 54 m.Options = &ProtocolOptions{} 55 } 56 val, err := strconv.ParseFloat(vals[0], 64) 57 if err != nil { 58 return err 59 } 60 m.Options.SyncIntervalSecond = val 61 } 62 } 63 } 64 return nil 65 } 66 67 // Hierarchy implement urlenc.URLValuesUnmarshaler. 68 func (m *Hierarchy) UnmarshalURLValues(prefix string, values url.Values) error { 69 for key, vals := range values { 70 if len(vals) > 0 { 71 switch prefix + key { 72 case "root": 73 m.Root = vals[0] 74 } 75 } 76 } 77 return nil 78 } 79 80 // Component implement urlenc.URLValuesUnmarshaler. 81 func (m *Component) UnmarshalURLValues(prefix string, values url.Values) error { 82 for key, vals := range values { 83 if len(vals) > 0 { 84 switch prefix + key { 85 case "type": 86 m.Type = vals[0] 87 case "name": 88 m.Name = vals[0] 89 case "props": 90 if len(vals) > 1 { 91 var list []interface{} 92 for _, text := range vals { 93 var v interface{} 94 err := json.NewDecoder(strings.NewReader(text)).Decode(&v) 95 if err != nil { 96 list = append(list, v) 97 } else { 98 list = append(list, text) 99 } 100 } 101 val, _ := structpb.NewList(list) 102 m.Props = structpb.NewListValue(val) 103 } else { 104 var v interface{} 105 err := json.NewDecoder(strings.NewReader(vals[0])).Decode(&v) 106 if err != nil { 107 val, _ := structpb.NewValue(v) 108 m.Props = val 109 } else { 110 m.Props = structpb.NewStringValue(vals[0]) 111 } 112 } 113 case "options": 114 if m.Options == nil { 115 m.Options = &ComponentOptions{} 116 } 117 case "options.visible": 118 if m.Options == nil { 119 m.Options = &ComponentOptions{} 120 } 121 val, err := strconv.ParseBool(vals[0]) 122 if err != nil { 123 return err 124 } 125 m.Options.Visible = val 126 case "options.asyncAtInit": 127 if m.Options == nil { 128 m.Options = &ComponentOptions{} 129 } 130 val, err := strconv.ParseBool(vals[0]) 131 if err != nil { 132 return err 133 } 134 m.Options.AsyncAtInit = val 135 case "options.flatMeta": 136 if m.Options == nil { 137 m.Options = &ComponentOptions{} 138 } 139 val, err := strconv.ParseBool(vals[0]) 140 if err != nil { 141 return err 142 } 143 m.Options.FlatMeta = val 144 case "options.removeMetaAfterFlat": 145 if m.Options == nil { 146 m.Options = &ComponentOptions{} 147 } 148 val, err := strconv.ParseBool(vals[0]) 149 if err != nil { 150 return err 151 } 152 m.Options.RemoveMetaAfterFlat = val 153 case "version": 154 m.Version = vals[0] 155 } 156 } 157 } 158 return nil 159 } 160 161 // ComponentOptions implement urlenc.URLValuesUnmarshaler. 162 func (m *ComponentOptions) UnmarshalURLValues(prefix string, values url.Values) error { 163 for key, vals := range values { 164 if len(vals) > 0 { 165 switch prefix + key { 166 case "visible": 167 val, err := strconv.ParseBool(vals[0]) 168 if err != nil { 169 return err 170 } 171 m.Visible = val 172 case "asyncAtInit": 173 val, err := strconv.ParseBool(vals[0]) 174 if err != nil { 175 return err 176 } 177 m.AsyncAtInit = val 178 case "flatMeta": 179 val, err := strconv.ParseBool(vals[0]) 180 if err != nil { 181 return err 182 } 183 m.FlatMeta = val 184 case "removeMetaAfterFlat": 185 val, err := strconv.ParseBool(vals[0]) 186 if err != nil { 187 return err 188 } 189 m.RemoveMetaAfterFlat = val 190 } 191 } 192 } 193 return nil 194 } 195 196 // Scenario implement urlenc.URLValuesUnmarshaler. 197 func (m *Scenario) UnmarshalURLValues(prefix string, values url.Values) error { 198 for key, vals := range values { 199 if len(vals) > 0 { 200 switch prefix + key { 201 case "scenarioKey": 202 m.ScenarioKey = vals[0] 203 case "scenarioType": 204 m.ScenarioType = vals[0] 205 } 206 } 207 } 208 return nil 209 } 210 211 // ComponentEvent implement urlenc.URLValuesUnmarshaler. 212 func (m *ComponentEvent) UnmarshalURLValues(prefix string, values url.Values) error { 213 for key, vals := range values { 214 if len(vals) > 0 { 215 switch prefix + key { 216 case "component": 217 m.Component = vals[0] 218 case "operation": 219 m.Operation = vals[0] 220 } 221 } 222 } 223 return nil 224 } 225 226 // DebugOptions implement urlenc.URLValuesUnmarshaler. 227 func (m *DebugOptions) UnmarshalURLValues(prefix string, values url.Values) error { 228 for key, vals := range values { 229 if len(vals) > 0 { 230 switch prefix + key { 231 case "componentKey": 232 m.ComponentKey = vals[0] 233 } 234 } 235 } 236 return nil 237 } 238 239 // ProtocolOptions implement urlenc.URLValuesUnmarshaler. 240 func (m *ProtocolOptions) UnmarshalURLValues(prefix string, values url.Values) error { 241 for key, vals := range values { 242 if len(vals) > 0 { 243 switch prefix + key { 244 case "syncIntervalSecond": 245 val, err := strconv.ParseFloat(vals[0], 64) 246 if err != nil { 247 return err 248 } 249 m.SyncIntervalSecond = val 250 } 251 } 252 } 253 return nil 254 } 255 256 // RenderRequest implement urlenc.URLValuesUnmarshaler. 257 func (m *RenderRequest) UnmarshalURLValues(prefix string, values url.Values) error { 258 for key, vals := range values { 259 if len(vals) > 0 { 260 switch prefix + key { 261 case "scenario": 262 if m.Scenario == nil { 263 m.Scenario = &Scenario{} 264 } 265 case "scenario.scenarioKey": 266 if m.Scenario == nil { 267 m.Scenario = &Scenario{} 268 } 269 m.Scenario.ScenarioKey = vals[0] 270 case "scenario.scenarioType": 271 if m.Scenario == nil { 272 m.Scenario = &Scenario{} 273 } 274 m.Scenario.ScenarioType = vals[0] 275 case "event": 276 if m.Event == nil { 277 m.Event = &ComponentEvent{} 278 } 279 case "event.component": 280 if m.Event == nil { 281 m.Event = &ComponentEvent{} 282 } 283 m.Event.Component = vals[0] 284 case "event.operation": 285 if m.Event == nil { 286 m.Event = &ComponentEvent{} 287 } 288 m.Event.Operation = vals[0] 289 case "protocol": 290 if m.Protocol == nil { 291 m.Protocol = &ComponentProtocol{} 292 } 293 case "protocol.version": 294 if m.Protocol == nil { 295 m.Protocol = &ComponentProtocol{} 296 } 297 m.Protocol.Version = vals[0] 298 case "protocol.scenario": 299 if m.Protocol == nil { 300 m.Protocol = &ComponentProtocol{} 301 } 302 m.Protocol.Scenario = vals[0] 303 case "protocol.hierarchy": 304 if m.Protocol == nil { 305 m.Protocol = &ComponentProtocol{} 306 } 307 if m.Protocol.Hierarchy == nil { 308 m.Protocol.Hierarchy = &Hierarchy{} 309 } 310 case "protocol.hierarchy.root": 311 if m.Protocol == nil { 312 m.Protocol = &ComponentProtocol{} 313 } 314 if m.Protocol.Hierarchy == nil { 315 m.Protocol.Hierarchy = &Hierarchy{} 316 } 317 m.Protocol.Hierarchy.Root = vals[0] 318 case "protocol.options": 319 if m.Protocol == nil { 320 m.Protocol = &ComponentProtocol{} 321 } 322 if m.Protocol.Options == nil { 323 m.Protocol.Options = &ProtocolOptions{} 324 } 325 case "protocol.options.syncIntervalSecond": 326 if m.Protocol == nil { 327 m.Protocol = &ComponentProtocol{} 328 } 329 if m.Protocol.Options == nil { 330 m.Protocol.Options = &ProtocolOptions{} 331 } 332 val, err := strconv.ParseFloat(vals[0], 64) 333 if err != nil { 334 return err 335 } 336 m.Protocol.Options.SyncIntervalSecond = val 337 case "debugOptions": 338 if m.DebugOptions == nil { 339 m.DebugOptions = &DebugOptions{} 340 } 341 case "debugOptions.componentKey": 342 if m.DebugOptions == nil { 343 m.DebugOptions = &DebugOptions{} 344 } 345 m.DebugOptions.ComponentKey = vals[0] 346 } 347 } 348 } 349 return nil 350 } 351 352 // RenderResponse implement urlenc.URLValuesUnmarshaler. 353 func (m *RenderResponse) UnmarshalURLValues(prefix string, values url.Values) error { 354 for key, vals := range values { 355 if len(vals) > 0 { 356 switch prefix + key { 357 case "scenario": 358 if m.Scenario == nil { 359 m.Scenario = &Scenario{} 360 } 361 case "scenario.scenarioKey": 362 if m.Scenario == nil { 363 m.Scenario = &Scenario{} 364 } 365 m.Scenario.ScenarioKey = vals[0] 366 case "scenario.scenarioType": 367 if m.Scenario == nil { 368 m.Scenario = &Scenario{} 369 } 370 m.Scenario.ScenarioType = vals[0] 371 case "protocol": 372 if m.Protocol == nil { 373 m.Protocol = &ComponentProtocol{} 374 } 375 case "protocol.version": 376 if m.Protocol == nil { 377 m.Protocol = &ComponentProtocol{} 378 } 379 m.Protocol.Version = vals[0] 380 case "protocol.scenario": 381 if m.Protocol == nil { 382 m.Protocol = &ComponentProtocol{} 383 } 384 m.Protocol.Scenario = vals[0] 385 case "protocol.hierarchy": 386 if m.Protocol == nil { 387 m.Protocol = &ComponentProtocol{} 388 } 389 if m.Protocol.Hierarchy == nil { 390 m.Protocol.Hierarchy = &Hierarchy{} 391 } 392 case "protocol.hierarchy.root": 393 if m.Protocol == nil { 394 m.Protocol = &ComponentProtocol{} 395 } 396 if m.Protocol.Hierarchy == nil { 397 m.Protocol.Hierarchy = &Hierarchy{} 398 } 399 m.Protocol.Hierarchy.Root = vals[0] 400 case "protocol.options": 401 if m.Protocol == nil { 402 m.Protocol = &ComponentProtocol{} 403 } 404 if m.Protocol.Options == nil { 405 m.Protocol.Options = &ProtocolOptions{} 406 } 407 case "protocol.options.syncIntervalSecond": 408 if m.Protocol == nil { 409 m.Protocol = &ComponentProtocol{} 410 } 411 if m.Protocol.Options == nil { 412 m.Protocol.Options = &ProtocolOptions{} 413 } 414 val, err := strconv.ParseFloat(vals[0], 64) 415 if err != nil { 416 return err 417 } 418 m.Protocol.Options.SyncIntervalSecond = val 419 } 420 } 421 } 422 return nil 423 } 424 425 // IdentityInfo implement urlenc.URLValuesUnmarshaler. 426 func (m *IdentityInfo) UnmarshalURLValues(prefix string, values url.Values) error { 427 for key, vals := range values { 428 if len(vals) > 0 { 429 switch prefix + key { 430 case "userID": 431 m.UserID = vals[0] 432 case "internalClient": 433 m.InternalClient = vals[0] 434 case "orgID": 435 m.OrgID = vals[0] 436 } 437 } 438 } 439 return nil 440 }