validateEntity() public method

See also: ScalingRuleAdapter::validateEntity()
public validateEntity ( $entity )
 /**
  * {@inheritdoc}
  * @see BasicScalingRuleAdapter::validateEntity()
  */
 public function validateEntity($entity)
 {
     parent::validateEntity($entity);
     $this->validateNumericSetting($entity->settings, FarmRoleScalingMetric::PERIOD);
     if (!in_array($entity->settings[FarmRoleScalingMetric::PERIOD], static::$calculatingPeriod)) {
         throw new ApiErrorException(400, ErrorMessage::ERR_INVALID_VALUE, sprintf('Property calculatingPeriod is invalid. Allowed periods are %s', implode(', ', static::$calculatingPeriod)));
     }
 }
 /**
  * {@inheritdoc}
  * @see BasicScalingRuleAdapter::validateEntity()
  */
 public function validateEntity($entity)
 {
     parent::validateEntity($entity);
     if (empty($entity->settings[FarmRoleScalingMetric::URL])) {
         throw new ApiErrorException(400, ErrorMessage::ERR_INVALID_STRUCTURE, 'Missed property url');
     }
     if (!filter_var($entity->settings[FarmRoleScalingMetric::URL], FILTER_VALIDATE_URL)) {
         throw new ApiErrorException(400, ErrorMessage::ERR_INVALID_VALUE, 'Property url is invalid');
     }
 }
 /**
  * {@inheritdoc}
  * @see BasicScalingRuleAdapter::validateEntity()
  */
 public function validateEntity($entity)
 {
     parent::validateEntity($entity);
     if (empty($entity->settings[FarmRoleScalingMetric::QUEUE_NAME])) {
         throw new ApiErrorException(400, ErrorMessage::ERR_INVALID_STRUCTURE, 'Missed property queue');
     }
     if (!is_string($entity->settings[FarmRoleScalingMetric::QUEUE_NAME])) {
         throw new ApiErrorException(400, ErrorMessage::ERR_INVALID_VALUE, 'Unexpected queue value');
     }
 }
 /**
  * {@inheritdoc}
  * @see BasicScalingRuleAdapter::validateEntity()
  */
 public function validateEntity($entity)
 {
     parent::validateEntity($entity);
     $direction = $entity->settings[FarmRoleScalingMetric::TYPE];
     if (empty($direction)) {
         throw new ApiErrorException(400, ErrorMessage::ERR_INVALID_STRUCTURE, 'Missed property direction');
     }
     if (!in_array($direction, static::$directions)) {
         throw new ApiErrorException(400, ErrorMessage::ERR_INVALID_VALUE, sprintf('Invalid value. The allowed direction values are %s', implode(' or ', static::$directions)));
     }
 }