mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Add support for firewall rule name (#21430)
This commit is contained in:
@@ -7,35 +7,98 @@ import { RequestType } from 'vscode-languageclient';
|
||||
import * as azdata from 'azdata';
|
||||
|
||||
// ------------------------------- < Resource Events > ------------------------------------
|
||||
|
||||
/**
|
||||
* A request to open up a firewall rule
|
||||
*/
|
||||
export namespace CreateFirewallRuleRequest {
|
||||
export const type = new RequestType<CreateFirewallRuleParams, CreateFirewallRuleResponse, void, void>('resource/createFirewallRule');
|
||||
}
|
||||
|
||||
/**
|
||||
* Firewall rule request handler
|
||||
*/
|
||||
export namespace HandleFirewallRuleRequest {
|
||||
export const type = new RequestType<HandleFirewallRuleParams, HandleFirewallRuleResponse, void, void>('resource/handleFirewallRule');
|
||||
}
|
||||
|
||||
// Firewall rule interfaces
|
||||
/**
|
||||
* Firewall rule creation parameters
|
||||
*/
|
||||
export interface CreateFirewallRuleParams {
|
||||
/**
|
||||
* Account information to use in connecting to Azure
|
||||
*/
|
||||
account: azdata.Account;
|
||||
/**
|
||||
* Fully qualified name of the server to create a new firewall rule on
|
||||
*/
|
||||
serverName: string;
|
||||
/**
|
||||
* Firewall rule name to set
|
||||
*/
|
||||
firewallRuleName: string;
|
||||
/**
|
||||
* Start of the IP address range
|
||||
*/
|
||||
startIpAddress: string;
|
||||
/**
|
||||
* End of the IP address range
|
||||
*/
|
||||
endIpAddress: string;
|
||||
/**
|
||||
* Per-tenant token mappings. Ideally would be set independently of this call,
|
||||
* but for now this allows us to get the tokens necessary to find a server and open a firewall rule
|
||||
*/
|
||||
securityTokenMappings: {};
|
||||
}
|
||||
|
||||
/**
|
||||
* Firewall rule creation response
|
||||
*/
|
||||
interface CreateFirewallRuleResponse {
|
||||
/**
|
||||
* Whether or not request can be handled.
|
||||
*/
|
||||
result: boolean;
|
||||
/**
|
||||
* Contains error message, if request could not be handled.
|
||||
*/
|
||||
errorMessage: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Firewall rule handling parameters
|
||||
*/
|
||||
export interface HandleFirewallRuleParams {
|
||||
/**
|
||||
* The error code used to defined the error type
|
||||
*/
|
||||
errorCode: number;
|
||||
/**
|
||||
* The error message from which to parse the IP address
|
||||
*/
|
||||
errorMessage: string;
|
||||
/**
|
||||
* The connection type, for example MSSQL
|
||||
*/
|
||||
connectionTypeId: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Response to the check for Firewall rule support given an error message
|
||||
*/
|
||||
interface HandleFirewallRuleResponse {
|
||||
/**
|
||||
* Whether or not request can be handled.
|
||||
*/
|
||||
result: boolean;
|
||||
/**
|
||||
* Contains error message, if request could not be handled.
|
||||
*/
|
||||
errorMessage: string;
|
||||
/**
|
||||
* If handled, the default IP address to send back; so users can tell what their blocked IP is.
|
||||
*/
|
||||
ipAddress: string;
|
||||
}
|
||||
|
||||
@@ -63,6 +63,7 @@ class FireWallFeature extends SqlOpsFeature<any> {
|
||||
function asCreateFirewallRuleParams(account: azdata.Account, params: azdata.FirewallRuleInfo): CreateFirewallRuleParams {
|
||||
return {
|
||||
account: account,
|
||||
firewallRuleName: params.firewallRuleName,
|
||||
serverName: params.serverName,
|
||||
startIpAddress: params.startIpAddress,
|
||||
endIpAddress: params.endIpAddress,
|
||||
|
||||
Reference in New Issue
Block a user