-
Notifications
You must be signed in to change notification settings - Fork 111
/
config_request.pb.a2svc.go
153 lines (144 loc) · 3.5 KB
/
config_request.pb.a2svc.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
// Code generated by protoc-gen-a2config. DO NOT EDIT.
// source: config/event/config_request.proto
package event
import (
a2conf "github.com/chef/automate/components/automate-grpc/protoc-gen-a2-config/api/a2conf"
wrappers "github.com/golang/protobuf/ptypes/wrappers"
)
// ServiceName returns the name of the service this config belongs to
func (m *ConfigRequest) ServiceName() string {
return "event-service"
}
// BindPort sets the port tagged with the given name
func (m *ConfigRequest) BindPort(name string, value uint16) error {
switch name {
case "service":
v0 := &m.V1
if *v0 == nil {
*v0 = &ConfigRequest_V1{}
}
v1 := &(*v0).Sys
if *v1 == nil {
*v1 = &ConfigRequest_V1_System{}
}
v2 := &(*v1).Service
if *v2 == nil {
*v2 = &ConfigRequest_V1_System_Service{}
}
v3 := &(*v2).Port
*v3 = &wrappers.Int32Value{Value: int32(value)}
case "internal_messaging":
v0 := &m.V1
if *v0 == nil {
*v0 = &ConfigRequest_V1{}
}
v1 := &(*v0).Sys
if *v1 == nil {
*v1 = &ConfigRequest_V1_System{}
}
v2 := &(*v1).InternalMessaging
if *v2 == nil {
*v2 = &ConfigRequest_V1_System_InternalMessaging{}
}
v3 := &(*v2).Port
*v3 = &wrappers.Int32Value{Value: int32(value)}
case "internal_messaging_gw":
v0 := &m.V1
if *v0 == nil {
*v0 = &ConfigRequest_V1{}
}
v1 := &(*v0).Sys
if *v1 == nil {
*v1 = &ConfigRequest_V1_System{}
}
v2 := &(*v1).InternalMessaging
if *v2 == nil {
*v2 = &ConfigRequest_V1_System_InternalMessaging{}
}
v3 := &(*v2).GatewayPort
*v3 = &wrappers.Int32Value{Value: int32(value)}
default:
return a2conf.ErrPortNotFound
}
return nil
}
// ListPorts lists all the ports exposed by the config
func (m *ConfigRequest) ListPorts() []a2conf.PortInfo {
return []a2conf.PortInfo{a2conf.PortInfo{
Default: uint16(int32(10132)),
Name: "service",
Protocol: "grpc",
}, a2conf.PortInfo{
Default: uint16(int32(10140)),
Name: "internal_messaging",
Protocol: "nats",
}, a2conf.PortInfo{
Default: uint16(int32(10147)),
Name: "internal_messaging_gw",
Protocol: "nats-gateway",
}}
}
// GetPort gets the port tagged with the given name. If the value is not set, it returns 0.
func (m *ConfigRequest) GetPort(name string) (uint16, error) {
switch name {
case "service":
v0 := m.V1
if v0 == nil {
return 0, nil
}
v1 := v0.Sys
if v1 == nil {
return 0, nil
}
v2 := v1.Service
if v2 == nil {
return 0, nil
}
v3 := v2.Port
return uint16(v3.GetValue()), nil
case "internal_messaging":
v0 := m.V1
if v0 == nil {
return 0, nil
}
v1 := v0.Sys
if v1 == nil {
return 0, nil
}
v2 := v1.InternalMessaging
if v2 == nil {
return 0, nil
}
v3 := v2.Port
return uint16(v3.GetValue()), nil
case "internal_messaging_gw":
v0 := m.V1
if v0 == nil {
return 0, nil
}
v1 := v0.Sys
if v1 == nil {
return 0, nil
}
v2 := v1.InternalMessaging
if v2 == nil {
return 0, nil
}
v3 := v2.GatewayPort
return uint16(v3.GetValue()), nil
default:
return 0, a2conf.ErrPortNotFound
}
}
// ListSecrets lists all the secrets exposed by the config
func (m *ConfigRequest) ListSecrets() []a2conf.SecretInfo {
return []a2conf.SecretInfo{}
}
// GetSecret gets a secret by name. Returns nil if it is not set
func (m *ConfigRequest) GetSecret(name string) *wrappers.StringValue {
return nil
}
// SetSecret sets a secret by name. Returns ErrSecretNotFound if the secret does not exist
func (m *ConfigRequest) SetSecret(name string, value *wrappers.StringValue) error {
return a2conf.ErrSecretNotFound
}