HubRouteTableResource IOperationSource <HubRouteTableResource> .CreateResult(Response response, CancellationToken cancellationToken) { using var document = JsonDocument.Parse(response.ContentStream); var data = HubRouteTableData.DeserializeHubRouteTableData(document.RootElement); return(new HubRouteTableResource(_client, data)); }
public async Task <Response <HubRouteTableData> > GetAsync(string subscriptionId, string resourceGroupName, string virtualHubName, string routeTableName, CancellationToken cancellationToken = default) { if (subscriptionId == null) { throw new ArgumentNullException(nameof(subscriptionId)); } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); } if (virtualHubName == null) { throw new ArgumentNullException(nameof(virtualHubName)); } if (routeTableName == null) { throw new ArgumentNullException(nameof(routeTableName)); } using var message = CreateGetRequest(subscriptionId, resourceGroupName, virtualHubName, routeTableName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { HubRouteTableData value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); value = HubRouteTableData.DeserializeHubRouteTableData(document.RootElement); return(Response.FromValue(value, message.Response)); }