Validate the arguments specified for this Action.

@throws \Teleport\Action\ActionException If required arguments are not specified.
@return bool TRUE if the arguments are valid, FALSE otherwise.
556285
public function validate()
    {
        if (!empty($this->required)) {
            $invalid = array_diff($this->required, array_keys($this->request->args()));
            if (!empty($invalid)) {
                foreach ($invalid as $argKey) {
                    $this->request->addResult("{$argKey} required for this request.");
                }
                throw new ActionException($this, "Required arguments " . implode(', ', $invalid) . " not specified.");
            }
        }
    }
1040557
public boolean isValid() {
        if (name == null) {
            return false;
        }

        if (type == null || !type.isValid()) {
            return false;
        } else if (type == Type.Link) {
            if (url == null) {
                return false;
            }
        }

        // Check actions
        if (this.getActions() != null) {
            for (DesktopAction a : this.getActions()) {
                if (!a.isValid()) {
                    return false;
                }
            }
        }

        // Everything ok
        return true;
    }
900582
public function validate()
    {
        if ($this->isWorkflowDispatch() && null === $this->getWorkflowRunType()) {
            $errMsg = 'workflowRunType not specified';
            throw new Exception\InvalidMetadataException($errMsg);
        }

        if ($this->isFlagRunPrepareData()) {
            if (null === $this->getPrepareDataMethod()) {
                $errMsg = 'prepareDataMethod not specified';
                throw new Exception\InvalidMetadataException($errMsg);
            }
            if (null === $this->getPrepareDataMethod()) {
                $errMsg = 'prepareDataMethod not specified';
                throw new Exception\InvalidMetadataException($errMsg);
            }
        }

        if ($this->getFlagHasConditions()) {
            if (0 === count($this->getConditions())) {
                $errMsg = 'empty conditions';
                throw new Exception\InvalidMetadataException($errMsg);
            }

            foreach ($this->getConditions() as $condition) {
                $condition->validate();
            }
        }
    }
691375
public function validateOptions()
	{
		//override the config
		$this->validator->override($this->suppliedOptions, $this->rules);

		//if the validator failed, throw an exception
		if ($this->validator->fails())
		{
			throw new \InvalidArgumentException("There are problems with your '" . $this->suppliedOptions['action_name'] . "' action in the " .
									$this->config->getOption('name') . " model: " .	implode('. ', $this->validator->messages()->all()));
		}
	}
507259
def validate_action(cls, action):
    
    if action not in cls._VALID_ACTIONS:
      raise ValueError('The supplied action must be one of {valid}, given: {given}'
                       .format(valid=cls._VALID_ACTIONS, given=action))
    return action
259798
protected function validate()
    {
        /** @var Parameter[] $missingItems */
        $missingItems = \array_filter($this->_options + $this->_arguments, function ($item) {
            /* @var Parameter $item */
            return $item->required() && \in_array($this->_values[$item->attributeName()], [null, []]);
        });

        foreach ($missingItems as $item) {
            list($name, $label) = [$item->name(), 'Argument'];
            if ($item instanceof Option) {
                list($name, $label) = [$item->long(), 'Option'];
            }

            throw new RuntimeException(
                \sprintf('%s "%s" is required', $label, $name)
            );
        }
    }
660949
public function init()
    {
        if (!$this->opts->action) {
            return $this->addError("Parameter 'action' is required.");
        } else {
            $actionName = strtolower($this->opts->action) . 'Action';
            if (!method_exists($this, $actionName)) {
                return $this->addError(sprintf("Action '$actionName' doesn't exists in '%s' cli script.", get_class($this)));
            }

            $this->action = $actionName;
        }

        $this->initialized = true;
        return $this;
    }
414575
public function isCallable()
    {
        if (!method_exists($this->controller, $this->action)) {
            return false;
        }

        $reflection = new \ReflectionMethod($this->controller, $this->action);
        if (!$reflection->isPublic()) {
            return false;
        }

        return true;
    }
652300
@Override
  public ActionRequestValidationException validate() {
    ActionRequestValidationException validationException = super.validate();
    if (termsEncoding != null && termsEncoding.equals(TermsEncoding.BYTES)) {
      if (maxTermsPerShard == null) {
        validationException = ValidateActions.addValidationError("maxTermsPerShard not specified for terms encoding [bytes]", validationException);
      }
    }
    return validationException;
  }
