/**
  * Populate an instance of vcenter with the provided vcenter parameter
  *
  * @param vcenter the vcenter to be populated
  * @param param the parameter that contains the attributes.
  */
 protected void populateVcenterData(Vcenter vcenter, VcenterParam param) {
   vcenter.setLabel(param.getName());
   vcenter.setOsVersion(param.getOsVersion());
   vcenter.setUsername(param.getUserName());
   vcenter.setPassword(param.getPassword());
   vcenter.setIpAddress(param.findIpAddress());
   vcenter.setPortNumber(param.getPortNumber());
   vcenter.setUseSSL(param.getUseSsl());
 }
  /**
   * Validates the create/update vCenter input data
   *
   * @param param the input parameter
   * @param vcenter the vcenter being updated in case of update operation. This parameter must be
   *     null for create operations.
   */
  protected void validateVcenter(VcenterParam param, Vcenter vcenter, Boolean validateConnection) {
    if (vcenter == null
        || (param.findIpAddress() != null
            && !param.findIpAddress().equals(vcenter.getIpAddress()))) {
      checkDuplicateAltId(Vcenter.class, "ipAddress", param.findIpAddress(), "vcenter");
    }
    if (vcenter == null
        || (param.getName() != null && !param.getName().equals(vcenter.getLabel()))) {
      checkDuplicateLabel(Vcenter.class, param.getName(), "vcenter");
    }
    validateVcenterCredentials(param, vcenter);

    if (validateConnection != null && validateConnection == true) {
      String errorMessage = VCenterConnectionValidator.isVCenterConnectionValid(param);
      if (StringUtils.isNotBlank(errorMessage)) {
        throw APIException.badRequests.invalidVCenterConnection(errorMessage);
      }
    }
  }