public void updateConnection()

in domain/src/main/java/org/apache/rocketmq/eventbridge/domain/model/connection/ConnectionService.java [210:235]


    public void updateConnection(ConnectionDTO connectionDTO, String accountId) {
        if (CollectionUtils.isEmpty(checkConnection(accountId, connectionDTO.getConnectionName()))) {
            throw new EventBridgeException(EventBridgeErrorCode.ConnectionNotExist, connectionDTO.getConnectionName());
        }
        checkNetworkType(connectionDTO.getNetworkParameters());
        ConnectionDTO oldConnection = connectionRepository.getConnectionByNameAccountId(connectionDTO.getConnectionName(), accountId);
        if (connectionDTO.getAuthParameters() == null
                && oldConnection.getAuthParameters() != null
                && StringUtils.isNotBlank(oldConnection.getAuthParameters().getAuthorizationType())) {
            secretManagerAPI.deleteSecretName(secretManagerAPI.getSecretName(accountId, oldConnection.getConnectionName()));
        }
        if (connectionDTO.getAuthParameters() != null) {
            checkAuthParameters(connectionDTO.getAuthParameters());
            connectionDTO.setAuthParameters(updateSecretData(connectionDTO.getAuthParameters(), accountId, connectionDTO.getConnectionName(), oldConnection));
        }

        if (NetworkTypeEnum.PRIVATE_NETWORK.getNetworkType().equals(oldConnection.getNetworkParameters().getNetworkType())) {
            networkServiceAPI.deletePrivateNetwork(connectionDTO.getAccountId(), Integer.toString(oldConnection.getId()));
        }
        if (NetworkTypeEnum.PRIVATE_NETWORK.getNetworkType().equals(connectionDTO.getNetworkParameters().getNetworkType())) {
            NetworkParameters networkParameters = connectionDTO.getNetworkParameters();
            networkServiceAPI.createPrivateNetwork(connectionDTO.getAccountId(), Integer.toString(oldConnection.getId()), networkParameters.getVpcId(), networkParameters.getVswitcheId(), networkParameters.getSecurityGroupId());
        }

        connectionRepository.updateConnection(connectionDTO);
    }