435419
public function validate(): void
    {
        $required = [
            'app_root',
            'app_name',
            'default_filesystem',
            'environment',
            'default_branch',
            'default_database_adapter',
            'default_database_importexport_adapter',
            'default_dir_mode',
            'default_file_mode',
            'platform',
            'relative_document_root',
            'repo_url',
        ];
        $missingRequired = [];
        foreach ($required as $name) {
            if (empty($this->config[$name])) {
                $missingRequired[] = $name;
            }
        }
        if ($missingRequired) {
            throw new Exception\RuntimeException(
                'Missing required values for top level configuration key(s): "' . implode('", "', $missingRequired)
                . '"'
            );
        }

        if (!in_array(
            $this->config['file_layout'],
            [
                FileLayoutInterface::STRATEGY_BLUE_GREEN,
                FileLayoutInterface::STRATEGY_DEFAULT
            ]
        )) {
            throw new Exception\DomainException("Invalid file layout \"{$this->config['file_layout']}\".");
        }

        $this->buildConfig->validate();
        $this->deployConfig->validate();
        $this->snapshotConfig->validate();
        $this->skeletonConfig->validate();
    }
987378
public function validate()
    {
        if ($this->binary === false) {
            throw new CommandException("Command not found.");
        }

        if (!is_executable($this->binary)) {
            throw new CommandException("$this not executable.");
        }

        $nargs = false;
        foreach ($this->options as $option => $value) {
            if (is_array($value)) {
                if ($nargs) {
                    throw new CommandException("Multiple nargs detected.");
                }

                $nargs = true;
            }
        }
    }
768022
protected function validateArgs(): void
    {
        if (! $this->rules) {
            return;
        }

        $validator = validator(
            $this->args,
            $this->rules,
            $this->messages,
            [
                'root' => $this->root,
                'context' => $this->context,
                // This makes it so that we get an instance of our own Validator class
                'resolveInfo' => $this->resolveInfo,
            ]
        );

        if ($validator->fails()) {
            foreach ($validator->errors()->getMessages() as $key => $errorMessages) {
                foreach ($errorMessages as $errorMessage) {
                    $this->validationErrorBuffer->push($errorMessage, $key);
                }
            }
        }

        $path = implode(
            '.',
            $this->resolveInfo()->path
        );
        $this->validationErrorBuffer->flush(
            "Validation failed for the field [$path]."
        );

        // reset rules and messages
        $this->rules = [];
        $this->messages = [];
    }
1154051
public function validate() {

		if ($this->getExternalId() === null) {
			throw new ValidationException("'externalId' can't be null", 'externalId', $this);
		}
		if ($this->getLineItems() === null) {
			throw new ValidationException("'lineItems' can't be null", 'lineItems', $this);
		}
	}
834439
public function valid()
    {

        if ($this->container['loggedAt'] === null) {
            return false;
        }
        if ($this->container['containerId'] === null) {
            return false;
        }
        if ($this->container['containerTypeId'] === null) {
            return false;
        }
        if ($this->container['characterId'] === null) {
            return false;
        }
        if ($this->container['locationId'] === null) {
            return false;
        }
        if ($this->container['locationFlag'] === null) {
            return false;
        }
        $allowedValues = $this->getLocationFlagAllowableValues();
        if (!in_array($this->container['locationFlag'], $allowedValues)) {
            return false;
        }
        if ($this->container['action'] === null) {
            return false;
        }
        $allowedValues = $this->getActionAllowableValues();
        if (!in_array($this->container['action'], $allowedValues)) {
            return false;
        }
        $allowedValues = $this->getPasswordTypeAllowableValues();
        if (!in_array($this->container['passwordType'], $allowedValues)) {
            return false;
        }
        return true;
    }
979370
public function validateImplementation()
	{
		$required = [
			'model'         => ' does not implement a model definition.',
			'resource_path' => ' does not implement a resource path definition.',
		];

		foreach ($required as $implementation => $message) {
			if (! isset($this->{$implementation})) {
				throw new \InvalidArgumentException(static::class . $message);
			}
		}
	}
41723
public function validate(): bool
    {
        foreach ($this as $element) {
            if ($element instanceof HasValueValidationInterface) {
                $element->validate();
            }
        }
        return $this->errors()->empty();
    }
613883
protected function validateRun()
    {
        $status = $this->process->getExitCode();
        $error  = $this->process->getErrorOutput();

        if ($status !== 0 and $error !== '') {
            throw new \RuntimeException(
                sprintf(
                    "The exit status code %s says something went wrong:\n stderr: %s\n stdout: %s\ncommand: %s.",
                    $status,
                    $error,
                    $this->process->getOutput(),
                    $this->command
                )
            );
        }
    }