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

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

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

                value = VirtualDesktopData.DeserializeVirtualDesktopData(document.RootElement);
                return(Response.FromValue(value, message.Response));
            }
Example #2
0
 internal VirtualDesktop(ArmClient client, VirtualDesktopData data) : this(client, data.Id)
 {
     HasData = true;
     _data   = data;
 }