Esempio n. 1
0
        HubIPConfigurationResource IOperationSource <HubIPConfigurationResource> .CreateResult(Response response, CancellationToken cancellationToken)
        {
            using var document = JsonDocument.Parse(response.ContentStream);
            var data = HubIPConfigurationData.DeserializeHubIPConfigurationData(document.RootElement);

            return(new HubIPConfigurationResource(_client, data));
        }
Esempio n. 2
0
        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));
            }