4
* (c) Copyright 2012-2014 Hewlett-Packard Development Company, L.P.
5
* (c) Copyright 2014 Rackspace US, Inc.
7
* Licensed under the Apache License, Version 2.0 (the "License"); you may
8
* not use this file except in compliance with the License. You may obtain
9
* a copy of the License at
11
* http://www.apache.org/licenses/LICENSE-2.0
13
* Unless required by applicable law or agreed to in writing, software
14
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
15
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
16
* License for the specific language governing permissions and limitations
20
namespace OpenStack\Common\Transport;
23
* Describes a transport client.
25
* Transport clients are responsible for moving data from the remote cloud to
26
* the local host. Transport clients are responsible only for the transport
27
* protocol, not for the payloads.
29
* The current OpenStack services implementation is oriented toward
30
* REST-based services, and consequently the transport layers are
31
* HTTP/HTTPS, and perhaps SPDY some day. The interface reflects this.
32
* it is not designed as a protocol-neutral transport layer
34
interface ClientInterface
37
* Create a new Request object. To send, use the {see send()} method.
39
* @param string $method HTTP method
40
* @param string|array|\OpenStack\Common\Transport\Url $uri URL the request will send to
41
* @param string|resource $body Entity body being sent
42
* @param array $options Configuration options, such as headers
44
* @return \OpenStack\Common\Transport\RequestInterface
46
public function createRequest($method,
54
* @param \OpenStack\Common\Transport\RequestInterface $request Request to execute
56
* @return \OpenStack\Common\Transport\ResponseInterface
58
public function send(RequestInterface $request);
61
* Execute a GET request.
63
* @param string|array|\OpenStack\Common\Transport\Url $uri URL the request will send to
64
* @param array $options Configuration options, such as headers
66
* @return \OpenStack\Common\Transport\ResponseInterface
68
public function get($uri, array $options = []);
71
* Execute a HEAD request.
73
* @param string|array|\OpenStack\Common\Transport\Url $uri URL the request will send to
74
* @param array $options Configuration options, such as headers
76
* @return \OpenStack\Common\Transport\ResponseInterface
78
public function head($uri, array $options = []);
81
* Execute a POST request.
83
* @param string|array|\OpenStack\Common\Transport\Url $uri URL the request will send to
84
* @param mixed $body Entity body being sent
85
* @param array $options Configuration options, such as headers
87
* @return \OpenStack\Common\Transport\ResponseInterface
89
public function post($uri, $body, array $options = []);
92
* Execute a PUT request.
94
* @param string|array|\OpenStack\Common\Transport\Url $uri URL the request will send to
95
* @param mixed $body Entity body being sent
96
* @param array $options Configuration options, such as headers
98
* @return \OpenStack\Common\Transport\ResponseInterface
100
public function put($uri, $body, array $options = []);
103
* Execute a DELETE request.
105
* @param string|array|\OpenStack\Common\Transport\Url $uri URL the request will send to
106
* @param array $options Configuration options, such as headers
108
* @return \OpenStack\Common\Transport\ResponseInterface
110
public function delete($uri, array $options = []);
113
* Sets a particular configuration option, depending on how the client
114
* implements it. It could, for example, alter cURL configuration or a
117
* @param string $key The key being updated
118
* @param mixed $value The value being set
120
public function setOption($key, $value);
123
* Returns the value of a particular configuration option. If the options
124
* is not set, NULL is returned.
126
* @param string $key The option name
130
public function getOption($key);
133
* Returns the base URL that the client points towards.
137
public function getBaseUrl();
b'\\ No newline at end of file'