Esempio n. 1
0
        public async Task <Response <OutboundFirewallRuleData> > GetAsync(string subscriptionId, string resourceGroupName, string serverName, string outboundRuleFqdn, CancellationToken cancellationToken = default)
        {
            if (subscriptionId == null)
            {
                throw new ArgumentNullException(nameof(subscriptionId));
            }
            if (resourceGroupName == null)
            {
                throw new ArgumentNullException(nameof(resourceGroupName));
            }
            if (serverName == null)
            {
                throw new ArgumentNullException(nameof(serverName));
            }
            if (outboundRuleFqdn == null)
            {
                throw new ArgumentNullException(nameof(outboundRuleFqdn));
            }

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

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

                value = OutboundFirewallRuleData.DeserializeOutboundFirewallRuleData(document.RootElement);
                return(Response.FromValue(value, message.Response));
            }
        OutboundFirewallRule IOperationSource <OutboundFirewallRule> .CreateResult(Response response, CancellationToken cancellationToken)
        {
            using var document = JsonDocument.Parse(response.ContentStream);
            var data = OutboundFirewallRuleData.DeserializeOutboundFirewallRuleData(document.RootElement);

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