Send install chaincode request proposal to peers.

@param lifecycleInstallChaincodeRequest
@param peers                            Collection of peers to install on.
@return responses from peers.
@throws InvalidArgumentException
@throws ProposalException
518195
public Collection<LifecycleInstallChaincodeProposalResponse> sendLifecycleInstallChaincodeRequest(LifecycleInstallChaincodeRequest lifecycleInstallChaincodeRequest,
                                                                                                      Collection<Peer> peers) throws ProposalException, InvalidArgumentException {

        if (null == lifecycleInstallChaincodeRequest) {
            throw new InvalidArgumentException("The lifecycleInstallChaincodeRequest parameter can not be null.");
        }
        clientCheck();

        lifecycleInstallChaincodeRequest.setSubmitted();
        Channel systemChannel = Channel.newSystemChannel(this);

        return systemChannel.sendLifecycleInstallProposal(lifecycleInstallChaincodeRequest, peers);

    }
1329660
public void setChaincodeSourceLocation(File chaincodeSourceLocation) throws InvalidArgumentException {
        if (chaincodeSourceLocation == null) {
            throw new InvalidArgumentException("Chaincode source location may not be null.");
        }
        if (chaincodeInputStream != null) {
            throw new InvalidArgumentException("Error setting chaincode location. Chaincode input stream already set. Only one or the other maybe set.");
        }

        this.chaincodeSourceLocation = chaincodeSourceLocation;
    }
137373
public ChaincodeCollectionConfiguration getChaincodeCollectionConfiguration() throws ProposalException {
        Collection.CollectionConfigPackage collections = parsePayload().getCollections();

        if (null == collections || !parsePayload().hasCollections()) {
            return null;
        }
        try {
            return ChaincodeCollectionConfiguration.fromCollectionConfigPackage(collections);
        } catch (InvalidArgumentException e) {
            throw new ProposalException(e);
        }
    }
58370
public void setLifecycleHookSpecificationList(java.util.Collection<LifecycleHookSpecification> lifecycleHookSpecificationList) {
        if (lifecycleHookSpecificationList == null) {
            this.lifecycleHookSpecificationList = null;
            return;
        }

        this.lifecycleHookSpecificationList = new com.amazonaws.internal.SdkInternalList<LifecycleHookSpecification>(lifecycleHookSpecificationList);
    }
512283
public static Collection<Set<ProposalResponse>> getProposalConsistencySets(Collection<? extends ProposalResponse> proposalResponses,
                                                                               Set<ProposalResponse> invalid) throws InvalidArgumentException {

        if (proposalResponses == null) {
            throw new InvalidArgumentException("proposalResponses collection is null");
        }

        if (proposalResponses.isEmpty()) {
            throw new InvalidArgumentException("proposalResponses collection is empty");
        }

        if (null == invalid) {
            throw new InvalidArgumentException("invalid set is null.");
        }

        HashMap<ByteString, Set<ProposalResponse>> ret = new HashMap<>();

        for (ProposalResponse proposalResponse : proposalResponses) {

            if (proposalResponse.isInvalid()) {
                invalid.add(proposalResponse);
            } else {
                // payload bytes is what's being signed over so it must be consistent.
                final ByteString payloadBytes = proposalResponse.getPayloadBytes();

                if (payloadBytes == null) {
                    throw new InvalidArgumentException(format("proposalResponse.getPayloadBytes() was null from peer: %s.",
                            proposalResponse.getPeer()));
                } else if (payloadBytes.isEmpty()) {
                    throw new InvalidArgumentException(format("proposalResponse.getPayloadBytes() was empty from peer: %s.",
                            proposalResponse.getPeer()));
                }
                Set<ProposalResponse> set = ret.computeIfAbsent(payloadBytes, k -> new HashSet<>());
                set.add(proposalResponse);
            }
        }

        if (IS_DEBUG_LEVEL && ret.size() > 1) {

            StringBuilder sb = new StringBuilder(1000);

            int i = 0;
            String sep = "";

            for (Map.Entry<ByteString, Set<ProposalResponse>> entry : ret.entrySet()) {
                ByteString bytes = entry.getKey();
                Set<ProposalResponse> presp = entry.getValue();

                sb.append(sep)
                        .append("Consistency set: ").append(i++).append(" bytes size: ").append(bytes.size())
                        .append(" bytes: ")
                        .append(Utils.toHexString(bytes.toByteArray())).append(" [");

                String psep = "";

                for (ProposalResponse proposalResponse : presp) {
                    sb.append(psep).append(proposalResponse.getPeer());
                    psep = ", ";
                }
                sb.append("]");
                sep = ", ";
            }

            logger.debug(sb.toString());

        }

        return ret.values();

    }
