TianoCore EDK2 master
Loading...
Searching...
No Matches
RedfishLib.c File Reference
#include "RedfishMisc.h"

Go to the source code of this file.

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)
 
VOID RedfishDumpJsonStringFractions (IN CHAR8 *String)
 
VOID RedfishDumpJson (IN EDKII_JSON_VALUE JsonValue)
 
VOID RedfishDumpPayload (IN REDFISH_PAYLOAD Payload)
 
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 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)
 

Detailed Description

Provides a set of utility APIs that allow to create/read/update/delete (CRUD) Redfish resources and provide basic query.

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.c.

Function Documentation

◆ RedfishBuildPathWithSystemUuid()

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.

Parameters
[in]RedPathRedPath format to be build.
[in]FromSmbiosGet system UUID from SMBIOS as computer system instance ID.
[in]IdStringThe computer system instance ID.
Returns
Full RedPath with system UUID inside, or NULL if error happens.

Definition at line 216 of file RedfishLib.c.

◆ RedfishCheckIfRedpathExist()

EFI_STATUS RedfishCheckIfRedpathExist ( IN REDFISH_SERVICE  RedfishService,
IN CHAR8 *  Redpath,
IN REDFISH_RESPONSE *Response  OPTIONAL 
)

Check and return Redfish resource of the given Redpath.

Parameters
[in]RedfishServicePointer to REDFISH_SERVICE
[in]RedpathRedpath of the resource.
[in]ResponseOptional return the resource.
Returns
EFI_STATUS

Definition at line 1218 of file RedfishLib.c.

◆ RedfishCleanupPayload()

VOID EFIAPI RedfishCleanupPayload ( IN REDFISH_PAYLOAD  Payload)

Free the RedfishPayload and all its related resources.

Parameters
[in]PayloadPayload to be freed.

Definition at line 136 of file RedfishLib.c.

◆ RedfishCleanupService()

VOID EFIAPI RedfishCleanupService ( IN REDFISH_SERVICE  RedfishService)

Free the Service and all its related resources.

Parameters
[in]RedfishServiceThe Service to access the Redfish resources.

Definition at line 89 of file RedfishLib.c.

◆ RedfishCreatePayload()

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().

Parameters
[in]ValueJSON Value of the redfish resource.
[in]RedfishServiceThe Service to access the Redfish resources.
Returns
REDFISH_PAYLOAD instance of the resource, or NULL if error happens.

Definition at line 117 of file RedfishLib.c.

◆ RedfishCreateService()

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().

Parameters
[in]RedfishConfigServiceInfoRedfish service information the EFI Redfish feature driver communicates with.
Returns
New created Redfish Service, or NULL if error happens.

Definition at line 30 of file RedfishLib.c.

◆ RedfishDeleteByUri()

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.

Parameters
[in]RedfishServiceThe Service to access the Redfish resources.
[in]UriRelative path to address the resource.
[out]RedResponsePointer to the Redfish response data.
Return values
EFI_SUCCESSThe 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_PARAMETERRedfishService, Uri, or RedResponse is NULL.
EFI_DEVICE_ERRORAn unexpected system or network error occurred. Callers can get more error info from returned HTTP StatusCode, Headers and Payload within RedResponse:
  1. If the returned StatusCode is NULL, indicates any error happen.
  2. If the returned StatusCode is not NULL and the value is not 2XX, indicates any error happen.

Definition at line 808 of file RedfishLib.c.

◆ RedfishDeleteByUriEx()

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.

Parameters
[in]RedfishServiceThe Service to access the Redfish resources.
[in]UriRelative path to address the resource.
[in]ContentJSON represented properties to be deleted.
[out]RedResponsePointer to the Redfish response data.
Return values
EFI_SUCCESSThe 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_PARAMETERRedfishService, Uri, or RedResponse is NULL.
EFI_DEVICE_ERRORAn unexpected system or network error occurred. Callers can get more error info from returned HTTP StatusCode, Headers and Payload within RedResponse:
  1. If the returned StatusCode is NULL, indicates any error happen.
  2. If the returned StatusCode is not NULL and the value is not 2XX, indicates any error happen.

Definition at line 896 of file RedfishLib.c.

◆ RedfishDumpJson()

VOID RedfishDumpJson ( IN EDKII_JSON_VALUE  JsonValue)

Dump text in JSON value.

Parameters
[in]JsonValueThe Redfish JSON value to dump.

Definition at line 1005 of file RedfishLib.c.

◆ RedfishDumpJsonStringFractions()

VOID RedfishDumpJsonStringFractions ( IN CHAR8 *  String)

Dump text in fractions.

Parameters
[in]StringASCII string to dump.

