Exemple #1
0
        InboundEndpointResource IOperationSource <InboundEndpointResource> .CreateResult(Response response, CancellationToken cancellationToken)
        {
            using var document = JsonDocument.Parse(response.ContentStream);
            var data = InboundEndpointData.DeserializeInboundEndpointData(document.RootElement);

            return(new InboundEndpointResource(_client, data));
        }
Exemple #2
0
        public async Task <Response <InboundEndpointData> > GetAsync(string subscriptionId, string resourceGroupName, string dnsResolverName, string inboundEndpointName, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId));
            Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName));
            Argument.AssertNotNullOrEmpty(dnsResolverName, nameof(dnsResolverName));
            Argument.AssertNotNullOrEmpty(inboundEndpointName, nameof(inboundEndpointName));

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

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

                value = InboundEndpointData.DeserializeInboundEndpointData(document.RootElement);
                return(Response.FromValue(value, message.Response));
            }