859937
@Override
    public synchronized void startChain(ChainData chain) throws ChannelException, ChainException {
        String chainName = (null != chain) ? chain.getName() : null;
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.entry(tc, "startChain: " + chainName);
        }
        if (null == chain) {
            throw new InvalidChainNameException("Null chain");
        }

        // Ensure we have an inbound chain.
        if (FlowType.OUTBOUND.equals(chain.getType())) {
            throw new InvalidChainNameException("Outbound chain cannot use this interface.");
        }

        startChainInternal(chain);

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.exit(tc, "startChain");
        }
    }
139607
@Override
	public String sendAlignmentRequest(Sequence<Compound> seq, RemotePairwiseAlignmentProperties rpa) throws Exception {
		return sendAlignmentRequest(seq.getSequenceAsString(), rpa);
	}
547579
public Channel addPeer(Peer peer, PeerOptions peerOptions) throws InvalidArgumentException {
        if (shutdown) {
            throw new InvalidArgumentException(format("Channel %s has been shutdown.", name));
        }

        if (null == peer) {
            throw new InvalidArgumentException("Peer is invalid can not be null.");
        }

        if (peer.getChannel() != null && peer.getChannel() != this) {
            throw new InvalidArgumentException(format("Peer already connected to channel %s", peer.getChannel().getName()));
        }

        if (null == peerOptions) {
            throw new InvalidArgumentException("peerOptions is invalid can not be null.");
        }

        logger.debug(format("%s adding peer: %s, peerOptions: %s", toString(), peer, "" + peerOptions));
        peer.setChannel(this);

        peers.add(peer);
        peerOptionsMap.put(peer, peerOptions.clone());
        peerEndpointMap.put(peer.getEndpoint(), peer);

        if (peerOptions.getPeerRoles().contains(PeerRole.SERVICE_DISCOVERY)) {

            final Properties properties = peer.getProperties();
            if ((properties == null) || properties.isEmpty() || (isNullOrEmpty(properties.getProperty("clientCertFile")) &&
                    !properties.containsKey("clientCertBytes"))) {
                TLSCertificateBuilder tlsCertificateBuilder = new TLSCertificateBuilder();
                TLSCertificateKeyPair tlsCertificateKeyPair = tlsCertificateBuilder.clientCert();
                peer.setTLSCertificateKeyPair(tlsCertificateKeyPair);
            }

            discoveryEndpoints.add(peer.getEndpoint());

        }

        for (Map.Entry<PeerRole, Set<Peer>> peerRole : peerRoleSetMap.entrySet()) {
            if (peerOptions.getPeerRoles().contains(peerRole.getKey())) {
                peerRole.getValue().add(peer);

            }
        }

        if (isInitialized() && peerOptions.getPeerRoles().contains(PeerRole.EVENT_SOURCE)) {
            try {
                peer.initiateEventing(getTransactionContext(), getPeersOptions(peer));
            } catch (TransactionException e) {
                logger.error(format("Error channel %s enabling eventing on peer %s", toString(), peer));
            }

        }
        return this;
    }
519340
func InstallChaincode(reqCtx reqContext.Context, req InstallChaincodeRequest, targets []fab.ProposalProcessor, opts ...Opt) ([]*fab.TransactionProposalResponse, fab.TransactionID, error) {

	if req.Name == "" {
		return nil, fab.EmptyTransactionID, errors.New("chaincode name required")
	}
	if req.Path == "" {
		return nil, fab.EmptyTransactionID, errors.New("chaincode path required")
	}
	if req.Version == "" {
		return nil, fab.EmptyTransactionID, errors.New("chaincode version required")
	}
	if req.Package == nil {
		return nil, fab.EmptyTransactionID, errors.New("chaincode package is required")
	}

	propReq := ChaincodeInstallRequest{
		Name:    req.Name,
		Path:    req.Path,
		Version: req.Version,
		Package: &ChaincodePackage{
			Type: req.Package.Type,
			Code: req.Package.Code,
		},
	}

	ctx, ok := contextImpl.RequestClientContext(reqCtx)
	if !ok {
		return nil, fab.EmptyTransactionID, errors.New("failed get client context from reqContext for txn header")
	}

	txh, err := txn.NewHeader(ctx, fab.SystemChannel)
	if err != nil {
		return nil, fab.EmptyTransactionID, errors.WithMessage(err, "create transaction ID failed")
	}

	prop, err := CreateChaincodeInstallProposal(txh, propReq)
	if err != nil {
		return nil, fab.EmptyTransactionID, errors.WithMessage(err, "creation of install chaincode proposal failed")
	}

	optionsValue := getOpts(opts...)

	resp, err := retry.NewInvoker(retry.New(optionsValue.retry)).Invoke(
		func() (interface{}, error) {
			return txn.SendProposal(reqCtx, prop, targets)
		},
	)
	if err != nil {
		return nil, fab.EmptyTransactionID, err
	}

	return resp.([]*fab.TransactionProposalResponse), prop.TxnID, nil
}
101491
private function sendInstallationPostRequest($url, array $options = [])
    {
        try {
            return $this->httpClient->request('POST', $url, $options);
        } catch (ClientException $exception) {
            throw new BunqException($exception);
        }
    }