Definition at line 963 of file RedfishLib.c.

◆ RedfishDumpPayload()

VOID RedfishDumpPayload ( IN REDFISH_PAYLOAD  Payload)

Extract the JSON text content from REDFISH_PAYLOAD and dump to debug console.

Parameters
[in]PayloadThe Redfish payload to dump.

Definition at line 1027 of file RedfishLib.c.

◆ RedfishFreeResponse()

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.

Parameters
[in]StatusCodeThe status code in HTTP response message.
[in]HeaderCountNumber of HTTP header structures in Headers list.
[in]HeadersArray containing list of HTTP headers.
[in]PayloadThe Redfish payload to dump.

Definition at line 1065 of file RedfishLib.c.

◆ RedfishGetByPayload()

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.

Parameters
[in]PayloadA existing REDFISH_PAYLOAD instance.
[in]RedPathRelative RedPath string to address a resource inside Payload.
[out]RedResponsePointer to the Redfish response data.
Return values
EFI_SUCCESSThe operation is successful:
  1. The HTTP StatusCode is NULL and the returned Payload in RedResponse is not NULL, indicates the Redfish resource has been parsed from the input payload directly.
  2. The HTTP StatusCode is not NULL and the value is 2XX, indicates the corresponding redfish resource has been returned in Payload within RedResponse.
EFI_INVALID_PARAMETERPayload, RedPath, or RedResponse is NULL.
EFI_DEVICE_ERRORAn unexpected system or network error occurred. Callers can get more error info from returned HTTP StatusCode, Headers and Payload within RedResponse:
  1. If the returned Payload is NULL, indicates any error happen.
  2. If StatusCode is not NULL and the returned value of StatusCode is not 2XX, indicates any error happen.

Definition at line 412 of file RedfishLib.c.

◆ RedfishGetByService()

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.

Parameters
[in]RedfishServiceThe Service to access the Redfish resources.
[in]RedPathRedPath string to address a resource, must start from the root node.
[out]RedResponsePointer to the Redfish response data.
Return values
EFI_SUCCESSThe 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_PARAMETERRedfishService, RedPath, or RedResponse is NULL.
EFI_DEVICE_ERRORAn unexpected system or network error occurred. Callers can get more error info from returned HTTP StatusCode, Headers and Payload within RedResponse:
  1. If the returned Payload is NULL, indicates any error happen.
  2. If the returned StatusCode is NULL, indicates any error happen.
  3. If the returned StatusCode is not 2XX, indicates any error happen.

Definition at line 285 of file RedfishLib.c.

◆ RedfishGetByUri()

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.

Parameters
[in]RedfishServiceThe Service to access the URI resources.
[in]UriString to address a resource.
[out]RedResponsePointer to the Redfish response data.
Return values
EFI_SUCCESSThe 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_PARAMETERRedfishService, RedPath, or RedResponse is NULL.
EFI_DEVICE_ERRORAn unexpected system or network error occurred. Callers can get more error info from returned HTTP StatusCode, Headers and Payload within RedResponse:
  1. If the returned Payload is NULL, indicates any error happen.
  2. If the returned StatusCode is NULL, indicates any error happen.
  3. If the returned StatusCode is not 2XX, indicates any error happen.

Definition at line 345 of file RedfishLib.c.

◆ RedfishGetCollectionSize()

EFI_STATUS RedfishGetCollectionSize ( IN REDFISH_PAYLOAD  Payload,
IN UINTN CollectionSize 
)

Get collection size.

Parameters
[in]PayloadThe Redfish collection payload
[in]CollectionSizeSize of this collection
Returns
EFI_SUCCESS Collection size is returned in CollectionSize
EFI_INVALID_PARAMETER The payload is not a collection.

Definition at line 1163 of file RedfishLib.c.

◆ RedfishGetPayloadByIndex()

REDFISH_PAYLOAD RedfishGetPayloadByIndex ( IN REDFISH_PAYLOAD  Payload,
IN UINTN  Index 
)

Get Redfish payload of collection member

Parameters
[in]PayloadThe Redfish collection payload
[in]IndexIndex of collection member
Returns
NULL Fail to get collection member.
Non NULL Payload is returned.

Definition at line 1190 of file RedfishLib.c.

◆ RedfishIsPayloadCollection()

BOOLEAN RedfishIsPayloadCollection ( IN REDFISH_PAYLOAD  Payload)

Check if the payload is collection

Parameters
[in]PayloadThe Redfish payload to be checked.
Returns
TRUE if the payload is collection.

Definition at line 1146 of file RedfishLib.c.

◆ RedfishIsValidOdataType()

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.

