mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-19 09:35:36 -05:00
Create Firewall Rule support with a simple Resource Provider implementation
Implementation of the resource provider APIs in order to support Create Firewall Rule. Provides definition for a ResourceProvider and Authentication service. The ResourceProvider supports firewall rules for now, and since authentication is routed through that method it will call into the auth service to set up the current account to be used. Additional notes: - Fixed deserialization by adding an Accept header. This shouldn't be necessary, but for some reason the firewall rule defaults to XML without this - Use generic server list and parse the ID to get the resource group, avoiding a large number of extra calls for each RG - Errors now include error message from the API
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
//
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System.Net;
|
||||
|
||||
namespace Microsoft.SqlTools.ResourceProvider.Core.Firewall
|
||||
{
|
||||
/// <summary>
|
||||
/// The response that's created by firewall rule parser
|
||||
/// </summary>
|
||||
public class FirewallParserResponse
|
||||
{
|
||||
public FirewallParserResponse(bool firewallRuleErrorDetected, IPAddress blockedIpAddress)
|
||||
{
|
||||
FirewallRuleErrorDetected = firewallRuleErrorDetected;
|
||||
BlockedIpAddress = blockedIpAddress;
|
||||
}
|
||||
|
||||
public FirewallParserResponse()
|
||||
{
|
||||
FirewallRuleErrorDetected = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if firewall rule is detected, otherwise returns false.
|
||||
/// </summary>
|
||||
public bool FirewallRuleErrorDetected
|
||||
{
|
||||
get; private set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the blocked ip address if firewall rule is detected
|
||||
/// </summary>
|
||||
public IPAddress BlockedIpAddress
|
||||
{
|
||||
get; private set;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user