Esempio n. 1
0
        ConfidentialLedgerResource IOperationSource <ConfidentialLedgerResource> .CreateResult(Response response, CancellationToken cancellationToken)
        {
            using var document = JsonDocument.Parse(response.ContentStream);
            var data = ConfidentialLedgerData.DeserializeConfidentialLedgerData(document.RootElement);

            return(new ConfidentialLedgerResource(_client, data));
        }
Esempio n. 2
0
        public async Task <Response <ConfidentialLedgerData> > GetAsync(string subscriptionId, string resourceGroupName, string ledgerName, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId));
            Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName));
            Argument.AssertNotNullOrEmpty(ledgerName, nameof(ledgerName));

            using var message = CreateGetRequest(subscriptionId, resourceGroupName, ledgerName);
            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);

            switch (message.Response.Status)
            {
            case 200:
            {
                ConfidentialLedgerData value = default;
                using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);

                value = ConfidentialLedgerData.DeserializeConfidentialLedgerData(document.RootElement);
                return(Response.FromValue(value, message.Response));
            }