VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/Firmware/RedfishPkg/Include/Library/RedfishHttpLib.h

Last change on this file was 105670, checked in by vboxsync, 9 months ago

Devices/EFI/FirmwareNew: Merge edk2-stable-202405 and make it build on aarch64, bugref:4643

  • Property svn:eol-style set to native
File size: 10.6 KB
Line 
1/** @file
2 This file defines the Redfish HTTP library interface.
3
4 Copyright (c) 2023-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
5
6 SPDX-License-Identifier: BSD-2-Clause-Patent
7
8**/
9
10#ifndef REDFISH_HTTP_LIB_H_
11#define REDFISH_HTTP_LIB_H_
12
13#include <Protocol/EdkIIRedfishHttpProtocol.h>
14
15/**
16 This function create Redfish service. It's caller's responsibility to free returned
17 Redfish service by calling FreeService ().
18
19 @param[in] RedfishConfigServiceInfo Redfish config service information.
20
21 @retval REDFISH_SERVICE Redfish service is created.
22 @retval NULL Errors occur.
23
24**/
25REDFISH_SERVICE
26RedfishCreateService (
27 IN REDFISH_CONFIG_SERVICE_INFORMATION *RedfishConfigServiceInfo
28 );
29
30/**
31 This function free resources in Redfish service. RedfishService is no longer available
32 after this function returns successfully.
33
34 @param[in] RedfishService Pointer to Redfish service to be released.
35
36 @retval EFI_SUCCESS Resource is released successfully.
37 @retval Others Errors occur.
38
39**/
40EFI_STATUS
41RedfishCleanupService (
42 IN REDFISH_SERVICE RedfishService
43 );
44
45/**
46 This function returns JSON value in given RedfishPayload. Returned JSON value
47 is a reference to the JSON value in RedfishPayload. Any modification to returned
48 JSON value will change JSON value in RedfishPayload.
49
50 @param[in] RedfishPayload Pointer to Redfish payload.
51
52 @retval EDKII_JSON_VALUE JSON value is returned.
53 @retval NULL Errors occur.
54
55**/
56EDKII_JSON_VALUE
57RedfishJsonInPayload (
58 IN REDFISH_PAYLOAD RedfishPayload
59 );
60
61/**
62 This function free resources in Request. Request is no longer available
63 after this function returns successfully.
64
65 @param[in] Request HTTP request to be released.
66
67 @retval EFI_SUCCESS Resource is released successfully.
68 @retval Others Errors occur.
69
70**/
71EFI_STATUS
72RedfishHttpFreeRequest (
73 IN REDFISH_REQUEST *Request
74 );
75
76/**
77 This function free resources in Response. Response is no longer available
78 after this function returns successfully.
79
80 @param[in] Response HTTP response to be released.
81
82 @retval EFI_SUCCESS Resource is released successfully.
83 @retval Others Errors occur.
84
85**/
86EFI_STATUS
87RedfishHttpFreeResponse (
88 IN REDFISH_RESPONSE *Response
89 );
90
91/**
92 This function expire the cached response of given URI.
93
94 @param[in] Uri Target response of URI.
95
96 @retval EFI_SUCCESS Target response is expired successfully.
97 @retval Others Errors occur.
98
99**/
100EFI_STATUS
101RedfishHttpExpireResponse (
102 IN EFI_STRING Uri
103 );
104
105/**
106 Get redfish resource from given resource URI with cache mechanism
107 supported. It's caller's responsibility to Response by calling
108 RedfishHttpFreeResponse ().
109
110 @param[in] Service Redfish service instance to perform HTTP GET.
111 @param[in] Uri Target resource URI.
112 @param[in] Request Additional request context. This is optional.
113 @param[out] Response HTTP response from redfish service.
114 @param[in] UseCache If it is TRUE, this function will search for
115 cache first. If it is FALSE, this function
116 will query Redfish URI directly.
117
118 @retval EFI_SUCCESS Resource is returned successfully.
119 @retval Others Errors occur.
120
121**/
122EFI_STATUS
123RedfishHttpGetResource (
124 IN REDFISH_SERVICE Service,
125 IN EFI_STRING Uri,
126 IN REDFISH_REQUEST *Request OPTIONAL,
127 OUT REDFISH_RESPONSE *Response,
128 IN BOOLEAN UseCache
129 );
130
131/**
132 Perform HTTP PATCH to send redfish resource to given resource URI.
133 It's caller's responsibility to free Response by calling RedfishHttpFreeResponse ().
134
135 @param[in] Service Redfish service instance to perform HTTP PATCH.
136 @param[in] Uri Target resource URI.
137 @param[in] Content Data to patch.
138 @param[out] Response HTTP response from redfish service.
139
140 @retval EFI_SUCCESS Resource is returned successfully.
141 @retval Others Errors occur.
142
143**/
144EFI_STATUS
145RedfishHttpPatchResource (
146 IN REDFISH_SERVICE Service,
147 IN EFI_STRING Uri,
148 IN CHAR8 *Content,
149 OUT REDFISH_RESPONSE *Response
150 );
151
152/**
153 Perform HTTP PATCH to send redfish resource to given resource URI.
154 It's caller's responsibility to free Response by calling RedfishHttpFreeResponse ().
155
156 @param[in] Service Redfish service instance to perform HTTP PATCH.
157 @param[in] Uri Target resource URI.
158 @param[in] Content Data to patch.
159 @param[in] ContentSize Size of the Content to be send to Redfish service.
160 This is optional. When ContentSize is 0, ContentSize
161 is the size of Content.
162 @param[in] ContentType Type of the Content to be send to Redfish service.
163 This is optional.
164 @param[out] Response HTTP response from redfish service.
165
166 @retval EFI_SUCCESS Resource is returned successfully.
167 @retval Others Errors occur.
168
169**/
170EFI_STATUS
171RedfishHttpPatchResourceEx (
172 IN REDFISH_SERVICE Service,
173 IN EFI_STRING Uri,
174 IN CHAR8 *Content,
175 IN UINTN ContentSize OPTIONAL,
176 IN CHAR8 *ContentType OPTIONAL,
177 OUT REDFISH_RESPONSE *Response
178 );
179
180/**
181 Perform HTTP PUT to send redfish resource to given resource URI.
182 It's caller's responsibility to free Response by calling RedfishHttpFreeResponse ().
183
184 @param[in] Service Redfish service instance to perform HTTP PUT.
185 @param[in] Uri Target resource URI.
186 @param[in] Content Data to put.
187 @param[out] Response HTTP response from redfish service.
188
189 @retval EFI_SUCCESS Resource is returned successfully.
190 @retval Others Errors occur.
191
192**/
193EFI_STATUS
194RedfishHttpPutResource (
195 IN REDFISH_SERVICE Service,
196 IN EFI_STRING Uri,
197 IN CHAR8 *Content,
198 OUT REDFISH_RESPONSE *Response
199 );
200
201/**
202 Perform HTTP PUT to send redfish resource to given resource URI.
203 It's caller's responsibility to free Response by calling RedfishHttpFreeResponse ().
204
205 @param[in] Service Redfish service instance to perform HTTP PUT.
206 @param[in] Uri Target resource URI.
207 @param[in] Content Data to put.
208 @param[in] ContentSize Size of the Content to be send to Redfish service.
209 This is optional. When ContentSize is 0, ContentSize
210 is the size of Content.
211 @param[in] ContentType Type of the Content to be send to Redfish service.
212 This is optional.
213 @param[out] Response HTTP response from redfish service.
214
215 @retval EFI_SUCCESS Resource is returned successfully.
216 @retval Others Errors occur.
217
218**/
219EFI_STATUS
220RedfishHttpPutResourceEx (
221 IN REDFISH_SERVICE Service,
222 IN EFI_STRING Uri,
223 IN CHAR8 *Content,
224 IN UINTN ContentSize OPTIONAL,
225 IN CHAR8 *ContentType OPTIONAL,
226 OUT REDFISH_RESPONSE *Response
227 );
228
229/**
230 Perform HTTP POST to send redfish resource to given resource URI.
231 It's caller's responsibility to free Response by calling RedfishHttpFreeResponse ().
232
233 @param[in] Service Redfish service instance to perform HTTP POST.
234 @param[in] Uri Target resource URI.
235 @param[in] Content Data to post.
236 @param[out] Response HTTP response from redfish service.
237
238 @retval EFI_SUCCESS Resource is returned successfully.
239 @retval Others Errors occur.
240
241**/
242EFI_STATUS
243RedfishHttpPostResource (
244 IN REDFISH_SERVICE Service,
245 IN EFI_STRING Uri,
246 IN CHAR8 *Content,
247 OUT REDFISH_RESPONSE *Response
248 );
249
250/**
251 Perform HTTP POST to send redfish resource to given resource URI.
252 It's caller's responsibility to free Response by calling RedfishHttpFreeResponse ().
253
254 @param[in] Service Redfish service instance to perform HTTP POST.
255 @param[in] Uri Target resource URI.
256 @param[in] Content Data to post.
257 @param[in] ContentSize Size of the Content to be send to Redfish service.
258 This is optional. When ContentSize is 0, ContentSize
259 is the size of Content.
260 @param[in] ContentType Type of the Content to be send to Redfish service.
261 This is optional.
262 @param[out] Response HTTP response from redfish service.
263
264 @retval EFI_SUCCESS Resource is returned successfully.
265 @retval Others Errors occur.
266
267**/
268EFI_STATUS
269RedfishHttpPostResourceEx (
270 IN REDFISH_SERVICE Service,
271 IN EFI_STRING Uri,
272 IN CHAR8 *Content,
273 IN UINTN ContentSize OPTIONAL,
274 IN CHAR8 *ContentType OPTIONAL,
275 OUT REDFISH_RESPONSE *Response
276 );
277
278/**
279 Perform HTTP DELETE to delete redfish resource on given resource URI.
280 It's caller's responsibility to free Response by calling RedfishHttpFreeResponse ().
281
282 @param[in] Service Redfish service instance to perform HTTP DELETE.
283 @param[in] Uri Target resource URI.
284 @param[out] Response HTTP response from redfish service.
285
286 @retval EFI_SUCCESS Resource is returned successfully.
287 @retval Others Errors occur.
288
289**/
290EFI_STATUS
291RedfishHttpDeleteResource (
292 IN REDFISH_SERVICE Service,
293 IN EFI_STRING Uri,
294 OUT REDFISH_RESPONSE *Response
295 );
296
297/**
298 Perform HTTP DELETE to delete redfish resource on given resource URI.
299 It's caller's responsibility to free Response by calling RedfishHttpFreeResponse ().
300
301 @param[in] Service Redfish service instance to perform HTTP DELETE.
302 @param[in] Uri Target resource URI.
303 @param[in] Content JSON represented properties to be deleted. This is
304 optional.
305 @param[in] ContentSize Size of the Content to be send to Redfish service.
306 This is optional. When ContentSize is 0, ContentSize
307 is the size of Content if Content is not NULL.
308 @param[in] ContentType Type of the Content to be send to Redfish service.
309 This is optional.
310 @param[out] Response HTTP response from redfish service.
311
312 @retval EFI_SUCCESS Resource is returned successfully.
313 @retval Others Errors occur.
314
315**/
316EFI_STATUS
317RedfishHttpDeleteResourceEx (
318 IN REDFISH_SERVICE Service,
319 IN EFI_STRING Uri,
320 IN CHAR8 *Content OPTIONAL,
321 IN UINTN ContentSize OPTIONAL,
322 IN CHAR8 *ContentType OPTIONAL,
323 OUT REDFISH_RESPONSE *Response
324 );
325
326#endif
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette