ConfidentialLedgerClient.CreateLedgerEntryAsync Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
CreateLedgerEntryAsync(RequestContent, String, String, RequestContext) |
[Protocol Method] Writes a ledger entry.
|
CreateLedgerEntryAsync(RequestContent, String, RequestContext) |
[Protocol Method] Writes a ledger entry.
|
CreateLedgerEntryAsync(RequestContent, String, String, RequestContext)
- Source:
- ConfidentialLedgerClient.cs
[Protocol Method] Writes a ledger entry.
- This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
public virtual System.Threading.Tasks.Task<Azure.Response> CreateLedgerEntryAsync(Azure.Core.RequestContent content, string collectionId = default, string tags = default, Azure.RequestContext context = default);
abstract member CreateLedgerEntryAsync : Azure.Core.RequestContent * string * string * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
override this.CreateLedgerEntryAsync : Azure.Core.RequestContent * string * string * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
Public Overridable Function CreateLedgerEntryAsync (content As RequestContent, Optional collectionId As String = Nothing, Optional tags As String = Nothing, Optional context As RequestContext = Nothing) As Task(Of Response)
Parameters
- content
- RequestContent
The content to send as the body of the request.
- collectionId
- String
The collection id.
- tags
- String
Comma separated tags.
- context
- RequestContext
The request context, which can override default behaviors of the client pipeline on a per-call basis.
Returns
The response returned from the service.
Exceptions
content
is null.
Service returned a non-success status code.
Examples
This sample shows how to call CreateLedgerEntryAsync and parse the result.
TokenCredential credential = new DefaultAzureCredential();
ConfidentialLedgerClient client = new ConfidentialLedgerClient(new Uri("http://localhost:3000"), credential);
using RequestContent content = RequestContent.Create(new
{
contents = "<contents>",
});
Response response = await client.CreateLedgerEntryAsync(content);
JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("collectionId").ToString());
This sample shows how to call CreateLedgerEntryAsync with all parameters and request content and parse the result.
TokenCredential credential = new DefaultAzureCredential();
ConfidentialLedgerClient client = new ConfidentialLedgerClient(new Uri("http://localhost:3000"), credential);
using RequestContent content = RequestContent.Create(new
{
contents = "<contents>",
preHooks = new object[]
{
new
{
functionId = "<functionId>",
properties = new
{
arguments = new object[]
{
"<arguments>"
},
exportedFunctionName = "<exportedFunctionName>",
runtimeOptions = new
{
log_exception_details = true,
max_cached_interpreters = 1234L,
max_execution_time_ms = 1234L,
max_heap_bytes = 1234L,
max_stack_bytes = 1234L,
return_exception_details = true,
},
},
}
},
postHooks = new object[]
{
null
},
});
Response response = await client.CreateLedgerEntryAsync(content, collectionId: "<collectionId>", tags: "<tags>");
JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("collectionId").ToString());
Applies to
CreateLedgerEntryAsync(RequestContent, String, RequestContext)
- Source:
- ConfidentialLedgerClient.cs
- Source:
- ConfidentialLedgerClient.cs
[Protocol Method] Writes a ledger entry.
- This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
public virtual System.Threading.Tasks.Task<Azure.Response> CreateLedgerEntryAsync(Azure.Core.RequestContent content, string collectionId = default, Azure.RequestContext context = default);
public virtual System.Threading.Tasks.Task<Azure.Response> CreateLedgerEntryAsync(Azure.Core.RequestContent content, string collectionId, Azure.RequestContext context);
abstract member CreateLedgerEntryAsync : Azure.Core.RequestContent * string * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
override this.CreateLedgerEntryAsync : Azure.Core.RequestContent * string * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
Public Overridable Function CreateLedgerEntryAsync (content As RequestContent, Optional collectionId As String = Nothing, Optional context As RequestContext = Nothing) As Task(Of Response)
Public Overridable Function CreateLedgerEntryAsync (content As RequestContent, collectionId As String, context As RequestContext) As Task(Of Response)
Parameters
- content
- RequestContent
The content to send as the body of the request.
- collectionId
- String
The collection id.
- context
- RequestContext
The request context, which can override default behaviors of the client pipeline on a per-call basis.
Returns
The response returned from the service.
Exceptions
content
is null.
Service returned a non-success status code.
Examples
This sample shows how to call CreateLedgerEntryAsync and parse the result.
Uri endpoint = new Uri("<endpoint>");
TokenCredential credential = new DefaultAzureCredential();
ConfidentialLedgerClient client = new ConfidentialLedgerClient(endpoint, credential);
using RequestContent content = RequestContent.Create(new
{
contents = "<contents>",
});
Response response = await client.CreateLedgerEntryAsync(content);
JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("collectionId").ToString());
This sample shows how to call CreateLedgerEntryAsync with all parameters and request content and parse the result.
Uri endpoint = new Uri("<endpoint>");
TokenCredential credential = new DefaultAzureCredential();
ConfidentialLedgerClient client = new ConfidentialLedgerClient(endpoint, credential);
using RequestContent content = RequestContent.Create(new
{
contents = "<contents>",
});
Response response = await client.CreateLedgerEntryAsync(content, collectionId: "<collectionId>");
JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("collectionId").ToString());
Remarks
A collection id may optionally be specified.
Below is the JSON schema for the request and response payloads.
Request Body:
Schema for LedgerEntry
:
{
contents: string, # Required. Contents of the ledger entry.
collectionId: string, # Optional.
transactionId: string, # Optional. A unique identifier for the state of the ledger. If returned as part of a LedgerEntry, it indicates the state from which the entry was read.
}
Response Body:
Schema for LedgerWriteResult
:
{
collectionId: string, # Required.
}