public async Task <Response <HubIpConfigurationData> > GetAsync(string subscriptionId, string resourceGroupName, string virtualHubName, string ipConfigName, 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 (ipConfigName == null)
            {
                throw new ArgumentNullException(nameof(ipConfigName));
            }

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

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

                value = HubIpConfigurationData.DeserializeHubIpConfigurationData(document.RootElement);
                return(Response.FromValue(value, message.Response));
            }
示例#2
0
        HubIpConfiguration IOperationSource <HubIpConfiguration> .CreateResult(Response response, CancellationToken cancellationToken)
        {
            using var document = JsonDocument.Parse(response.ContentStream);
            var data = HubIpConfigurationData.DeserializeHubIpConfigurationData(document.RootElement);

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