public async Task <Response <ResourcePoolData> > GetAsync(string subscriptionId, string resourceGroupName, string resourcePoolName, CancellationToken cancellationToken = default)
        {
            if (subscriptionId == null)
            {
                throw new ArgumentNullException(nameof(subscriptionId));
            }
            if (resourceGroupName == null)
            {
                throw new ArgumentNullException(nameof(resourceGroupName));
            }
            if (resourcePoolName == null)
            {
                throw new ArgumentNullException(nameof(resourcePoolName));
            }

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

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

                value = ResourcePoolData.DeserializeResourcePoolData(document.RootElement);
                return(Response.FromValue(value, message.Response));
            }
Exemplo n.º 2
0
        ResourcePool IOperationSource <ResourcePool> .CreateResult(Response response, CancellationToken cancellationToken)
        {
            using var document = JsonDocument.Parse(response.ContentStream);
            var data = ResourcePoolData.DeserializeResourcePoolData(document.RootElement);

            return(new ResourcePool(_client, data));
        }