github.com/kaituanwang/hyperledger@v2.0.1+incompatible/integration/nwo/commands/discover.go (about) 1 /* 2 Copyright IBM Corp. All Rights Reserved. 3 4 SPDX-License-Identifier: Apache-2.0 5 */ 6 7 package commands 8 9 type Peers struct { 10 UserCert string 11 UserKey string 12 MSPID string 13 Server string 14 Channel string 15 ClientCert string 16 ClientKey string 17 } 18 19 func (p Peers) SessionName() string { 20 return "discover-peers" 21 } 22 23 func (p Peers) Args() []string { 24 args := []string{ 25 "--userCert", p.UserCert, 26 "--userKey", p.UserKey, 27 "--MSP", p.MSPID, 28 "peers", 29 "--server", p.Server, 30 "--channel", p.Channel, 31 } 32 if p.ClientCert != "" { 33 args = append(args, "--tlsCert", p.ClientCert) 34 } 35 if p.ClientKey != "" { 36 args = append(args, "--tlsKey", p.ClientKey) 37 } 38 return args 39 } 40 41 type Config struct { 42 UserCert string 43 UserKey string 44 MSPID string 45 Server string 46 Channel string 47 ClientCert string 48 ClientKey string 49 } 50 51 func (c Config) SessionName() string { 52 return "discover-config" 53 } 54 55 func (c Config) Args() []string { 56 args := []string{ 57 "--userCert", c.UserCert, 58 "--userKey", c.UserKey, 59 "--MSP", c.MSPID, 60 "config", 61 "--server", c.Server, 62 "--channel", c.Channel, 63 } 64 if c.ClientCert != "" { 65 args = append(args, "--tlsCert", c.ClientCert) 66 } 67 if c.ClientKey != "" { 68 args = append(args, "--tlsKey", c.ClientKey) 69 } 70 return args 71 } 72 73 type Endorsers struct { 74 UserCert string 75 UserKey string 76 MSPID string 77 Server string 78 Channel string 79 Chaincode string 80 Chaincodes []string 81 Collection string 82 Collections []string 83 ClientCert string 84 ClientKey string 85 } 86 87 func (e Endorsers) SessionName() string { 88 return "discover-endorsers" 89 } 90 91 func (e Endorsers) Args() []string { 92 args := []string{ 93 "--userCert", e.UserCert, 94 "--userKey", e.UserKey, 95 "--MSP", e.MSPID, 96 "endorsers", 97 "--server", e.Server, 98 "--channel", e.Channel, 99 } 100 if e.ClientCert != "" { 101 args = append(args, "--tlsCert", e.ClientCert) 102 } 103 if e.ClientKey != "" { 104 args = append(args, "--tlsKey", e.ClientKey) 105 } 106 if e.Chaincode != "" { 107 args = append(args, "--chaincode", e.Chaincode) 108 } 109 for _, cc := range e.Chaincodes { 110 args = append(args, "--chaincode", cc) 111 } 112 if e.Collection != "" { 113 args = append(args, "--collection", e.Collection) 114 } 115 for _, c := range e.Collections { 116 args = append(args, "--collection", c) 117 } 118 return args 119 }