ConfigServerResource IOperationSource <ConfigServerResource> .CreateResult(Response response, CancellationToken cancellationToken) { using var document = JsonDocument.Parse(response.ContentStream); var data = ConfigServerResourceData.DeserializeConfigServerResourceData(document.RootElement); return(new ConfigServerResource(_client, data)); }
public async Task <Response <ConfigServerResourceData> > GetAsync(string subscriptionId, string resourceGroupName, string serviceName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { ConfigServerResourceData value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); value = ConfigServerResourceData.DeserializeConfigServerResourceData(document.RootElement); return(Response.FromValue(value, message.Response)); }