ConfidentialLedgerClient.CreateLedgerEntryAsync メソッド
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
[プロトコルメソッド]台帳エントリを書き込みます。
- この プロトコル メソッド を使用すると、高度なシナリオで応答の要求と処理を明示的に作成できます。
public virtual System.Threading.Tasks.Task<Azure.Response> CreateLedgerEntryAsync (Azure.Core.RequestContent content, string collectionId = default, Azure.RequestContext context = default);
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)
パラメーター
- content
- RequestContent
要求の本文として送信するコンテンツ。
- collectionId
- String
コレクション ID。
- context
- RequestContext
要求コンテキスト。これは、クライアント パイプラインの既定の動作を呼び出しごとにオーバーライドできます。
戻り値
サービスから返された応答。
例外
content
が null です。
サービスから成功以外の状態コードが返されました。
例
このサンプルでは、必要なパラメーターと要求コンテンツを使用して CreateLedgerEntryAsync を呼び出す方法と、結果を解析する方法を示します。
var credential = new DefaultAzureCredential();
var endpoint = new Uri("<https://my-service.azure.com>");
var client = new ConfidentialLedgerClient(endpoint, credential);
var data = new {
contents = "<contents>",
};
Response response = await client.CreateLedgerEntryAsync(RequestContent.Create(data));
JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("collectionId").ToString());
このサンプルでは、すべてのパラメーターと要求コンテンツを使用して CreateLedgerEntryAsync を呼び出す方法と、結果を解析する方法を示します。
var credential = new DefaultAzureCredential();
var endpoint = new Uri("<https://my-service.azure.com>");
var client = new ConfidentialLedgerClient(endpoint, credential);
var data = new {
contents = "<contents>",
};
Response response = await client.CreateLedgerEntryAsync(RequestContent.Create(data), "<collectionId>");
JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("collectionId").ToString());
注釈
必要に応じて、コレクション ID を指定できます。
要求と応答のペイロードの JSON スキーマを次に示します。
要求本文:
の 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.
}
応答本文:
の LedgerWriteResult
スキーマ:
{
collectionId: string, # Required.
}
適用対象
GitHub で Microsoft と共同作業する
このコンテンツのソースは GitHub にあります。そこで、issue や pull request を作成および確認することもできます。 詳細については、共同作成者ガイドを参照してください。
Azure SDK for .NET