O:39:"phpDocumentor\Descriptor\FileDescriptor":20:{s:7:" * hash";s:32:"eb1debde590ba051f5de4f3caa8dc83d";s:9:" * source";s:1732:"<?php

namespace OpenCloud\CloudMonitoring\Resource;

use OpenCloud\Common\PersistentObject;
use OpenCloud\CloudMonitoring\Exception;

/**
 * Agent class.
 * 
 * @extends ReadOnlyResource
 * @implements ResourceInterface
 */
class AgentTarget extends ReadOnlyResource implements ResourceInterface
{
    
    public $type = 'agent.filesystem';
    
    protected static $json_name = 'targets';
    protected static $json_collection_name = 'targets';
    protected static $url_resource = 'targets';

    private $allowedTypes = array(
        'agent.filesystem',
        'agent.memory',
        'agent.load_average',
        'agent.cpu',
        'agent.disk',
        'agent.network',
        'agent.plugin'
    );

    public function baseUrl()
    {
        $resourceUrl = "agent/check_types/{$this->type}/{$this->ResourceName()}";
        return $this->Parent()->Url($this->Parent()->id . '/' . $resourceUrl);
    }

    public function setType($type)
    {
        if (!in_array($type, $this->allowedTypes)) {
            throw new Exception\AgentException(sprintf(
                'Incorrect target type. Please specify one of the following: %s',
                implode(', ', $this->allowedTypes)
            ));
        }

        $this->type = $type;
    }

    public function listAll()
    {
        if (!$this->type) {
            throw new Exception\AgentException(sprintf(
                'Please specify a target type'
            ));
        }

        $response = json_decode($this->Service()->Request($this->Url())->HttpBody());
        
        if (isset($response->{self::$json_collection_name})) {
            $response = $response->{self::$json_collection_name};
        }

        return $response;
    } 
    
}";s:20:" * namespace_aliases";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:11:" * includes";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:12:" * constants";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:12:" * functions";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:10:" * classes";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{s:11:"AgentTarget";O:40:"phpDocumentor\Descriptor\ClassDescriptor":17:{s:9:" * parent";s:52:"\OpenCloud\CloudMonitoring\Resource\ReadOnlyResource";s:13:" * implements";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{s:53:"\OpenCloud\CloudMonitoring\Resource\ResourceInterface";s:53:"\OpenCloud\CloudMonitoring\Resource\ResourceInterface";}}s:11:" * abstract";b:0;s:8:" * final";b:0;s:12:" * constants";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:13:" * properties";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:5:{s:4:"type";O:43:"phpDocumentor\Descriptor\PropertyDescriptor":15:{s:9:" * parent";r:14;s:8:" * types";N;s:10:" * default";s:18:"'agent.filesystem'";s:9:" * static";b:0;s:13:" * visibility";s:6:"public";s:8:" * fqsen";s:53:"\OpenCloud\CloudMonitoring\Resource\AgentTarget::type";s:7:" * name";s:4:"type";s:12:" * namespace";N;s:10:" * package";s:0:"";s:10:" * summary";s:0:"";s:14:" * description";s:0:"";s:7:" * path";s:0:"";s:7:" * line";i:17;s:7:" * tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{s:8:"internal";N;}}s:9:" * errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{i:0;O:40:"phpDocumentor\Descriptor\Validator\Error":4:{s:11:" * severity";s:5:"error";s:7:" * code";s:13:"PPC:ERR-50007";s:7:" * line";i:17;s:10:" * context";a:1:{i:0;s:5:"$type";}}}}}s:9:"json_name";O:43:"phpDocumentor\Descriptor\PropertyDescriptor":15:{s:9:" * parent";r:14;s:8:" * types";N;s:10:" * default";s:9:"'targets'";s:9:" * static";b:1;s:13:" * visibility";s:9:"protected";s:8:" * fqsen";s:58:"\OpenCloud\CloudMonitoring\Resource\AgentTarget::json_name";s:7:" * name";s:9:"json_name";s:12:" * namespace";N;s:10:" * package";s:0:"";s:10:" * summary";s:0:"";s:14:" * description";s:0:"";s:7:" * path";s:0:"";s:7:" * line";i:19;s:7:" * tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{s:8:"internal";N;}}s:9:" * errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{i:0;O:40:"phpDocumentor\Descriptor\Validator\Error":4:{s:11:" * severity";s:5:"error";s:7:" * code";s:13:"PPC:ERR-50007";s:7:" * line";i:19;s:10:" * context";a:1:{i:0;s:10:"$json_name";}}}}}s:20:"json_collection_name";O:43:"phpDocumentor\Descriptor\PropertyDescriptor":15:{s:9:" * parent";r:14;s:8:" * types";N;s:10:" * default";s:9:"'targets'";s:9:" * static";b:1;s:13:" * visibility";s:9:"protected";s:8:" * fqsen";s:69:"\OpenCloud\CloudMonitoring\Resource\AgentTarget::json_collection_name";s:7:" * name";s:20:"json_collection_name";s:12:" * namespace";N;s:10:" * package";s:0:"";s:10:" * summary";s:0:"";s:14:" * description";s:0:"";s:7:" * path";s:0:"";s:7:" * line";i:20;s:7:" * tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{s:8:"internal";N;}}s:9:" * errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{i:0;O:40:"phpDocumentor\Descriptor\Validator\Error":4:{s:11:" * severity";s:5:"error";s:7:" * code";s:13:"PPC:ERR-50007";s:7:" * line";i:20;s:10:" * context";a:1:{i:0;s:21:"$json_collection_name";}}}}}s:12:"url_resource";O:43:"phpDocumentor\Descriptor\PropertyDescriptor":15:{s:9:" * parent";r:14;s:8:" * types";N;s:10:" * default";s:9:"'targets'";s:9:" * static";b:1;s:13:" * visibility";s:9:"protected";s:8:" * fqsen";s:61:"\OpenCloud\CloudMonitoring\Resource\AgentTarget::url_resource";s:7:" * name";s:12:"url_resource";s:12:" * namespace";N;s:10:" * package";s:0:"";s:10:" * summary";s:0:"";s:14:" * description";s:0:"";s:7:" * path";s:0:"";s:7:" * line";i:21;s:7:" * tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{s:8:"internal";N;}}s:9:" * errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{i:0;O:40:"phpDocumentor\Descriptor\Validator\Error":4:{s:11:" * severity";s:5:"error";s:7:" * code";s:13:"PPC:ERR-50007";s:7:" * line";i:21;s:10:" * context";a:1:{i:0;s:13:"$url_resource";}}}}}s:12:"allowedTypes";O:43:"phpDocumentor\Descriptor\PropertyDescriptor":15:{s:9:" * parent";r:14;s:8:" * types";N;s:10:" * default";s:123:"array('agent.filesystem', 'agent.memory', 'agent.load_average', 'agent.cpu', 'agent.disk', 'agent.network', 'agent.plugin')";s:9:" * static";b:0;s:13:" * visibility";s:7:"private";s:8:" * fqsen";s:61:"\OpenCloud\CloudMonitoring\Resource\AgentTarget::allowedTypes";s:7:" * name";s:12:"allowedTypes";s:12:" * namespace";N;s:10:" * package";s:0:"";s:10:" * summary";s:0:"";s:14:" * description";s:0:"";s:7:" * path";s:0:"";s:7:" * line";i:23;s:7:" * tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{s:8:"internal";N;}}s:9:" * errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{i:0;O:40:"phpDocumentor\Descriptor\Validator\Error":4:{s:11:" * severity";s:5:"error";s:7:" * code";s:13:"PPC:ERR-50007";s:7:" * line";i:23;s:10:" * context";a:1:{i:0;s:13:"$allowedTypes";}}}}}}}s:10:" * methods";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:3:{s:7:"baseUrl";O:41:"phpDocumentor\Descriptor\MethodDescriptor":16:{s:9:" * parent";r:14;s:11:" * abstract";b:0;s:8:" * final";b:0;s:9:" * static";b:0;s:13:" * visibility";s:6:"public";s:12:" * arguments";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:8:" * fqsen";s:58:"\OpenCloud\CloudMonitoring\Resource\AgentTarget::baseUrl()";s:7:" * name";s:7:"baseUrl";s:12:" * namespace";N;s:10:" * package";s:0:"";s:10:" * summary";s:0:"";s:14:" * description";s:0:"";s:7:" * path";s:0:"";s:7:" * line";i:33;s:7:" * tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{s:8:"internal";N;}}s:9:" * errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{i:0;O:40:"phpDocumentor\Descriptor\Validator\Error":4:{s:11:" * severity";s:5:"error";s:7:" * code";s:13:"PPC:ERR-50008";s:7:" * line";i:33;s:10:" * context";a:1:{i:0;s:9:"baseUrl()";}}}}}s:7:"setType";O:41:"phpDocumentor\Descriptor\MethodDescriptor":16:{s:9:" * parent";r:14;s:11:" * abstract";b:0;s:8:" * final";b:0;s:9:" * static";b:0;s:13:" * visibility";s:6:"public";s:12:" * arguments";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{s:5:"$type";O:43:"phpDocumentor\Descriptor\ArgumentDescriptor":13:{s:8:" * types";a:0:{}s:10:" * default";N;s:14:" * byReference";b:0;s:8:" * fqsen";s:0:"";s:7:" * name";s:5:"$type";s:12:" * namespace";N;s:10:" * package";N;s:10:" * summary";s:0:"";s:14:" * description";s:0:"";s:7:" * path";s:0:"";s:7:" * line";i:0;s:7:" * tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:9:" * errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}}}}s:8:" * fqsen";s:58:"\OpenCloud\CloudMonitoring\Resource\AgentTarget::setType()";s:7:" * name";s:7:"setType";s:12:" * namespace";N;s:10:" * package";s:0:"";s:10:" * summary";s:0:"";s:14:" * description";s:0:"";s:7:" * path";s:0:"";s:7:" * line";i:39;s:7:" * tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:2:{s:5:"param";a:0:{}s:8:"internal";N;}}s:9:" * errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{i:0;O:40:"phpDocumentor\Descriptor\Validator\Error":4:{s:11:" * severity";s:5:"error";s:7:" * code";s:13:"PPC:ERR-50008";s:7:" * line";i:39;s:10:" * context";a:1:{i:0;s:9:"setType()";}}}}}s:7:"listAll";O:41:"phpDocumentor\Descriptor\MethodDescriptor":16:{s:9:" * parent";r:14;s:11:" * abstract";b:0;s:8:" * final";b:0;s:9:" * static";b:0;s:13:" * visibility";s:6:"public";s:12:" * arguments";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:8:" * fqsen";s:58:"\OpenCloud\CloudMonitoring\Resource\AgentTarget::listAll()";s:7:" * name";s:7:"listAll";s:12:" * namespace";N;s:10:" * package";s:0:"";s:10:" * summary";s:0:"";s:14:" * description";s:0:"";s:7:" * path";s:0:"";s:7:" * line";i:51;s:7:" * tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{s:8:"internal";N;}}s:9:" * errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{i:0;O:40:"phpDocumentor\Descriptor\Validator\Error":4:{s:11:" * severity";s:5:"error";s:7:" * code";s:13:"PPC:ERR-50008";s:7:" * line";i:51;s:10:" * context";a:1:{i:0;s:9:"listAll()";}}}}}}}s:8:" * fqsen";s:47:"\OpenCloud\CloudMonitoring\Resource\AgentTarget";s:7:" * name";s:11:"AgentTarget";s:12:" * namespace";s:35:"\OpenCloud\CloudMonitoring\Resource";s:10:" * package";s:0:"";s:10:" * summary";s:12:"Agent class.";s:14:" * description";s:0:"";s:7:" * path";r:1;s:7:" * line";i:14;s:7:" * tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:2:{s:7:"extends";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{i:0;O:38:"phpDocumentor\Descriptor\TagDescriptor":2:{s:7:" * name";s:7:"extends";s:14:" * description";s:16:"ReadOnlyResource";}}}s:10:"implements";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{i:0;O:38:"phpDocumentor\Descriptor\TagDescriptor":2:{s:7:" * name";s:10:"implements";s:14:" * description";s:17:"ResourceInterface";}}}}}s:9:" * errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}}}}s:13:" * interfaces";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:9:" * traits";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:10:" * markers";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:8:" * fqsen";s:0:"";s:7:" * name";s:15:"AgentTarget.php";s:12:" * namespace";N;s:10:" * package";s:0:"";s:10:" * summary";s:0:"";s:14:" * description";s:0:"";s:7:" * path";s:50:"OpenCloud/CloudMonitoring/Resource/AgentTarget.php";s:7:" * line";i:0;s:7:" * tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:9:" * errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}}