TianoCore EDK2 master
|
#include <RedfishServiceData.h>
#include <Library/JsonLib.h>
#include <Protocol/Http.h>
#include <Protocol/EdkIIRedfishConfigHandler.h>
Go to the source code of this file.
Data Structures | |
struct | REDFISH_ODATA_TYPE_MAPPING |
Macros | |
#define | ODATA_TYPE_NAME_MAX_SIZE 128 |
#define | ODATA_TYPE_MAX_SIZE 128 |
Functions | |
REDFISH_SERVICE EFIAPI | RedfishCreateService (IN REDFISH_CONFIG_SERVICE_INFORMATION *RedfishConfigServiceInfo) |
VOID EFIAPI | RedfishCleanupService (IN REDFISH_SERVICE RedfishService) |
REDFISH_PAYLOAD EFIAPI | RedfishCreatePayload (IN EDKII_JSON_VALUE Value, IN REDFISH_SERVICE RedfishService) |
VOID EFIAPI | RedfishCleanupPayload (IN REDFISH_PAYLOAD Payload) |
EDKII_JSON_VALUE EFIAPI | RedfishJsonInPayload (IN REDFISH_PAYLOAD Payload) |
REDFISH_SERVICE EFIAPI | RedfishServiceInPayload (IN REDFISH_PAYLOAD Payload) |
CHAR8 *EFIAPI | RedfishBuildPathWithSystemUuid (IN CONST CHAR8 *RedPath, IN BOOLEAN FromSmbios, IN CHAR8 *IdString OPTIONAL) |
EFI_STATUS EFIAPI | RedfishGetByService (IN REDFISH_SERVICE RedfishService, IN CONST CHAR8 *RedPath, OUT REDFISH_RESPONSE *RedResponse) |
EFI_STATUS EFIAPI | RedfishGetByUri (IN REDFISH_SERVICE RedfishService, IN CONST CHAR8 *Uri, OUT REDFISH_RESPONSE *RedResponse) |
EFI_STATUS EFIAPI | RedfishGetByPayload (IN REDFISH_PAYLOAD Payload, IN CONST CHAR8 *RedPath, OUT REDFISH_RESPONSE *RedResponse) |
EFI_STATUS EFIAPI | RedfishPatchToUri (IN REDFISH_SERVICE RedfishService, IN CONST CHAR8 *Uri, IN CONST CHAR8 *Content, OUT REDFISH_RESPONSE *RedResponse) |
EFI_STATUS EFIAPI | RedfishPatchToPayload (IN REDFISH_PAYLOAD Target, IN REDFISH_PAYLOAD Payload, OUT REDFISH_RESPONSE *RedResponse) |
EFI_STATUS EFIAPI | RedfishPostToUri (IN REDFISH_SERVICE RedfishService, IN CONST CHAR8 *Uri, IN CONST CHAR8 *Content, IN UINTN ContentSize OPTIONAL, IN CONST CHAR8 *ContentType OPTIONAL, OUT REDFISH_RESPONSE *RedResponse) |
EFI_STATUS EFIAPI | RedfishPostToPayload (IN REDFISH_PAYLOAD Target, IN REDFISH_PAYLOAD Payload, OUT REDFISH_RESPONSE *RedResponse) |
EFI_STATUS EFIAPI | RedfishDeleteByUri (IN REDFISH_SERVICE RedfishService, IN CONST CHAR8 *Uri, OUT REDFISH_RESPONSE *RedResponse) |
EFI_STATUS EFIAPI | RedfishDeleteByUriEx (IN REDFISH_SERVICE RedfishService, IN CONST CHAR8 *Uri, IN CONST CHAR8 *Content, OUT REDFISH_RESPONSE *RedResponse) |
EFI_STATUS EFIAPI | RedfishPutToUri (IN REDFISH_SERVICE RedfishService, IN CONST CHAR8 *Uri, IN CONST CHAR8 *Content, IN UINTN ContentSize OPTIONAL, IN CONST CHAR8 *ContentType OPTIONAL, OUT REDFISH_RESPONSE *RedResponse) |
VOID | RedfishDumpJsonStringFractions (IN CHAR8 *String) |
VOID | RedfishDumpPayload (IN REDFISH_PAYLOAD Payload) |
VOID | RedfishDumpJson (IN EDKII_JSON_VALUE JsonValue) |
VOID | RedfishFreeResponse (IN EFI_HTTP_STATUS_CODE *StatusCode, IN UINTN HeaderCount, IN EFI_HTTP_HEADER *Headers, IN REDFISH_PAYLOAD Payload) |
BOOLEAN | RedfishIsValidOdataType (IN REDFISH_PAYLOAD Payload, IN CONST CHAR8 *OdataTypeName, IN REDFISH_ODATA_TYPE_MAPPING *OdataTypeMappingList, IN UINTN OdataTypeMappingListSize) |
BOOLEAN | RedfishIsPayloadCollection (IN REDFISH_PAYLOAD Payload) |
EFI_STATUS | RedfishGetCollectionSize (IN REDFISH_PAYLOAD Payload, IN UINTN *CollectionSize) |
REDFISH_PAYLOAD | RedfishGetPayloadByIndex (IN REDFISH_PAYLOAD Payload, IN UINTN Index) |
EFI_STATUS | RedfishCheckIfRedpathExist (IN REDFISH_SERVICE RedfishService, IN CHAR8 *Redpath, IN REDFISH_RESPONSE *Response OPTIONAL) |
EFI_STATUS | RedfishGetServiceVersion (IN REDFISH_SERVICE RedfishService, OUT CHAR8 **ServiceVersionStr) |
EFI_STATUS | RedfishBuildRedpathUseId (IN CHAR8 *ServiceVersionStr, IN CHAR8 *Url, IN CHAR8 *Id, OUT CHAR8 **Redpath) |
This library provides a set of utility APIs that allow to create/read/update/delete (CRUD) Redfish resources and provide basic query abilities by using [URI/RedPath] (https://github.com/DMTF/libredfish).
The query language is based on XPath (https://www.w3.org/TR/1999/REC-xpath-19991116/). This library and query language essentially treat the entire Redfish Service like it was a single JSON document. In other words whenever it encounters an odata.id in JSON document, it will retrieve the new JSON document (if needed). We name the path as RedPath:
Expression Description
nodename Selects the JSON entity with the name "nodename". If the value of nodename is an object with "@odata.id", it will continue get the value from "@odata.id".
/ Selects from the root node
[index] Selects the index number JSON entity from an array or object. If the JSON entity is one collection (has Members & Membe.nosp@m.rs@o.nosp@m.data..nosp@m.coun.nosp@m.t), means to get the index member in "Members". Index number >=1, 1 means to return the first instance.
[XXX] Operation on JSON entity. If the JSON entity is one collection (has Members & Membe.nosp@m.rs@o.nosp@m.data..nosp@m.coun.nosp@m.t), means to get all elements in "Members". If the JSON entity is one array, means to get all elements in array. Others will match the nodename directly (e.g. JSON_OBJECT, JSON_STRING, JSON_TRUE, JSON_FALSE, JSON_INTEGER).
[nodename] Selects all the elements from an JSON entity that contain a property named "nodename"
[name=value] Selects all the elements from an JSON entity where the property "name" is equal to "value"
[name~value] Selects all the elements from an JSON entity where the string property "name" is equal to "value" using case insensitive comparison.
[name<value] Selects all the elements from an JSON entity where the property "name" is less than "value"
[name<=value] Selects all the elements from an JSON entity where the property "name" is less than or equal to "value"
[name>value] Selects all the elements from an JSON entity where the property "name" is greater than "value"
[name>=value] Selects all the elements from an JSON entity where the property "name" is greater than or equal to "value"
Some examples:
/v1/Chassis[1] - Will return the first Chassis instance. /v1/Chassis[SKU=1234] - Will return all Chassis instances with a SKU field equal to 1234. /v1/Systems[Storage] - Will return all the System instances that have Storage field populated.
Copyright (c) 2019, Intel Corporation. All rights reserved.
(C) Copyright 2021 Hewlett Packard Enterprise Development LP
Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file RedfishLib.h.
#define ODATA_TYPE_MAX_SIZE 128 |
Definition at line 80 of file RedfishLib.h.
#define ODATA_TYPE_NAME_MAX_SIZE 128 |
Definition at line 79 of file RedfishLib.h.
CHAR8 *EFIAPI RedfishBuildPathWithSystemUuid | ( | IN CONST CHAR8 * | RedPath, |
IN BOOLEAN | FromSmbios, | ||
IN CHAR8 *IdString | OPTIONAL | ||
) |
Fill the input RedPath string with system UUID from SMBIOS table or use the customized ID if FromSmbios == FALSE.
This is a helper function to build a RedPath string which can be used to address a Redfish resource for this computer system. The input PathString must have a Systems note in format of "Systems[UUID=%g]" or "Systems[UUID~%g]" to fill the UUID value.
Example: Use "/v1/Systems[UUID=%g]/Bios" to build a RedPath to address the "Bios" resource for this computer system.
[in] | RedPath | RedPath format to be build. |
[in] | FromSmbios | Get system UUID from SMBIOS as computer system instance ID. |
[in] | IdString | The computer system instance ID. |
Definition at line 216 of file RedfishLib.c.
EFI_STATUS RedfishBuildRedpathUseId | ( | IN CHAR8 * | ServiceVersionStr, |
IN CHAR8 * | Url, | ||
IN CHAR8 * | Id, | ||
OUT CHAR8 ** | Redpath | ||
) |
This function returns the string of Redfish service version.
[in] | ServiceVersionStr | The string of Redfish service version. |
[in] | Url | The URL to build Redpath with ID. Start with "/", for example "/Registries" |
[in] | Id | ID string |
[out] | Redpath | Pointer to retrieved Redpath, caller has to free the memory allocated for this string. |
Definition at line 182 of file RedfishMisc.c.
EFI_STATUS RedfishCheckIfRedpathExist | ( | IN REDFISH_SERVICE | RedfishService, |
IN CHAR8 * | Redpath, | ||
IN REDFISH_RESPONSE *Response | OPTIONAL | ||
) |
Check and return Redfish resource of the given Redpath.
[in] | RedfishService | Pointer to REDFISH_SERVICE |
[in] | Redpath | Redpath of the resource. |
[in] | Response | Optional return the resource. |
Definition at line 1218 of file RedfishLib.c.
VOID EFIAPI RedfishCleanupPayload | ( | IN REDFISH_PAYLOAD | Payload | ) |
Free the RedfishPayload and all its related resources.
[in] | Payload | Payload to be freed. |
Definition at line 136 of file RedfishLib.c.
VOID EFIAPI RedfishCleanupService | ( | IN REDFISH_SERVICE | RedfishService | ) |
Free the Service and all its related resources.
[in] | RedfishService | The Service to access the Redfish resources. |
This function free resources in Redfish service. RedfishService is no longer available after this function returns successfully.
[in] | RedfishService | Pointer to Redfish service to be released. |
EFI_SUCCESS | Resource is released successfully. |
Others | Errors occur. |
Definition at line 55 of file RedfishHttpLib.c.
REDFISH_PAYLOAD EFIAPI RedfishCreatePayload | ( | IN EDKII_JSON_VALUE | Value, |
IN REDFISH_SERVICE | RedfishService | ||
) |
Create REDFISH_PAYLOAD instance in local with JSON represented resource value and the Redfish Service.
The returned REDFISH_PAYLOAD can be used to create or update Redfish resource in server side.
Callers are responsible for freeing the returned payload by RedfishCleanupPayload().
[in] | Value | JSON Value of the redfish resource. |
[in] | RedfishService | The Service to access the Redfish resources. |
Definition at line 117 of file RedfishLib.c.
REDFISH_SERVICE EFIAPI RedfishCreateService | ( | IN REDFISH_CONFIG_SERVICE_INFORMATION * | RedfishConfigServiceInfo | ) |
This function uses REST EX protocol provided in RedfishConfigServiceInfo. The service enumerator will also handle the authentication flow automatically if HTTP basic auth or Redfish session login is configured to use.
Callers are responsible for freeing the returned service by RedfishCleanupService().
[in] | RedfishConfigServiceInfo | Redfish service information the EFI Redfish feature driver communicates with. |
This function create Redfish service. It's caller's responsibility to free returned Redfish service by calling FreeService ().
[in] | RedfishConfigServiceInfo | Redfish config service information. |
REDFISH_SERVICE | Redfish service is created. |
NULL | Errors occur. |
Definition at line 30 of file RedfishHttpLib.c.
EFI_STATUS EFIAPI RedfishDeleteByUri | ( | IN REDFISH_SERVICE | RedfishService, |
IN CONST CHAR8 * | Uri, | ||
OUT REDFISH_RESPONSE * | RedResponse | ||
) |
Use HTTP DELETE to remove a resource.
This function uses the RedfishService to remove a Redfish resource which is addressed by input Uri (only the relative path is required). The corresponding redfish response will returned, including HTTP StatusCode, Headers and Payload which record any HTTP response messages.
Callers are responsible for freeing the HTTP StatusCode, Headers and Payload returned in redfish response data.
[in] | RedfishService | The Service to access the Redfish resources. |
[in] | Uri | Relative path to address the resource. |
[out] | RedResponse | Pointer to the Redfish response data. |
EFI_SUCCESS | The operation is successful, indicates the HTTP StatusCode is not NULL and the value is 2XX, the Redfish resource has been removed. If there is any message returned from server, it will be returned in Payload within RedResponse. |
EFI_INVALID_PARAMETER | RedfishService, Uri, or RedResponse is NULL. |
EFI_DEVICE_ERROR | An unexpected system or network error occurred. Callers can get more error info from returned HTTP StatusCode, Headers and Payload within RedResponse:
|
Definition at line 808 of file RedfishLib.c.
EFI_STATUS EFIAPI RedfishDeleteByUriEx | ( | IN REDFISH_SERVICE | RedfishService, |
IN CONST CHAR8 * | Uri, | ||
IN CONST CHAR8 * | Content, | ||
OUT REDFISH_RESPONSE * | RedResponse | ||
) |
Use HTTP DELETE to remove a resource.
This function uses the RedfishService to remove a Redfish resource which is addressed by input Uri (only the relative path is required). The corresponding redfish response will returned, including HTTP StatusCode, Headers and Payload which record any HTTP response messages.
Callers are responsible for freeing the HTTP StatusCode, Headers and Payload returned in redfish response data.
[in] | RedfishService | The Service to access the Redfish resources. |
[in] | Uri | Relative path to address the resource. |
[in] | Content | JSON represented properties to be deleted. |
[out] | RedResponse | Pointer to the Redfish response data. |
EFI_SUCCESS | The operation is successful, indicates the HTTP StatusCode is not NULL and the value is 2XX, the Redfish resource has been removed. If there is any message returned from server, it will be returned in Payload within RedResponse. |
EFI_INVALID_PARAMETER | RedfishService, Uri, or RedResponse is NULL. |
EFI_DEVICE_ERROR | An unexpected system or network error occurred. Callers can get more error info from returned HTTP StatusCode, Headers and Payload within RedResponse:
|
Definition at line 896 of file RedfishLib.c.
VOID RedfishDumpJson | ( | IN EDKII_JSON_VALUE | JsonValue | ) |
Dump text in JSON value.
[in] | JsonValue | The Redfish JSON value to dump. |
Definition at line 1005 of file RedfishLib.c.
VOID RedfishDumpJsonStringFractions | ( | IN CHAR8 * | String | ) |
Dump text in fractions.
[in] | String | ASCII string to dump. |
Definition at line 963 of file RedfishLib.c.
VOID RedfishDumpPayload | ( | IN REDFISH_PAYLOAD | Payload | ) |
Extract the JSON text content from REDFISH_PAYLOAD and dump to debug console.
[in] | Payload | The Redfish payload to dump. |
Definition at line 1027 of file RedfishLib.c.
VOID RedfishFreeResponse | ( | IN EFI_HTTP_STATUS_CODE * | StatusCode, |
IN UINTN | HeaderCount, | ||
IN EFI_HTTP_HEADER * | Headers, | ||
IN REDFISH_PAYLOAD | Payload | ||
) |
This function will cleanup the HTTP header and Redfish payload resources.
[in] | StatusCode | The status code in HTTP response message. |
[in] | HeaderCount | Number of HTTP header structures in Headers list. |
[in] | Headers | Array containing list of HTTP headers. |
[in] | Payload | The Redfish payload to dump. |
Definition at line 1065 of file RedfishLib.c.
EFI_STATUS EFIAPI RedfishGetByPayload | ( | IN REDFISH_PAYLOAD | Payload, |
IN CONST CHAR8 * | RedPath, | ||
OUT REDFISH_RESPONSE * | RedResponse | ||
) |
Get a redfish response addressed by the input Payload and relative RedPath string, including HTTP StatusCode, Headers and Payload which record any HTTP response messages.
Callers are responsible for freeing the HTTP StatusCode, Headers and Payload returned in redfish response data.
[in] | Payload | A existing REDFISH_PAYLOAD instance. |
[in] | RedPath | Relative RedPath string to address a resource inside Payload. |
[out] | RedResponse | Pointer to the Redfish response data. |
EFI_SUCCESS | The operation is successful:
|
EFI_INVALID_PARAMETER | Payload, RedPath, or RedResponse is NULL. |
EFI_DEVICE_ERROR | An unexpected system or network error occurred. Callers can get more error info from returned HTTP StatusCode, Headers and Payload within RedResponse:
|
Definition at line 412 of file RedfishLib.c.
EFI_STATUS EFIAPI RedfishGetByService | ( | IN REDFISH_SERVICE | RedfishService, |
IN CONST CHAR8 * | RedPath, | ||
OUT REDFISH_RESPONSE * | RedResponse | ||
) |
Get a redfish response addressed by a RedPath string, including HTTP StatusCode, Headers and Payload which record any HTTP response messages.
Callers are responsible for freeing the HTTP StatusCode, Headers and Payload returned in redfish response data.
[in] | RedfishService | The Service to access the Redfish resources. |
[in] | RedPath | RedPath string to address a resource, must start from the root node. |
[out] | RedResponse | Pointer to the Redfish response data. |
EFI_SUCCESS | The operation is successful, indicates the HTTP StatusCode is not NULL and the value is 2XX. The corresponding redfish resource has been returned in Payload within RedResponse. |
EFI_INVALID_PARAMETER | RedfishService, RedPath, or RedResponse is NULL. |
EFI_DEVICE_ERROR | An unexpected system or network error occurred. Callers can get more error info from returned HTTP StatusCode, Headers and Payload within RedResponse:
|
Definition at line 285 of file RedfishLib.c.
EFI_STATUS EFIAPI RedfishGetByUri | ( | IN REDFISH_SERVICE | RedfishService, |
IN CONST CHAR8 * | Uri, | ||
OUT REDFISH_RESPONSE * | RedResponse | ||
) |
Get a redfish response addressed by URI, including HTTP StatusCode, Headers and Payload which record any HTTP response messages.
Callers are responsible for freeing the HTTP StatusCode, Headers and Payload returned in redfish response data.
[in] | RedfishService | The Service to access the URI resources. |
[in] | URI | String to address a resource. |
[out] | RedResponse | Pointer to the Redfish response data. |
EFI_SUCCESS | The operation is successful, indicates the HTTP StatusCode is not NULL and the value is 2XX. The corresponding redfish resource has been returned in Payload within RedResponse. |
EFI_INVALID_PARAMETER | RedfishService, RedPath, or RedResponse is NULL. |
EFI_DEVICE_ERROR | An unexpected system or network error occurred. Callers can get more error info from returned HTTP StatusCode, Headers and Payload within RedResponse:
|
Get a redfish response addressed by URI, including HTTP StatusCode, Headers and Payload which record any HTTP response messages.
Callers are responsible for freeing the HTTP StatusCode, Headers and Payload returned in redfish response data.
[in] | RedfishService | The Service to access the URI resources. |
[in] | Uri | String to address a resource. |
[out] | RedResponse | Pointer to the Redfish response data. |
EFI_SUCCESS | The operation is successful, indicates the HTTP StatusCode is not NULL and the value is 2XX. The corresponding redfish resource has been returned in Payload within RedResponse. |
EFI_INVALID_PARAMETER | RedfishService, RedPath, or RedResponse is NULL. |
EFI_DEVICE_ERROR | An unexpected system or network error occurred. Callers can get more error info from returned HTTP StatusCode, Headers and Payload within RedResponse:
|
Definition at line 345 of file RedfishLib.c.
EFI_STATUS RedfishGetCollectionSize | ( | IN REDFISH_PAYLOAD | Payload, |
IN UINTN * | CollectionSize | ||
) |
Get collection size.
[in] | Payload | The Redfish collection payload |
[in] | CollectionSize | Size of this collection |
Definition at line 1163 of file RedfishLib.c.
Get Redfish payload of collection member
[in] | Payload | The Redfish collection payload |
[in] | Index | Index of collection member |
Definition at line 1190 of file RedfishLib.c.
EFI_STATUS RedfishGetServiceVersion | ( | IN REDFISH_SERVICE | RedfishService, |
OUT CHAR8 ** | ServiceVersionStr | ||
) |
This function returns the string of Redfish service version.
[in] | RedfishService | Redfish service instance. |
[out] | ServiceVersionStr | Redfish service string. |
Definition at line 26 of file RedfishMisc.c.
BOOLEAN RedfishIsPayloadCollection | ( | IN REDFISH_PAYLOAD | Payload | ) |
Check if the payload is collection
[in] | Payload | The Redfish payload to be checked. |
Definition at line 1146 of file RedfishLib.c.
BOOLEAN RedfishIsValidOdataType | ( | IN REDFISH_PAYLOAD | Payload, |
IN CONST CHAR8 * | OdataTypeName, | ||
IN REDFISH_ODATA_TYPE_MAPPING * | OdataTypeMappingList, | ||
IN UINTN | OdataTypeMappingListSize | ||
) |
Check if the "@odata.type" in Payload is valid or not.
[in] | Payload | The Redfish payload to be checked. |
[in] | OdataTypeName | OdataType will be retrieved from mapping list. |
[in] | OdataTypeMappingList | The list of OdataType. |
[in] | OdataTypeMappingListSize | The number of mapping list |
Definition at line 1100 of file RedfishLib.c.
EDKII_JSON_VALUE EFIAPI RedfishJsonInPayload | ( | IN REDFISH_PAYLOAD | Payload | ) |
This function returns the decoded JSON value of a REDFISH_PAYLOAD.
Caller doesn't need to free the returned JSON value because it will be released in corresponding RedfishCleanupPayload() function.
[in] | Payload | A REDFISH_PAYLOAD instance. |
This function returns JSON value in given RedfishPayload. Returned JSON value is a reference to the JSON value in RedfishPayload. Any modification to returned JSON value will change JSON value in RedfishPayload.
[in] | RedfishPayload | Pointer to Redfish payload. |
EDKII_JSON_VALUE | JSON value is returned. |
NULL | Errors occur. |
Definition at line 81 of file RedfishHttpLib.c.
EFI_STATUS EFIAPI RedfishPatchToPayload | ( | IN REDFISH_PAYLOAD | Target, |
IN REDFISH_PAYLOAD | Payload, | ||
OUT REDFISH_RESPONSE * | RedResponse | ||
) |
Use HTTP PATCH to perform updates on target payload. Patch to odata.id in Payload directly.
This function uses the Payload to patch the Target. Changes to one or more properties within the target resource are represented in the input Payload, properties not specified in Payload won't be changed by this request. The corresponding redfish response will returned, including HTTP StatusCode, Headers and Payload which record any HTTP response messages.
Callers are responsible for freeing the HTTP StatusCode, Headers and Payload returned in redfish response data.
[in] | Target | The target payload to be updated. |
[in] | Payload | Payload with properties to be changed. |
[out] | RedResponse | Pointer to the Redfish response data. |
EFI_SUCCESS | The operation is successful, indicates the HTTP StatusCode is not NULL and the value is 2XX. The Redfish resource will be returned in Payload within RedResponse if server send it back in the HTTP response message body. |
EFI_INVALID_PARAMETER | Target, Payload, or RedResponse is NULL. |
EFI_DEVICE_ERROR | An unexpected system or network error occurred. Callers can get more error info from returned HTTP StatusCode, Headers and Payload within RedResponse:
|
Definition at line 574 of file RedfishLib.c.
EFI_STATUS EFIAPI RedfishPatchToUri | ( | IN REDFISH_SERVICE | RedfishService, |
IN CONST CHAR8 * | Uri, | ||
IN CONST CHAR8 * | Content, | ||
OUT REDFISH_RESPONSE * | RedResponse | ||
) |
Use HTTP PATCH to perform updates on pre-existing Redfish resource.
This function uses the RedfishService to patch a Redfish resource addressed by Uri (only the relative path is required). Changes to one or more properties within the target resource are represented in the input Content, properties not specified in Content won't be changed by this request. The corresponding redfish response will returned, including HTTP StatusCode, Headers and Payload which record any HTTP response messages.
Callers are responsible for freeing the HTTP StatusCode, Headers and Payload returned in redfish response data.
[in] | RedfishService | The Service to access the Redfish resources. |
[in] | Uri | Relative path to address the resource. |
[in] | Content | JSON represented properties to be update. |
[out] | RedResponse | Pointer to the Redfish response data. |
EFI_SUCCESS | The operation is successful, indicates the HTTP StatusCode is not NULL and the value is 2XX. The Redfish resource will be returned in Payload within RedResponse if server send it back in the HTTP response message body. |
EFI_INVALID_PARAMETER | RedfishService, Uri, Content, or RedResponse is NULL. |
EFI_DEVICE_ERROR | An unexpected system or network error occurred. Callers can get more error info from returned HTTP StatusCode, Headers and Payload within RedResponse:
|
Definition at line 482 of file RedfishLib.c.
EFI_STATUS EFIAPI RedfishPostToPayload | ( | IN REDFISH_PAYLOAD | Target, |
IN REDFISH_PAYLOAD | Payload, | ||
OUT REDFISH_RESPONSE * | RedResponse | ||
) |
Use HTTP POST to create a new resource in target payload.
The POST request should be submitted to the Resource Collection in which the new resource is to belong. The Resource Collection is addressed by Target payload. The Redfish may ignore any service controlled properties. The corresponding redfish response will returned, including HTTP StatusCode, Headers and Payload which record any HTTP response messages.
Callers are responsible for freeing the HTTP StatusCode, Headers and Payload returned in redfish response data.
[in] | Target | Target payload of the Resource Collection. |
[in] | Payload | The new resource to be created. |
[out] | RedResponse | Pointer to the Redfish response data. |
EFI_SUCCESS | The operation is successful, indicates the HTTP StatusCode is not NULL and the value is 2XX. The Redfish resource will be returned in Payload within RedResponse if server send it back in the HTTP response message body. |
EFI_INVALID_PARAMETER | Target, Payload, or RedResponse is NULL. |
EFI_DEVICE_ERROR | An unexpected system or network error occurred. Callers can get more error info from returned HTTP StatusCode, Headers and Payload within RedResponse:
|
Definition at line 740 of file RedfishLib.c.
EFI_STATUS EFIAPI RedfishPostToUri | ( | IN REDFISH_SERVICE | RedfishService, |
IN CONST CHAR8 * | Uri, | ||
IN CONST CHAR8 * | Content, | ||
IN UINTN ContentSize | OPTIONAL, | ||
IN CONST CHAR8 *ContentType | OPTIONAL, | ||
OUT REDFISH_RESPONSE * | RedResponse | ||
) |
Use HTTP POST to create new Redfish resource in the Resource Collection.
The POST request should be submitted to the Resource Collection in which the new resource is to belong. The Resource Collection is addressed by URI. The Redfish may ignore any service controlled properties. The corresponding redfish response will returned, including HTTP StatusCode, Headers and Payload which record any HTTP response messages.
Callers are responsible for freeing the HTTP StatusCode, Headers and Payload returned in redfish response data.
[in] | RedfishService | The Service to access the Redfish resources. |
[in] | Uri | Relative path to address the resource. |
[in] | Content | JSON represented properties to be update. |
[in] | ContentSize | Size of the Content to be send to Redfish service |
[in] | ContentType | Type of the Content to be send to Redfish service |
[out] | RedResponse | Pointer to the Redfish response data. |
EFI_SUCCESS | The operation is successful, indicates the HTTP StatusCode is not NULL and the value is 2XX. The Redfish resource will be returned in Payload within RedResponse if server send it back in the HTTP response message body. |
EFI_INVALID_PARAMETER | RedfishService, Uri, Content, or RedResponse is NULL. |
EFI_DEVICE_ERROR | An unexpected system or network error occurred. Callers can get more error info from returned HTTP StatusCode, Headers and Payload within RedResponse:
|
Definition at line 645 of file RedfishLib.c.
EFI_STATUS EFIAPI RedfishPutToUri | ( | IN REDFISH_SERVICE | RedfishService, |
IN CONST CHAR8 * | Uri, | ||
IN CONST CHAR8 * | Content, | ||
IN UINTN ContentSize | OPTIONAL, | ||
IN CONST CHAR8 *ContentType | OPTIONAL, | ||
OUT REDFISH_RESPONSE * | RedResponse | ||
) |
Use HTTP PUT to create new Redfish resource in the Resource Collection.
This function uses the RedfishService to put a Redfish resource addressed by Uri (only the relative path is required). Changes to one or more properties within the target resource are represented in the input Content, properties not specified in Content won't be changed by this request. The corresponding redfish response will returned, including HTTP StatusCode, Headers and Payload which record any HTTP response messages.
Callers are responsible for freeing the HTTP StatusCode, Headers and Payload returned in redfish response data.
[in] | RedfishService | The Service to access the Redfish resources. |
[in] | Uri | Relative path to address the resource. |
[in] | Content | JSON represented properties to be update. |
[in] | ContentSize | Size of the Content to be send to Redfish service |
[in] | ContentType | Type of the Content to be send to Redfish service |
[out] | RedResponse | Pointer to the Redfish response data. |
EFI_SUCCESS | The operation is successful, indicates the HTTP StatusCode is not NULL and the value is 2XX. The Redfish resource will be returned in Payload within RedResponse if server send it back in the HTTP response message body. |
EFI_INVALID_PARAMETER | RedfishService, Uri, Content, or RedResponse is NULL. |
EFI_DEVICE_ERROR | An unexpected system or network error occurred. Callers can get more error info from returned HTTP StatusCode, Headers and Payload within RedResponse:
|
Definition at line 1284 of file RedfishLib.c.
REDFISH_SERVICE EFIAPI RedfishServiceInPayload | ( | IN REDFISH_PAYLOAD | Payload | ) |
This function returns the Redfish service of a REDFISH_PAYLOAD.
Caller doesn't need to free the returned JSON value because it will be released in corresponding RedfishCleanupService() function.
[in] | Payload | A REDFISH_PAYLOAD instance. |
Definition at line 184 of file RedfishLib.c.