mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-24 09:35:37 -05:00
Add Agent Service configuration request methods (#1608)
* WIP 1 * WIP 2 * Add Agent Service configuration request methods * Fix typo * Tabify sqlops.d.ts.
This commit is contained in:
@@ -23,7 +23,7 @@ export interface IJobManagementService {
|
||||
|
||||
getJobHistory(connectionUri: string, jobID: string): Thenable<sqlops.AgentJobHistoryResult>;
|
||||
|
||||
jobAction(connectionUri: string, jobName: string, action: string): Thenable<sqlops.AgentJobActionResult>;
|
||||
jobAction(connectionUri: string, jobName: string, action: string): Thenable<sqlops.ResultStatus>;
|
||||
|
||||
addToCache(server: string, cache: JobCacheObject);
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ export class JobManagementService implements IJobManagementService {
|
||||
});
|
||||
}
|
||||
|
||||
public jobAction(connectionUri: string, jobName: string, action: string): Thenable<sqlops.AgentJobActionResult> {
|
||||
public jobAction(connectionUri: string, jobName: string, action: string): Thenable<sqlops.ResultStatus> {
|
||||
return this._runAction(connectionUri, (runner) => {
|
||||
return runner.jobAction(connectionUri, jobName, action);
|
||||
});
|
||||
|
||||
@@ -33,7 +33,7 @@ export class RunJobAction extends Action {
|
||||
let ownerUri = context.ownerUri;
|
||||
return new TPromise<boolean>((resolve, reject) => {
|
||||
this.jobManagementService.jobAction(ownerUri, jobName, JobHistoryActions.Run).then(result => {
|
||||
if (result.succeeded) {
|
||||
if (result.success) {
|
||||
var startMsg = nls.localize('jobSuccessfullyStarted', ': The job was successfully started.');
|
||||
this.notificationService.notify({
|
||||
severity: Severity.Info,
|
||||
@@ -68,7 +68,7 @@ export class StopJobAction extends Action {
|
||||
let ownerUri = context.ownerUri;
|
||||
return new TPromise<boolean>((resolve, reject) => {
|
||||
this.jobManagementService.jobAction(ownerUri, jobName, JobHistoryActions.Stop).then(result => {
|
||||
if (result.succeeded) {
|
||||
if (result.success) {
|
||||
var stopMsg = nls.localize('jobSuccessfullyStopped', ': The job was successfully stopped.');
|
||||
this.notificationService.notify({
|
||||
severity: Severity.Info,
|
||||
|
||||
201
src/sql/sqlops.d.ts
vendored
201
src/sql/sqlops.d.ts
vendored
@@ -1025,22 +1025,33 @@ declare module 'sqlops' {
|
||||
getDatabaseInfo(connectionUri: string): Thenable<DatabaseInfo>;
|
||||
}
|
||||
|
||||
// Agent Services interfaces
|
||||
export interface AgentJobsResult {
|
||||
succeeded: boolean;
|
||||
errorMessage: string;
|
||||
jobs: AgentJobInfo[];
|
||||
// Agent Services types
|
||||
export enum WeekDays {
|
||||
sunday = 1,
|
||||
monday = 2,
|
||||
tuesday = 4,
|
||||
wednesday = 8,
|
||||
thursday = 16,
|
||||
friday = 32,
|
||||
weekDays = 62,
|
||||
saturday = 64,
|
||||
weekEnds = 65,
|
||||
everyDay = 127
|
||||
}
|
||||
|
||||
export interface AgentJobHistoryResult {
|
||||
succeeded: boolean;
|
||||
errorMessage: string;
|
||||
jobs: AgentJobHistoryInfo[];
|
||||
export enum NotifyMethods {
|
||||
none = 0,
|
||||
notifyEmail = 1,
|
||||
pager = 2,
|
||||
netSend = 4,
|
||||
notifyAll = 7
|
||||
}
|
||||
|
||||
export interface AgentJobActionResult {
|
||||
succeeded: boolean;
|
||||
errorMessage: string;
|
||||
export enum AlertType {
|
||||
sqlServerEvent = 1,
|
||||
sqlServerPerformanceCondition = 2,
|
||||
nonSqlServerEvent = 3,
|
||||
wmiEvent = 4
|
||||
}
|
||||
|
||||
export interface AgentJobInfo {
|
||||
@@ -1061,7 +1072,8 @@ declare module 'sqlops' {
|
||||
jobId: string;
|
||||
}
|
||||
|
||||
export interface AgentJobStep {
|
||||
export interface AgentJobStepInfo {
|
||||
jobId: string;
|
||||
stepId: string;
|
||||
stepName: string;
|
||||
message: string;
|
||||
@@ -1086,13 +1098,168 @@ declare module 'sqlops' {
|
||||
operatorPaged: string;
|
||||
retriesAttempted: string;
|
||||
server: string;
|
||||
steps: AgentJobStep[];
|
||||
steps: AgentJobStepInfo[];
|
||||
}
|
||||
|
||||
export interface AgentProxyInfo {
|
||||
id: number;
|
||||
accountName: string;
|
||||
description: string;
|
||||
credentialName: string;
|
||||
credentialIdentity: string;
|
||||
credentialId: number;
|
||||
isEnabled: boolean;
|
||||
}
|
||||
|
||||
export interface AgentAlertInfo {
|
||||
id: number;
|
||||
delayBetweenResponses: number;
|
||||
eventDescriptionKeyword: string;
|
||||
eventSource: string;
|
||||
hasNotification: number;
|
||||
includeEventDescription: NotifyMethods;
|
||||
isEnabled: boolean;
|
||||
jobId: string;
|
||||
jobName: string;
|
||||
lastOccurrenceDate: string;
|
||||
lastResponseDate: string;
|
||||
messageId: number;
|
||||
notificationMessage: string;
|
||||
occurrenceCount: number;
|
||||
performanceCondition: string;
|
||||
severity: number;
|
||||
databaseName: string;
|
||||
countResetDate: string;
|
||||
categoryName: string;
|
||||
alertType: AlertType;
|
||||
wmiEventNamespace: string;
|
||||
wmiEventQuery: string;
|
||||
}
|
||||
|
||||
export interface AgentOperatorInfo {
|
||||
name: string;
|
||||
id: number;
|
||||
emailAddress: string;
|
||||
enabled: boolean;
|
||||
lastEmailDate: string;
|
||||
lastNetSendDate: string;
|
||||
lastPagerDate: string;
|
||||
pagerAddress: string;
|
||||
categoryName: string;
|
||||
pagerDays: WeekDays;
|
||||
saturdayPagerEndTime: string;
|
||||
saturdayPagerStartTime: string;
|
||||
sundayPagerEndTime: string;
|
||||
sundayPagerStartTime: string;
|
||||
netSendAddress: string;
|
||||
weekdayPagerStartTime: string;
|
||||
weekdayPagerEndTime: string;
|
||||
}
|
||||
|
||||
export interface ResultStatus {
|
||||
success: boolean;
|
||||
errorMessage: string;
|
||||
}
|
||||
|
||||
export interface AgentJobsResult extends ResultStatus {
|
||||
jobs: AgentJobInfo[];
|
||||
}
|
||||
|
||||
export interface AgentJobHistoryResult extends ResultStatus {
|
||||
jobs: AgentJobHistoryInfo[];
|
||||
}
|
||||
|
||||
export interface CreateAgentJobResult extends ResultStatus {
|
||||
job: AgentJobInfo;
|
||||
}
|
||||
|
||||
export interface UpdateAgentJobResult extends ResultStatus {
|
||||
job: AgentJobInfo;
|
||||
}
|
||||
|
||||
export interface CreateAgentJobStepResult extends ResultStatus {
|
||||
step: AgentJobStepInfo;
|
||||
}
|
||||
|
||||
export interface UpdateAgentJobStepResult extends ResultStatus {
|
||||
step: AgentJobStepInfo;
|
||||
}
|
||||
|
||||
export interface CreateAgentProxyResult extends ResultStatus {
|
||||
step: AgentJobStepInfo;
|
||||
}
|
||||
|
||||
export interface UpdateAgentProxyResult extends ResultStatus {
|
||||
step: AgentJobStepInfo;
|
||||
}
|
||||
|
||||
export interface AgentAlertsResult extends ResultStatus {
|
||||
alerts: AgentAlertInfo[];
|
||||
}
|
||||
|
||||
export interface CreateAgentAlertResult extends ResultStatus {
|
||||
alert: AgentJobStepInfo;
|
||||
}
|
||||
|
||||
export interface UpdateAgentAlertResult extends ResultStatus {
|
||||
alert: AgentJobStepInfo;
|
||||
}
|
||||
|
||||
export interface AgentOperatorsResult extends ResultStatus {
|
||||
operators: AgentOperatorInfo[];
|
||||
}
|
||||
|
||||
export interface CreateAgentOperatorResult extends ResultStatus {
|
||||
operator: AgentOperatorInfo;
|
||||
}
|
||||
|
||||
export interface UpdateAgentOperatorResult extends ResultStatus {
|
||||
operator: AgentOperatorInfo;
|
||||
}
|
||||
|
||||
export interface AgentProxiesResult extends ResultStatus {
|
||||
operators: AgentOperatorInfo[];
|
||||
}
|
||||
|
||||
export interface CreateAgentProxyResult extends ResultStatus {
|
||||
operator: AgentOperatorInfo;
|
||||
}
|
||||
|
||||
export interface UpdateAgentProxyResult extends ResultStatus {
|
||||
operator: AgentOperatorInfo;
|
||||
}
|
||||
|
||||
export interface AgentServicesProvider extends DataProvider {
|
||||
getJobs(connectionUri: string): Thenable<AgentJobsResult>;
|
||||
getJobHistory(connectionUri: string, jobId: string): Thenable<AgentJobHistoryResult>;
|
||||
jobAction(connectionUri: string, jobName: string, action: string): Thenable<AgentJobActionResult>;
|
||||
// Job management methods
|
||||
getJobs(ownerUri: string): Thenable<AgentJobsResult>;
|
||||
getJobHistory(ownerUri: string, jobId: string): Thenable<AgentJobHistoryResult>;
|
||||
jobAction(ownerUri: string, jobName: string, action: string): Thenable<ResultStatus>;
|
||||
createJob(ownerUri: string, jobInfo: AgentJobInfo): Thenable<CreateAgentJobResult>;
|
||||
updateJob(ownerUri: string, originalJobName: string, jobInfo: AgentJobInfo): Thenable<UpdateAgentJobResult>;
|
||||
deleteJob(ownerUri: string, jobInfo: AgentJobInfo): Thenable<ResultStatus>;
|
||||
|
||||
// Job Step management methods
|
||||
createJobStep(ownerUri: string, jobInfo: AgentJobStepInfo): Thenable<CreateAgentJobStepResult>;
|
||||
updateJobStep(ownerUri: string, originalJobStepName: string, jobInfo: AgentJobStepInfo): Thenable<UpdateAgentJobStepResult>;
|
||||
deleteJobStep(ownerUri: string, jobInfo: AgentJobStepInfo): Thenable<ResultStatus>;
|
||||
|
||||
// Alert management methods
|
||||
getAlerts(ownerUri: string): Thenable<AgentAlertsResult>;
|
||||
createAlert(ownerUri: string, alertInfo: AgentAlertInfo): Thenable<CreateAgentAlertResult>;
|
||||
updateAlert(ownerUri: string, originalAlertName: string, alertInfo: AgentAlertInfo): Thenable<UpdateAgentAlertResult>;
|
||||
deleteAlert(ownerUri: string, alertInfo: AgentAlertInfo): Thenable<ResultStatus>;
|
||||
|
||||
// Operator management methods
|
||||
getOperators(ownerUri: string): Thenable<AgentOperatorsResult>;
|
||||
createOperator(ownerUri: string, operatorInfo: AgentOperatorInfo): Thenable<CreateAgentOperatorResult>;
|
||||
updateOperator(ownerUri: string, originalOperatorName: string, operatorInfo: AgentOperatorInfo): Thenable<UpdateAgentOperatorResult>;
|
||||
deleteOperator(ownerUri: string, operatorInfo: AgentOperatorInfo): Thenable<ResultStatus>;
|
||||
|
||||
// Proxy management methods
|
||||
getProxies(ownerUri: string): Thenable<AgentProxiesResult>;
|
||||
createProxy(ownerUri: string, proxyInfo: AgentProxyInfo): Thenable<CreateAgentOperatorResult>;
|
||||
updateProxy(ownerUri: string, originalProxyName: string, proxyInfo: AgentProxyInfo): Thenable<UpdateAgentOperatorResult>;
|
||||
deleteProxy(ownerUri: string, proxyInfo: AgentProxyInfo): Thenable<ResultStatus>;
|
||||
}
|
||||
|
||||
// Task service interfaces ----------------------------------------------------------------------------
|
||||
|
||||
@@ -63,6 +63,37 @@ export enum ScriptOperation {
|
||||
Alter = 6
|
||||
}
|
||||
|
||||
export enum WeekDays
|
||||
{
|
||||
sunday = 1,
|
||||
monday = 2,
|
||||
tuesday = 4,
|
||||
wednesday = 8,
|
||||
thursday = 16,
|
||||
friday = 32,
|
||||
weekDays = 62,
|
||||
saturday = 64,
|
||||
weekEnds = 65,
|
||||
everyDay = 127
|
||||
}
|
||||
|
||||
export enum NotifyMethods
|
||||
{
|
||||
none = 0,
|
||||
notifyEmail = 1,
|
||||
pager = 2,
|
||||
netSend = 4,
|
||||
notifyAll = 7
|
||||
}
|
||||
|
||||
export enum AlertType
|
||||
{
|
||||
sqlServerEvent = 1,
|
||||
sqlServerPerformanceCondition = 2,
|
||||
nonSqlServerEvent = 3,
|
||||
wmiEvent = 4
|
||||
}
|
||||
|
||||
export enum ModelComponentTypes {
|
||||
NavContainer,
|
||||
FlexContainer,
|
||||
|
||||
@@ -532,7 +532,7 @@ export class ExtHostDataProtocol extends ExtHostDataProtocolShape {
|
||||
/**
|
||||
* Run an action on a job
|
||||
*/
|
||||
public $jobAction(handle: number, ownerUri: string, jobName: string, action: string): Thenable<sqlops.AgentJobActionResult> {
|
||||
public $jobAction(handle: number, ownerUri: string, jobName: string, action: string): Thenable<sqlops.ResultStatus> {
|
||||
return this._resolveProvider<sqlops.AgentServicesProvider>(handle).jobAction(ownerUri, jobName, action);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -339,7 +339,7 @@ export class MainThreadDataProtocol implements MainThreadDataProtocolShape {
|
||||
getJobHistory(connectionUri: string, jobID: string): Thenable<sqlops.AgentJobHistoryResult> {
|
||||
return self._proxy.$getJobHistory(handle, connectionUri, jobID);
|
||||
},
|
||||
jobAction(connectionUri: string, jobName: string, action: string): Thenable<sqlops.AgentJobActionResult> {
|
||||
jobAction(connectionUri: string, jobName: string, action: string): Thenable<sqlops.ResultStatus> {
|
||||
return self._proxy.$jobAction(handle, connectionUri, jobName, action);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -377,6 +377,9 @@ export function createApiFactory(
|
||||
TaskStatus: sqlExtHostTypes.TaskStatus,
|
||||
TaskExecutionMode: sqlExtHostTypes.TaskExecutionMode,
|
||||
ScriptOperation: sqlExtHostTypes.ScriptOperation,
|
||||
WeekDays: sqlExtHostTypes.WeekDays,
|
||||
NotifyMethods: sqlExtHostTypes.NotifyMethods,
|
||||
AlertType: sqlExtHostTypes.AlertType,
|
||||
window,
|
||||
tasks,
|
||||
dashboard,
|
||||
|
||||
@@ -327,7 +327,7 @@ export abstract class ExtHostDataProtocolShape {
|
||||
/**
|
||||
* Run an action on a Job
|
||||
*/
|
||||
$jobAction(handle: number, ownerUri: string, jobName: string, action: string): Thenable<sqlops.AgentJobActionResult> { throw ni(); }
|
||||
$jobAction(handle: number, ownerUri: string, jobName: string, action: string): Thenable<sqlops.ResultStatus> { throw ni(); }
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user