VirtualNetworkLinkResource IOperationSource <VirtualNetworkLinkResource> .CreateResult(Response response, CancellationToken cancellationToken)
        {
            using var document = JsonDocument.Parse(response.ContentStream);
            var data = VirtualNetworkLinkData.DeserializeVirtualNetworkLinkData(document.RootElement);

            return(new VirtualNetworkLinkResource(_client, data));
        }
Esempio n. 2
0
        public async Task <Response <VirtualNetworkLinkData> > GetAsync(string subscriptionId, string resourceGroupName, string dnsForwardingRulesetName, string virtualNetworkLinkName, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId));
            Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName));
            Argument.AssertNotNullOrEmpty(dnsForwardingRulesetName, nameof(dnsForwardingRulesetName));
            Argument.AssertNotNullOrEmpty(virtualNetworkLinkName, nameof(virtualNetworkLinkName));

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

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

                value = VirtualNetworkLinkData.DeserializeVirtualNetworkLinkData(document.RootElement);
                return(Response.FromValue(value, message.Response));
            }