172651
public UpdateAuthorizerRequest withTokenSigningPublicKeys(java.util.Map<String, String> tokenSigningPublicKeys) {
        setTokenSigningPublicKeys(tokenSigningPublicKeys);
        return this;
    }
249270
public Collection<ProposalResponse> sendTransactionProposal(TransactionProposalRequest transactionProposalRequest) throws ProposalException, InvalidArgumentException {

        return sendProposal(transactionProposalRequest, getEndorsingPeers());
    }
814296
public PactDslRequestWithPath headers(String firstHeaderName, String firstHeaderValue, String... headerNameValuePairs) {
        if (headerNameValuePairs.length % 2 != 0) {
            throw new IllegalArgumentException("Pair key value should be provided, but there is one key without value.");
        }
        requestHeaders.put(firstHeaderName, Collections.singletonList(firstHeaderValue));

        for (int i = 0; i < headerNameValuePairs.length; i+=2) {
          requestHeaders.put(headerNameValuePairs[i], Collections.singletonList(headerNameValuePairs[i+1]));
        }

        return this;
    }
1218729
public ChaincodeID getChaincodeID() throws InvalidArgumentException {

        try {

            if (chaincodeID == null) {

                Header header = Header.parseFrom(proposal.getHeader());
                Common.ChannelHeader channelHeader = Common.ChannelHeader.parseFrom(header.getChannelHeader());
                ChaincodeHeaderExtension chaincodeHeaderExtension = ChaincodeHeaderExtension.parseFrom(channelHeader.getExtension());
                chaincodeID = new ChaincodeID(chaincodeHeaderExtension.getChaincodeId());
            }
            return chaincodeID;

        } catch (Exception e) {
            throw new InvalidArgumentException(e);
        }

    }
1079348
public void setBgpPeers(java.util.Collection<BGPPeer> bgpPeers) {
        if (bgpPeers == null) {
            this.bgpPeers = null;
            return;
        }

        this.bgpPeers = new com.amazonaws.internal.SdkInternalList<BGPPeer>(bgpPeers);
    }
1066561
public void setChaincodeCollectionConfiguration(ChaincodeCollectionConfiguration collectionConfigPackage) throws InvalidArgumentException {
        if (null == collectionConfigPackage) {
            throw new InvalidArgumentException("The parameter collectionConfigPackage may not be null.");
        }

        this.collectionConfigPackage = collectionConfigPackage.getCollectionConfigPackage();
    }
289167
private ProposalResponse sendProposalSerially(TransactionRequest proposalRequest, Collection<Peer> peers) throws
            ProposalException {

        ProposalException lastException = new ProposalException("ProposalRequest failed.");

        for (Peer peer : peers) {

            proposalRequest.submitted = false;

            try {

                Collection<ProposalResponse> proposalResponses = sendProposal(proposalRequest, Collections.singletonList(peer));

                if (proposalResponses.isEmpty()) {
                    logger.warn(format("Proposal request to peer %s failed", peer));
                }
                ProposalResponse proposalResponse = proposalResponses.iterator().next();
                ChaincodeResponse.Status status = proposalResponse.getStatus();

                if (status.getStatus() < 400) {
                    return proposalResponse;

                } else if (status.getStatus() > 499) { // server error may work on other peer.

                    lastException = new ProposalException(format("Channel %s got exception on peer %s %d. %s ",
                            name,
                            peer,
                            status.getStatus(),
                            proposalResponse.getMessage()));

                } else { // 400 to 499

                    throw new ProposalException(format("Channel %s got exception on peer %s %d. %s ",
                            name,
                            peer,
                            status.getStatus(),
                            proposalResponse.getMessage()));
                }

            } catch (Exception e) {

                lastException = new ProposalException(format("Channel %s failed proposal on peer %s  %s",
                        name,
                        peer.getName(),

                        e.getMessage()), e);
                logger.warn(lastException.getMessage());
            }

        }

        throw lastException;

    }