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