github.com/darrenli6/fabric-sdk-example@v0.0.0-20220109053535-94b13b56df8c/protos/common/policies.pb.go (about) 1 // Code generated by protoc-gen-go. DO NOT EDIT. 2 // source: common/policies.proto 3 4 package common 5 6 import proto "github.com/golang/protobuf/proto" 7 import fmt "fmt" 8 import math "math" 9 import common1 "github.com/hyperledger/fabric/protos/msp" 10 11 // Reference imports to suppress errors if they are not otherwise used. 12 var _ = proto.Marshal 13 var _ = fmt.Errorf 14 var _ = math.Inf 15 16 type Policy_PolicyType int32 17 18 const ( 19 Policy_UNKNOWN Policy_PolicyType = 0 20 Policy_SIGNATURE Policy_PolicyType = 1 21 Policy_MSP Policy_PolicyType = 2 22 Policy_IMPLICIT_META Policy_PolicyType = 3 23 ) 24 25 var Policy_PolicyType_name = map[int32]string{ 26 0: "UNKNOWN", 27 1: "SIGNATURE", 28 2: "MSP", 29 3: "IMPLICIT_META", 30 } 31 var Policy_PolicyType_value = map[string]int32{ 32 "UNKNOWN": 0, 33 "SIGNATURE": 1, 34 "MSP": 2, 35 "IMPLICIT_META": 3, 36 } 37 38 func (x Policy_PolicyType) String() string { 39 return proto.EnumName(Policy_PolicyType_name, int32(x)) 40 } 41 func (Policy_PolicyType) EnumDescriptor() ([]byte, []int) { return fileDescriptor4, []int{0, 0} } 42 43 type ImplicitMetaPolicy_Rule int32 44 45 const ( 46 ImplicitMetaPolicy_ANY ImplicitMetaPolicy_Rule = 0 47 ImplicitMetaPolicy_ALL ImplicitMetaPolicy_Rule = 1 48 ImplicitMetaPolicy_MAJORITY ImplicitMetaPolicy_Rule = 2 49 ) 50 51 var ImplicitMetaPolicy_Rule_name = map[int32]string{ 52 0: "ANY", 53 1: "ALL", 54 2: "MAJORITY", 55 } 56 var ImplicitMetaPolicy_Rule_value = map[string]int32{ 57 "ANY": 0, 58 "ALL": 1, 59 "MAJORITY": 2, 60 } 61 62 func (x ImplicitMetaPolicy_Rule) String() string { 63 return proto.EnumName(ImplicitMetaPolicy_Rule_name, int32(x)) 64 } 65 func (ImplicitMetaPolicy_Rule) EnumDescriptor() ([]byte, []int) { return fileDescriptor4, []int{3, 0} } 66 67 // Policy expresses a policy which the orderer can evaluate, because there has been some desire expressed to support 68 // multiple policy engines, this is typed as a oneof for now 69 type Policy struct { 70 Type int32 `protobuf:"varint,1,opt,name=type" json:"type,omitempty"` 71 Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` 72 } 73 74 func (m *Policy) Reset() { *m = Policy{} } 75 func (m *Policy) String() string { return proto.CompactTextString(m) } 76 func (*Policy) ProtoMessage() {} 77 func (*Policy) Descriptor() ([]byte, []int) { return fileDescriptor4, []int{0} } 78 79 func (m *Policy) GetType() int32 { 80 if m != nil { 81 return m.Type 82 } 83 return 0 84 } 85 86 func (m *Policy) GetValue() []byte { 87 if m != nil { 88 return m.Value 89 } 90 return nil 91 } 92 93 // SignaturePolicyEnvelope wraps a SignaturePolicy and includes a version for future enhancements 94 type SignaturePolicyEnvelope struct { 95 Version int32 `protobuf:"varint,1,opt,name=version" json:"version,omitempty"` 96 Rule *SignaturePolicy `protobuf:"bytes,2,opt,name=rule" json:"rule,omitempty"` 97 Identities []*common1.MSPPrincipal `protobuf:"bytes,3,rep,name=identities" json:"identities,omitempty"` 98 } 99 100 func (m *SignaturePolicyEnvelope) Reset() { *m = SignaturePolicyEnvelope{} } 101 func (m *SignaturePolicyEnvelope) String() string { return proto.CompactTextString(m) } 102 func (*SignaturePolicyEnvelope) ProtoMessage() {} 103 func (*SignaturePolicyEnvelope) Descriptor() ([]byte, []int) { return fileDescriptor4, []int{1} } 104 105 func (m *SignaturePolicyEnvelope) GetVersion() int32 { 106 if m != nil { 107 return m.Version 108 } 109 return 0 110 } 111 112 func (m *SignaturePolicyEnvelope) GetRule() *SignaturePolicy { 113 if m != nil { 114 return m.Rule 115 } 116 return nil 117 } 118 119 func (m *SignaturePolicyEnvelope) GetIdentities() []*common1.MSPPrincipal { 120 if m != nil { 121 return m.Identities 122 } 123 return nil 124 } 125 126 // SignaturePolicy is a recursive message structure which defines a featherweight DSL for describing 127 // policies which are more complicated than 'exactly this signature'. The NOutOf operator is sufficent 128 // to express AND as well as OR, as well as of course N out of the following M policies 129 // SignedBy implies that the signature is from a valid certificate which is signed by the trusted 130 // authority specified in the bytes. This will be the certificate itself for a self-signed certificate 131 // and will be the CA for more traditional certificates 132 type SignaturePolicy struct { 133 // Types that are valid to be assigned to Type: 134 // *SignaturePolicy_SignedBy 135 // *SignaturePolicy_NOutOf_ 136 Type isSignaturePolicy_Type `protobuf_oneof:"Type"` 137 } 138 139 func (m *SignaturePolicy) Reset() { *m = SignaturePolicy{} } 140 func (m *SignaturePolicy) String() string { return proto.CompactTextString(m) } 141 func (*SignaturePolicy) ProtoMessage() {} 142 func (*SignaturePolicy) Descriptor() ([]byte, []int) { return fileDescriptor4, []int{2} } 143 144 type isSignaturePolicy_Type interface { 145 isSignaturePolicy_Type() 146 } 147 148 type SignaturePolicy_SignedBy struct { 149 SignedBy int32 `protobuf:"varint,1,opt,name=signed_by,json=signedBy,oneof"` 150 } 151 type SignaturePolicy_NOutOf_ struct { 152 NOutOf *SignaturePolicy_NOutOf `protobuf:"bytes,2,opt,name=n_out_of,json=nOutOf,oneof"` 153 } 154 155 func (*SignaturePolicy_SignedBy) isSignaturePolicy_Type() {} 156 func (*SignaturePolicy_NOutOf_) isSignaturePolicy_Type() {} 157 158 func (m *SignaturePolicy) GetType() isSignaturePolicy_Type { 159 if m != nil { 160 return m.Type 161 } 162 return nil 163 } 164 165 func (m *SignaturePolicy) GetSignedBy() int32 { 166 if x, ok := m.GetType().(*SignaturePolicy_SignedBy); ok { 167 return x.SignedBy 168 } 169 return 0 170 } 171 172 func (m *SignaturePolicy) GetNOutOf() *SignaturePolicy_NOutOf { 173 if x, ok := m.GetType().(*SignaturePolicy_NOutOf_); ok { 174 return x.NOutOf 175 } 176 return nil 177 } 178 179 // XXX_OneofFuncs is for the internal use of the proto package. 180 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{}) { 181 return _SignaturePolicy_OneofMarshaler, _SignaturePolicy_OneofUnmarshaler, _SignaturePolicy_OneofSizer, []interface{}{ 182 (*SignaturePolicy_SignedBy)(nil), 183 (*SignaturePolicy_NOutOf_)(nil), 184 } 185 } 186 187 func _SignaturePolicy_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { 188 m := msg.(*SignaturePolicy) 189 // Type 190 switch x := m.Type.(type) { 191 case *SignaturePolicy_SignedBy: 192 b.EncodeVarint(1<<3 | proto.WireVarint) 193 b.EncodeVarint(uint64(x.SignedBy)) 194 case *SignaturePolicy_NOutOf_: 195 b.EncodeVarint(2<<3 | proto.WireBytes) 196 if err := b.EncodeMessage(x.NOutOf); err != nil { 197 return err 198 } 199 case nil: 200 default: 201 return fmt.Errorf("SignaturePolicy.Type has unexpected type %T", x) 202 } 203 return nil 204 } 205 206 func _SignaturePolicy_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { 207 m := msg.(*SignaturePolicy) 208 switch tag { 209 case 1: // Type.signed_by 210 if wire != proto.WireVarint { 211 return true, proto.ErrInternalBadWireType 212 } 213 x, err := b.DecodeVarint() 214 m.Type = &SignaturePolicy_SignedBy{int32(x)} 215 return true, err 216 case 2: // Type.n_out_of 217 if wire != proto.WireBytes { 218 return true, proto.ErrInternalBadWireType 219 } 220 msg := new(SignaturePolicy_NOutOf) 221 err := b.DecodeMessage(msg) 222 m.Type = &SignaturePolicy_NOutOf_{msg} 223 return true, err 224 default: 225 return false, nil 226 } 227 } 228 229 func _SignaturePolicy_OneofSizer(msg proto.Message) (n int) { 230 m := msg.(*SignaturePolicy) 231 // Type 232 switch x := m.Type.(type) { 233 case *SignaturePolicy_SignedBy: 234 n += proto.SizeVarint(1<<3 | proto.WireVarint) 235 n += proto.SizeVarint(uint64(x.SignedBy)) 236 case *SignaturePolicy_NOutOf_: 237 s := proto.Size(x.NOutOf) 238 n += proto.SizeVarint(2<<3 | proto.WireBytes) 239 n += proto.SizeVarint(uint64(s)) 240 n += s 241 case nil: 242 default: 243 panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) 244 } 245 return n 246 } 247 248 type SignaturePolicy_NOutOf struct { 249 N int32 `protobuf:"varint,1,opt,name=n" json:"n,omitempty"` 250 Rules []*SignaturePolicy `protobuf:"bytes,2,rep,name=rules" json:"rules,omitempty"` 251 } 252 253 func (m *SignaturePolicy_NOutOf) Reset() { *m = SignaturePolicy_NOutOf{} } 254 func (m *SignaturePolicy_NOutOf) String() string { return proto.CompactTextString(m) } 255 func (*SignaturePolicy_NOutOf) ProtoMessage() {} 256 func (*SignaturePolicy_NOutOf) Descriptor() ([]byte, []int) { return fileDescriptor4, []int{2, 0} } 257 258 func (m *SignaturePolicy_NOutOf) GetN() int32 { 259 if m != nil { 260 return m.N 261 } 262 return 0 263 } 264 265 func (m *SignaturePolicy_NOutOf) GetRules() []*SignaturePolicy { 266 if m != nil { 267 return m.Rules 268 } 269 return nil 270 } 271 272 // ImplicitMetaPolicy is a policy type which depends on the hierarchical nature of the configuration 273 // It is implicit because the rule is generate implicitly based on the number of sub policies 274 // It is meta because it depends only on the result of other policies 275 // When evaluated, this policy iterates over all immediate child sub-groups, retrieves the policy 276 // of name sub_policy, evaluates the collection and applies the rule. 277 // For example, with 4 sub-groups, and a policy name of "foo", ImplicitMetaPolicy retrieves 278 // each sub-group, retrieves policy "foo" for each subgroup, evaluates it, and, in the case of ANY 279 // 1 satisfied is sufficient, ALL would require 4 signatures, and MAJORITY would require 3 signatures. 280 type ImplicitMetaPolicy struct { 281 SubPolicy string `protobuf:"bytes,1,opt,name=sub_policy,json=subPolicy" json:"sub_policy,omitempty"` 282 Rule ImplicitMetaPolicy_Rule `protobuf:"varint,2,opt,name=rule,enum=common.ImplicitMetaPolicy_Rule" json:"rule,omitempty"` 283 } 284 285 func (m *ImplicitMetaPolicy) Reset() { *m = ImplicitMetaPolicy{} } 286 func (m *ImplicitMetaPolicy) String() string { return proto.CompactTextString(m) } 287 func (*ImplicitMetaPolicy) ProtoMessage() {} 288 func (*ImplicitMetaPolicy) Descriptor() ([]byte, []int) { return fileDescriptor4, []int{3} } 289 290 func (m *ImplicitMetaPolicy) GetSubPolicy() string { 291 if m != nil { 292 return m.SubPolicy 293 } 294 return "" 295 } 296 297 func (m *ImplicitMetaPolicy) GetRule() ImplicitMetaPolicy_Rule { 298 if m != nil { 299 return m.Rule 300 } 301 return ImplicitMetaPolicy_ANY 302 } 303 304 func init() { 305 proto.RegisterType((*Policy)(nil), "common.Policy") 306 proto.RegisterType((*SignaturePolicyEnvelope)(nil), "common.SignaturePolicyEnvelope") 307 proto.RegisterType((*SignaturePolicy)(nil), "common.SignaturePolicy") 308 proto.RegisterType((*SignaturePolicy_NOutOf)(nil), "common.SignaturePolicy.NOutOf") 309 proto.RegisterType((*ImplicitMetaPolicy)(nil), "common.ImplicitMetaPolicy") 310 proto.RegisterEnum("common.Policy_PolicyType", Policy_PolicyType_name, Policy_PolicyType_value) 311 proto.RegisterEnum("common.ImplicitMetaPolicy_Rule", ImplicitMetaPolicy_Rule_name, ImplicitMetaPolicy_Rule_value) 312 } 313 314 func init() { proto.RegisterFile("common/policies.proto", fileDescriptor4) } 315 316 var fileDescriptor4 = []byte{ 317 // 480 bytes of a gzipped FileDescriptorProto 318 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x74, 0x52, 0xdf, 0x8b, 0xda, 0x40, 319 0x10, 0x76, 0xfd, 0x11, 0x75, 0xf4, 0xda, 0x74, 0xb9, 0xa2, 0x1c, 0xb4, 0x95, 0x50, 0x8a, 0x70, 320 0x34, 0x01, 0xaf, 0x4f, 0x7d, 0xd3, 0x56, 0x7a, 0x69, 0x4d, 0x94, 0xd5, 0xa3, 0x5c, 0x5f, 0x82, 321 0xd1, 0xd5, 0x5b, 0x88, 0xbb, 0x4b, 0x76, 0x23, 0xf5, 0xbf, 0xe8, 0x53, 0xff, 0x99, 0xfe, 0x73, 322 0x25, 0x59, 0x2d, 0x72, 0xe5, 0xde, 0xe6, 0x9b, 0xfd, 0x66, 0xf6, 0xfb, 0x66, 0x06, 0x5e, 0xae, 323 0xc4, 0x6e, 0x27, 0xb8, 0x27, 0x45, 0xc2, 0x56, 0x8c, 0x2a, 0x57, 0xa6, 0x42, 0x0b, 0x6c, 0x99, 324 0xf4, 0x55, 0x67, 0xa7, 0xa4, 0xb7, 0x53, 0x32, 0x92, 0x29, 0xe3, 0x2b, 0x26, 0x97, 0x89, 0x21, 325 0x38, 0x3f, 0xc1, 0x9a, 0xe5, 0x25, 0x07, 0x8c, 0xa1, 0xaa, 0x0f, 0x92, 0x76, 0x51, 0x0f, 0xf5, 326 0x6b, 0xa4, 0x88, 0xf1, 0x25, 0xd4, 0xf6, 0xcb, 0x24, 0xa3, 0xdd, 0x72, 0x0f, 0xf5, 0xdb, 0xc4, 327 0x00, 0xe7, 0x33, 0x80, 0xa9, 0x59, 0xe4, 0x9c, 0x16, 0xd4, 0xef, 0xc2, 0x6f, 0xe1, 0xf4, 0x7b, 328 0x68, 0x97, 0xf0, 0x05, 0x34, 0xe7, 0xfe, 0x97, 0x70, 0xb8, 0xb8, 0x23, 0x63, 0x1b, 0xe1, 0x3a, 329 0x54, 0x82, 0xf9, 0xcc, 0x2e, 0xe3, 0x17, 0x70, 0xe1, 0x07, 0xb3, 0x89, 0xff, 0xc9, 0x5f, 0x44, 330 0xc1, 0x78, 0x31, 0xb4, 0x2b, 0xce, 0x6f, 0x04, 0x9d, 0x39, 0xdb, 0xf2, 0xa5, 0xce, 0x52, 0x6a, 331 0xfa, 0x8d, 0xf9, 0x9e, 0x26, 0x42, 0x52, 0xdc, 0x85, 0xfa, 0x9e, 0xa6, 0x8a, 0x09, 0x7e, 0x94, 332 0x73, 0x82, 0xf8, 0x1a, 0xaa, 0x69, 0x96, 0x18, 0x41, 0xad, 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