PrivateDnsZoneGroupResource IOperationSource <PrivateDnsZoneGroupResource> .CreateResult(Response response, CancellationToken cancellationToken)
        {
            using var document = JsonDocument.Parse(response.ContentStream);
            var data = PrivateDnsZoneGroupData.DeserializePrivateDnsZoneGroupData(document.RootElement);

            return(new PrivateDnsZoneGroupResource(_client, data));
        }
Exemplo n.º 2
0
        public async Task <Response <PrivateDnsZoneGroupData> > GetAsync(string resourceGroupName, string privateEndpointName, string privateDnsZoneGroupName, CancellationToken cancellationToken = default)
        {
            if (resourceGroupName == null)
            {
                throw new ArgumentNullException(nameof(resourceGroupName));
            }
            if (privateEndpointName == null)
            {
                throw new ArgumentNullException(nameof(privateEndpointName));
            }
            if (privateDnsZoneGroupName == null)
            {
                throw new ArgumentNullException(nameof(privateDnsZoneGroupName));
            }

            using var message = CreateGetRequest(resourceGroupName, privateEndpointName, privateDnsZoneGroupName);
            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);

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

                value = PrivateDnsZoneGroupData.DeserializePrivateDnsZoneGroupData(document.RootElement);
                return(Response.FromValue(value, message.Response));
            }