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

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

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

                value = InstancePoolData.DeserializeInstancePoolData(document.RootElement);
                return(Response.FromValue(value, message.Response));
            }
Esempio n. 2
0
        InstancePoolResource IOperationSource <InstancePoolResource> .CreateResult(Response response, CancellationToken cancellationToken)
        {
            using var document = JsonDocument.Parse(response.ContentStream);
            var data = InstancePoolData.DeserializeInstancePoolData(document.RootElement);

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