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