forked from cgorenflo/fabric
-
Notifications
You must be signed in to change notification settings - Fork 0
/
policies.pb.go
348 lines (305 loc) · 13.3 KB
/
policies.pb.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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: common/policies.proto
package common
import proto "github.com/golang/protobuf/proto"
import fmt "fmt"
import math "math"
import common1 "github.com/hyperledger/fabric/protos/msp"
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
type Policy_PolicyType int32
const (
Policy_UNKNOWN Policy_PolicyType = 0
Policy_SIGNATURE Policy_PolicyType = 1
Policy_MSP Policy_PolicyType = 2
Policy_IMPLICIT_META Policy_PolicyType = 3
)
var Policy_PolicyType_name = map[int32]string{
0: "UNKNOWN",
1: "SIGNATURE",
2: "MSP",
3: "IMPLICIT_META",
}
var Policy_PolicyType_value = map[string]int32{
"UNKNOWN": 0,
"SIGNATURE": 1,
"MSP": 2,
"IMPLICIT_META": 3,
}
func (x Policy_PolicyType) String() string {
return proto.EnumName(Policy_PolicyType_name, int32(x))
}
func (Policy_PolicyType) EnumDescriptor() ([]byte, []int) { return fileDescriptor5, []int{0, 0} }
type ImplicitMetaPolicy_Rule int32
const (
ImplicitMetaPolicy_ANY ImplicitMetaPolicy_Rule = 0
ImplicitMetaPolicy_ALL ImplicitMetaPolicy_Rule = 1
ImplicitMetaPolicy_MAJORITY ImplicitMetaPolicy_Rule = 2
)
var ImplicitMetaPolicy_Rule_name = map[int32]string{
0: "ANY",
1: "ALL",
2: "MAJORITY",
}
var ImplicitMetaPolicy_Rule_value = map[string]int32{
"ANY": 0,
"ALL": 1,
"MAJORITY": 2,
}
func (x ImplicitMetaPolicy_Rule) String() string {
return proto.EnumName(ImplicitMetaPolicy_Rule_name, int32(x))
}
func (ImplicitMetaPolicy_Rule) EnumDescriptor() ([]byte, []int) { return fileDescriptor5, []int{3, 0} }
// Policy expresses a policy which the orderer can evaluate, because there has been some desire expressed to support
// multiple policy engines, this is typed as a oneof for now
type Policy struct {
Type int32 `protobuf:"varint,1,opt,name=type" json:"type,omitempty"`
Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
}
func (m *Policy) Reset() { *m = Policy{} }
func (m *Policy) String() string { return proto.CompactTextString(m) }
func (*Policy) ProtoMessage() {}
func (*Policy) Descriptor() ([]byte, []int) { return fileDescriptor5, []int{0} }
func (m *Policy) GetType() int32 {
if m != nil {
return m.Type
}
return 0
}
func (m *Policy) GetValue() []byte {
if m != nil {
return m.Value
}
return nil
}
// SignaturePolicyEnvelope wraps a SignaturePolicy and includes a version for future enhancements
type SignaturePolicyEnvelope struct {
Version int32 `protobuf:"varint,1,opt,name=version" json:"version,omitempty"`
Rule *SignaturePolicy `protobuf:"bytes,2,opt,name=rule" json:"rule,omitempty"`
Identities []*common1.MSPPrincipal `protobuf:"bytes,3,rep,name=identities" json:"identities,omitempty"`
}
func (m *SignaturePolicyEnvelope) Reset() { *m = SignaturePolicyEnvelope{} }
func (m *SignaturePolicyEnvelope) String() string { return proto.CompactTextString(m) }
func (*SignaturePolicyEnvelope) ProtoMessage() {}
func (*SignaturePolicyEnvelope) Descriptor() ([]byte, []int) { return fileDescriptor5, []int{1} }
func (m *SignaturePolicyEnvelope) GetVersion() int32 {
if m != nil {
return m.Version
}
return 0
}
func (m *SignaturePolicyEnvelope) GetRule() *SignaturePolicy {
if m != nil {
return m.Rule
}
return nil
}
func (m *SignaturePolicyEnvelope) GetIdentities() []*common1.MSPPrincipal {
if m != nil {
return m.Identities
}
return nil
}
// SignaturePolicy is a recursive message structure which defines a featherweight DSL for describing
// policies which are more complicated than 'exactly this signature'. The NOutOf operator is sufficent
// to express AND as well as OR, as well as of course N out of the following M policies
// SignedBy implies that the signature is from a valid certificate which is signed by the trusted
// authority specified in the bytes. This will be the certificate itself for a self-signed certificate
// and will be the CA for more traditional certificates
type SignaturePolicy struct {
// Types that are valid to be assigned to Type:
// *SignaturePolicy_SignedBy
// *SignaturePolicy_NOutOf_
Type isSignaturePolicy_Type `protobuf_oneof:"Type"`
}
func (m *SignaturePolicy) Reset() { *m = SignaturePolicy{} }
func (m *SignaturePolicy) String() string { return proto.CompactTextString(m) }
func (*SignaturePolicy) ProtoMessage() {}
func (*SignaturePolicy) Descriptor() ([]byte, []int) { return fileDescriptor5, []int{2} }
type isSignaturePolicy_Type interface {
isSignaturePolicy_Type()
}
type SignaturePolicy_SignedBy struct {
SignedBy int32 `protobuf:"varint,1,opt,name=signed_by,json=signedBy,oneof"`
}
type SignaturePolicy_NOutOf_ struct {
NOutOf *SignaturePolicy_NOutOf `protobuf:"bytes,2,opt,name=n_out_of,json=nOutOf,oneof"`
}
func (*SignaturePolicy_SignedBy) isSignaturePolicy_Type() {}
func (*SignaturePolicy_NOutOf_) isSignaturePolicy_Type() {}
func (m *SignaturePolicy) GetType() isSignaturePolicy_Type {
if m != nil {
return m.Type
}
return nil
}
func (m *SignaturePolicy) GetSignedBy() int32 {
if x, ok := m.GetType().(*SignaturePolicy_SignedBy); ok {
return x.SignedBy
}
return 0
}
func (m *SignaturePolicy) GetNOutOf() *SignaturePolicy_NOutOf {
if x, ok := m.GetType().(*SignaturePolicy_NOutOf_); ok {
return x.NOutOf
}
return nil
}
// XXX_OneofFuncs is for the internal use of the proto package.
func (*SignaturePolicy) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {
return _SignaturePolicy_OneofMarshaler, _SignaturePolicy_OneofUnmarshaler, _SignaturePolicy_OneofSizer, []interface{}{
(*SignaturePolicy_SignedBy)(nil),
(*SignaturePolicy_NOutOf_)(nil),
}
}
func _SignaturePolicy_OneofMarshaler(msg proto.Message, b *proto.Buffer) error {
m := msg.(*SignaturePolicy)
// Type
switch x := m.Type.(type) {
case *SignaturePolicy_SignedBy:
b.EncodeVarint(1<<3 | proto.WireVarint)
b.EncodeVarint(uint64(x.SignedBy))
case *SignaturePolicy_NOutOf_:
b.EncodeVarint(2<<3 | proto.WireBytes)
if err := b.EncodeMessage(x.NOutOf); err != nil {
return err
}
case nil:
default:
return fmt.Errorf("SignaturePolicy.Type has unexpected type %T", x)
}
return nil
}
func _SignaturePolicy_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) {
m := msg.(*SignaturePolicy)
switch tag {
case 1: // Type.signed_by
if wire != proto.WireVarint {
return true, proto.ErrInternalBadWireType
}
x, err := b.DecodeVarint()
m.Type = &SignaturePolicy_SignedBy{int32(x)}
return true, err
case 2: // Type.n_out_of
if wire != proto.WireBytes {
return true, proto.ErrInternalBadWireType
}
msg := new(SignaturePolicy_NOutOf)
err := b.DecodeMessage(msg)
m.Type = &SignaturePolicy_NOutOf_{msg}
return true, err
default:
return false, nil
}
}
func _SignaturePolicy_OneofSizer(msg proto.Message) (n int) {
m := msg.(*SignaturePolicy)
// Type
switch x := m.Type.(type) {
case *SignaturePolicy_SignedBy:
n += proto.SizeVarint(1<<3 | proto.WireVarint)
n += proto.SizeVarint(uint64(x.SignedBy))
case *SignaturePolicy_NOutOf_:
s := proto.Size(x.NOutOf)
n += proto.SizeVarint(2<<3 | proto.WireBytes)
n += proto.SizeVarint(uint64(s))
n += s
case nil:
default:
panic(fmt.Sprintf("proto: unexpected type %T in oneof", x))
}
return n
}
type SignaturePolicy_NOutOf struct {
N int32 `protobuf:"varint,1,opt,name=n" json:"n,omitempty"`
Rules []*SignaturePolicy `protobuf:"bytes,2,rep,name=rules" json:"rules,omitempty"`
}
func (m *SignaturePolicy_NOutOf) Reset() { *m = SignaturePolicy_NOutOf{} }
func (m *SignaturePolicy_NOutOf) String() string { return proto.CompactTextString(m) }
func (*SignaturePolicy_NOutOf) ProtoMessage() {}
func (*SignaturePolicy_NOutOf) Descriptor() ([]byte, []int) { return fileDescriptor5, []int{2, 0} }
func (m *SignaturePolicy_NOutOf) GetN() int32 {
if m != nil {
return m.N
}
return 0
}
func (m *SignaturePolicy_NOutOf) GetRules() []*SignaturePolicy {
if m != nil {
return m.Rules
}
return nil
}
// ImplicitMetaPolicy is a policy type which depends on the hierarchical nature of the configuration
// It is implicit because the rule is generate implicitly based on the number of sub policies
// It is meta because it depends only on the result of other policies
// When evaluated, this policy iterates over all immediate child sub-groups, retrieves the policy
// of name sub_policy, evaluates the collection and applies the rule.
// For example, with 4 sub-groups, and a policy name of "foo", ImplicitMetaPolicy retrieves
// each sub-group, retrieves policy "foo" for each subgroup, evaluates it, and, in the case of ANY
// 1 satisfied is sufficient, ALL would require 4 signatures, and MAJORITY would require 3 signatures.
type ImplicitMetaPolicy struct {
SubPolicy string `protobuf:"bytes,1,opt,name=sub_policy,json=subPolicy" json:"sub_policy,omitempty"`
Rule ImplicitMetaPolicy_Rule `protobuf:"varint,2,opt,name=rule,enum=common.ImplicitMetaPolicy_Rule" json:"rule,omitempty"`
}
func (m *ImplicitMetaPolicy) Reset() { *m = ImplicitMetaPolicy{} }
func (m *ImplicitMetaPolicy) String() string { return proto.CompactTextString(m) }
func (*ImplicitMetaPolicy) ProtoMessage() {}
func (*ImplicitMetaPolicy) Descriptor() ([]byte, []int) { return fileDescriptor5, []int{3} }
func (m *ImplicitMetaPolicy) GetSubPolicy() string {
if m != nil {
return m.SubPolicy
}
return ""
}
func (m *ImplicitMetaPolicy) GetRule() ImplicitMetaPolicy_Rule {
if m != nil {
return m.Rule
}
return ImplicitMetaPolicy_ANY
}
func init() {
proto.RegisterType((*Policy)(nil), "common.Policy")
proto.RegisterType((*SignaturePolicyEnvelope)(nil), "common.SignaturePolicyEnvelope")
proto.RegisterType((*SignaturePolicy)(nil), "common.SignaturePolicy")
proto.RegisterType((*SignaturePolicy_NOutOf)(nil), "common.SignaturePolicy.NOutOf")
proto.RegisterType((*ImplicitMetaPolicy)(nil), "common.ImplicitMetaPolicy")
proto.RegisterEnum("common.Policy_PolicyType", Policy_PolicyType_name, Policy_PolicyType_value)
proto.RegisterEnum("common.ImplicitMetaPolicy_Rule", ImplicitMetaPolicy_Rule_name, ImplicitMetaPolicy_Rule_value)
}
func init() { proto.RegisterFile("common/policies.proto", fileDescriptor5) }
var fileDescriptor5 = []byte{
// 480 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x52, 0xdf, 0x8b, 0xda, 0x40,
0x10, 0x76, 0xfd, 0x11, 0x75, 0xf4, 0xda, 0x74, 0xb9, 0xa2, 0x1c, 0xb4, 0x95, 0x50, 0x8a, 0x70,
0x34, 0x01, 0xaf, 0x4f, 0x7d, 0xd3, 0x56, 0x7a, 0x69, 0x4d, 0x94, 0x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