Parameters
[in]PayloadThe Redfish payload to be checked.
[in]OdataTypeNameOdataType will be retrieved from mapping list.
[in]OdataTypeMappingListThe list of OdataType.
[in]OdataTypeMappingListSizeThe number of mapping list
Returns
TRUE if the "@odata.type" in Payload is valid, otherwise FALSE.

Definition at line 1100 of file RedfishLib.c.

◆ RedfishJsonInPayload()

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.

Parameters
[in]PayloadA REDFISH_PAYLOAD instance.
Returns
Decoded JSON value of the payload.

Definition at line 160 of file RedfishLib.c.

◆ RedfishPatchToPayload()

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.

Parameters
[in]TargetThe target payload to be updated.
[in]PayloadPayload with properties to be changed.
[out]RedResponsePointer to the Redfish response data.
Return values
EFI_SUCCESSThe 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_PARAMETERTarget, Payload, or RedResponse is NULL.
EFI_DEVICE_ERRORAn unexpected system or network error occurred. Callers can get more error info from returned HTTP StatusCode, Headers and Payload within RedResponse:
  1. If the returned StatusCode is NULL, indicates any error happen.
  2. If the returned StatusCode is not NULL and the value is not 2XX, indicates any error happen.

Definition at line 574 of file RedfishLib.c.

◆ RedfishPatchToUri()

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.

Parameters
[in]RedfishServiceThe Service to access the Redfish resources.
[in]UriRelative path to address the resource.
[in]ContentJSON represented properties to be update.
[out]RedResponsePointer to the Redfish response data.
Return values
EFI_SUCCESSThe 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_PARAMETERRedfishService, Uri, Content, or RedResponse is NULL.
EFI_DEVICE_ERRORAn unexpected system or network error occurred. Callers can get more error info from returned HTTP StatusCode, Headers and Payload within RedResponse:
  1. If the returned StatusCode is NULL, indicates any error happen.
  2. If the returned StatusCode is not NULL and the value is not 2XX, indicates any error happen.

Definition at line 482 of file RedfishLib.c.

◆ RedfishPostToPayload()

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.

Parameters
[in]TargetTarget payload of the Resource Collection.
[in]PayloadThe new resource to be created.
[out]RedResponsePointer to the Redfish response data.
Return values
EFI_SUCCESSThe 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_PARAMETERTarget, Payload, or RedResponse is NULL.
EFI_DEVICE_ERRORAn unexpected system or network error occurred. Callers can get more error info from returned HTTP StatusCode, Headers and Payload within RedResponse:
  1. If the returned StatusCode is NULL, indicates any error happen.
  2. If the returned StatusCode is not NULL and the value is not 2XX, indicates any error happen.

Definition at line 740 of file RedfishLib.c.

◆ RedfishPostToUri()

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.

Parameters
[in]RedfishServiceThe Service to access the Redfish resources.
[in]UriRelative path to address the resource.
[in]ContentJSON represented properties to be update.
[in]ContentSizeSize of the Content to be send to Redfish service
[in]ContentTypeType of the Content to be send to Redfish service
[out]RedResponsePointer to the Redfish response data.
Return values
EFI_SUCCESSThe 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_PARAMETERRedfishService, Uri, Content, or RedResponse is NULL.
EFI_DEVICE_ERRORAn unexpected system or network error occurred. Callers can get more error info from returned HTTP StatusCode, Headers and Payload within RedResponse:
  1. If the returned StatusCode is NULL, indicates any error happen.
  2. If the returned StatusCode is not NULL and the value is not 2XX, indicates any error happen.

Definition at line 645 of file RedfishLib.c.

◆ RedfishPutToUri()

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.

Parameters
[in]RedfishServiceThe Service to access the Redfish resources.
[in]UriRelative path to address the resource.
[in]ContentJSON represented properties to be update.
[in]ContentSizeSize of the Content to be send to Redfish service
[in]ContentTypeType of the Content to be send to Redfish service
[out]RedResponsePointer to the Redfish response data.
Return values
EFI_SUCCESSThe 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_PARAMETERRedfishService, Uri, Content, or RedResponse is NULL.
EFI_DEVICE_ERRORAn unexpected system or network error occurred. Callers can get more error info from returned HTTP StatusCode, Headers and Payload within RedResponse:
  1. If the returned StatusCode is NULL, indicates any error happen.
  2. If the returned StatusCode is not NULL and the value is not 2XX, indicates any error happen.

Definition at line 1284 of file RedfishLib.c.

◆ RedfishServiceInPayload()

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.

Parameters
[in]PayloadA REDFISH_PAYLOAD instance.
Returns
Redfish service of the payload.

Definition at line 184 of file RedfishLib.c.