Blame view

sources/3rdparty/rackspace/php-opencloud/lib/OpenCloud/DNS/Resource/AsyncResponse.php 2.03 KB
6d9380f96   Cédric Dupont   Update sources OC...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
  <?php
  /**
   * PHP OpenCloud library.
   * 
   * @copyright 2014 Rackspace Hosting, Inc. See LICENSE for information.
   * @license   https://www.apache.org/licenses/LICENSE-2.0
   * @author    Glen Campbell <glen.campbell@rackspace.com>
   * @author    Jamie Hannaford <jamie.hannaford@rackspace.com>
   */
  
  namespace OpenCloud\DNS\Resource;
  
  use Guzzle\Http\Url;
  use OpenCloud\Common\PersistentObject;
  use OpenCloud\Common\Service\ServiceInterface;
  
  /**
   * The AsyncResponse class encapsulates the data returned by a Cloud DNS
   * asynchronous response.
   */
  class AsyncResponse extends PersistentObject
  {
  
      public $jobId;
      public $callbackUrl;
      public $status;
      public $requestUrl;
      public $verb;
      public $request;
      public $response;
      public $error;
      public $domains;
  
      protected static $json_name = false;
  
      /**
       * constructs a new AsyncResponse object from a JSON
       * string
       *
       * @param \OpenCloud\Service $service the calling service
       * @param string $json the json response from the initial request
       */
      public function __construct(ServiceInterface $service, $object = null)
      {
          if (!$object) {
              return;
          }
  
          parent::__construct($service, $object);
      }
  
      /**
       * URL for status
       *
       * We always show details
       *
       * @return string
       */
      public function getUrl($path = null, array $query = array())
      {
          return Url::factory($this->callbackUrl)
              ->setQuery(array('showDetails' => 'True'));
      }
  
      /**
       * returns the Name of the request (the job ID)
       *
       * @return string
       */
      public function name()
      {
          return $this->jobId;
      }
  
      /**
       * overrides for methods
       */
      public function create($params = array())
      {
          return $this->noCreate();
      }
  
      public function update($params = array())
      {
          return $this->noUpdate();
      }
  
      public function delete()
      {
          return $this->noDelete();
      }
  
      public function primaryKeyField()
      {
          return 'jobId';
      }
  
  }