~tcuthbert/wordpress/openstack-objectstorage

« back to all changes in this revision

Viewing changes to src/OpenStack/Common/Transport/ClientInterface.php

  • Committer: Jacek Nykis
  • Date: 2015-02-11 15:35:31 UTC
  • Revision ID: jacek.nykis@canonical.com-20150211153531-hmy6zi0ov2qfkl0b
Initial commit

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
 
 
3
/*
 
4
 * (c) Copyright 2012-2014 Hewlett-Packard Development Company, L.P.
 
5
 * (c) Copyright 2014      Rackspace US, Inc.
 
6
 *
 
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
 
10
 *
 
11
 *      http://www.apache.org/licenses/LICENSE-2.0
 
12
 *
 
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
 
17
 * under the License.
 
18
 */
 
19
 
 
20
namespace OpenStack\Common\Transport;
 
21
 
 
22
/**
 
23
 * Describes a transport client.
 
24
 *
 
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.
 
28
 *
 
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
 
33
 */
 
34
interface ClientInterface
 
35
{
 
36
    /**
 
37
     * Create a new Request object. To send, use the {see send()} method.
 
38
     *
 
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
 
43
     *
 
44
     * @return \OpenStack\Common\Transport\RequestInterface
 
45
     */
 
46
    public function createRequest($method,
 
47
                                  $uri = null,
 
48
                                  $body = null,
 
49
                                  array $options = []);
 
50
 
 
51
    /**
 
52
     * Sends a request.
 
53
     *
 
54
     * @param \OpenStack\Common\Transport\RequestInterface $request Request to execute
 
55
     *
 
56
     * @return \OpenStack\Common\Transport\ResponseInterface
 
57
     */
 
58
    public function send(RequestInterface $request);
 
59
 
 
60
    /**
 
61
     * Execute a GET request.
 
62
     *
 
63
     * @param string|array|\OpenStack\Common\Transport\Url $uri     URL the request will send to
 
64
     * @param array                                        $options Configuration options, such as headers
 
65
     *
 
66
     * @return \OpenStack\Common\Transport\ResponseInterface
 
67
     */
 
68
    public function get($uri, array $options = []);
 
69
 
 
70
    /**
 
71
     * Execute a HEAD request.
 
72
     *
 
73
     * @param string|array|\OpenStack\Common\Transport\Url $uri     URL the request will send to
 
74
     * @param array                                        $options Configuration options, such as headers
 
75
     *
 
76
     * @return \OpenStack\Common\Transport\ResponseInterface
 
77
     */
 
78
    public function head($uri, array $options = []);
 
79
 
 
80
    /**
 
81
     * Execute a POST request.
 
82
     *
 
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
 
86
     *
 
87
     * @return \OpenStack\Common\Transport\ResponseInterface
 
88
     */
 
89
    public function post($uri, $body, array $options = []);
 
90
 
 
91
    /**
 
92
     * Execute a PUT request.
 
93
     *
 
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
 
97
     *
 
98
     * @return \OpenStack\Common\Transport\ResponseInterface
 
99
     */
 
100
    public function put($uri, $body, array $options = []);
 
101
 
 
102
    /**
 
103
     * Execute a DELETE request.
 
104
     *
 
105
     * @param string|array|\OpenStack\Common\Transport\Url $uri     URL the request will send to
 
106
     * @param array                                        $options Configuration options, such as headers
 
107
     *
 
108
     * @return \OpenStack\Common\Transport\ResponseInterface
 
109
     */
 
110
    public function delete($uri, array $options = []);
 
111
 
 
112
    /**
 
113
     * Sets a particular configuration option, depending on how the client
 
114
     * implements it. It could, for example, alter cURL configuration or a
 
115
     * default header.
 
116
     *
 
117
     * @param string $key   The key being updated
 
118
     * @param mixed  $value The value being set
 
119
     */
 
120
    public function setOption($key, $value);
 
121
 
 
122
    /**
 
123
     * Returns the value of a particular configuration option. If the options
 
124
     * is not set, NULL is returned.
 
125
     *
 
126
     * @param string $key The option name
 
127
     *
 
128
     * @return mixed|null
 
129
     */
 
130
    public function getOption($key);
 
131
 
 
132
    /**
 
133
     * Returns the base URL that the client points towards.
 
134
     *
 
135
     * @return string
 
136
     */
 
137
    public function getBaseUrl();
 
138
}
 
 
b'\\ No newline at end of file'