github.com/yacovm/fabric@v2.0.0-alpha.0.20191128145320-c5d4087dc723+incompatible/common/mocks/config/resources.go (about) 1 /* 2 Copyright IBM Corp. 2016 All Rights Reserved. 3 4 SPDX-License-Identifier: Apache-2.0 5 */ 6 7 package config 8 9 import ( 10 "github.com/hyperledger/fabric/common/channelconfig" 11 "github.com/hyperledger/fabric/common/configtx" 12 "github.com/hyperledger/fabric/common/policies" 13 "github.com/hyperledger/fabric/msp" 14 ) 15 16 type Resources struct { 17 // ConfigtxValidatorVal is returned as the result of ConfigtxValidator 18 ConfigtxValidatorVal configtx.Validator 19 20 // PolicyManagerVal is returned as the result of PolicyManager() 21 PolicyManagerVal policies.Manager 22 23 // ChannelConfigVal is returned as the result of ChannelConfig() 24 ChannelConfigVal channelconfig.Channel 25 26 // OrdererConfigVal is returned as the result of OrdererConfig() 27 OrdererConfigVal channelconfig.Orderer 28 29 // ApplicationConfigVal is returned as the result of ApplicationConfig() 30 ApplicationConfigVal channelconfig.Application 31 32 // ConsortiumsConfigVal is returned as the result of ConsortiumsConfig() 33 ConsortiumsConfigVal channelconfig.Consortiums 34 35 // MSPManagerVal is returned as the result of MSPManager() 36 MSPManagerVal msp.MSPManager 37 38 // ValidateNewErr is returned as the result of ValidateNew 39 ValidateNewErr error 40 } 41 42 // ConfigtxMangaer returns ConfigtxValidatorVal 43 func (r *Resources) ConfigtxValidator() configtx.Validator { 44 return r.ConfigtxValidatorVal 45 } 46 47 // Returns the PolicyManagerVal 48 func (r *Resources) PolicyManager() policies.Manager { 49 return r.PolicyManagerVal 50 } 51 52 // Returns the ChannelConfigVal 53 func (r *Resources) ChannelConfig() channelconfig.Channel { 54 return r.ChannelConfigVal 55 } 56 57 // Returns the OrdererConfigVal 58 func (r *Resources) OrdererConfig() (channelconfig.Orderer, bool) { 59 return r.OrdererConfigVal, r.OrdererConfigVal != nil 60 } 61 62 // Returns the ApplicationConfigVal 63 func (r *Resources) ApplicationConfig() (channelconfig.Application, bool) { 64 return r.ApplicationConfigVal, r.ApplicationConfigVal != nil 65 } 66 67 func (r *Resources) ConsortiumsConfig() (channelconfig.Consortiums, bool) { 68 return r.ConsortiumsConfigVal, r.ConsortiumsConfigVal != nil 69 } 70 71 // Returns the MSPManagerVal 72 func (r *Resources) MSPManager() msp.MSPManager { 73 return r.MSPManagerVal 74 } 75 76 // ValidateNew returns ValidateNewErr 77 func (r *Resources) ValidateNew(res channelconfig.Resources) error { 78 return r.ValidateNewErr 79 }