github.com/hyperledger-labs/bdls@v2.1.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 NoPrivateReads []string 86 } 87 88 func (e Endorsers) SessionName() string { 89 return "discover-endorsers" 90 } 91 92 func (e Endorsers) Args() []string { 93 args := []string{ 94 "--userCert", e.UserCert, 95 "--userKey", e.UserKey, 96 "--MSP", e.MSPID, 97 "endorsers", 98 "--server", e.Server, 99 "--channel", e.Channel, 100 } 101 if e.ClientCert != "" { 102 args = append(args, "--tlsCert", e.ClientCert) 103 } 104 if e.ClientKey != "" { 105 args = append(args, "--tlsKey", e.ClientKey) 106 } 107 if e.Chaincode != "" { 108 args = append(args, "--chaincode", e.Chaincode) 109 } 110 for _, cc := range e.Chaincodes { 111 args = append(args, "--chaincode", cc) 112 } 113 if e.Collection != "" { 114 args = append(args, "--collection", e.Collection) 115 } 116 for _, c := range e.Collections { 117 args = append(args, "--collection", c) 118 } 119 for _, cc := range e.NoPrivateReads { 120 args = append(args, "--noPrivateReads", cc) 121 } 122 return args 123 }