@ampsec/platform-client 11.0.0 → 11.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/src/FilterCriteria.d.ts +2 -0
- package/build/src/dto/enums/index.d.ts +1 -0
- package/build/src/dto/enums/index.js +1 -0
- package/build/src/dto/enums/index.js.map +1 -1
- package/build/src/dto/enums/jobExecution.status.d.ts +7 -0
- package/build/src/dto/enums/jobExecution.status.js +13 -0
- package/build/src/dto/enums/jobExecution.status.js.map +1 -0
- package/build/src/dto/platform/index.d.ts +2 -0
- package/build/src/dto/platform/index.js +2 -0
- package/build/src/dto/platform/index.js.map +1 -1
- package/build/src/dto/platform/platform.jobExecutionState.dto.d.ts +26 -0
- package/build/src/dto/platform/platform.jobExecutionState.dto.js +3 -0
- package/build/src/dto/platform/platform.jobExecutionState.dto.js.map +1 -0
- package/build/src/dto/platform/platform.jobSpec.dto.d.ts +30 -0
- package/build/src/dto/platform/platform.jobSpec.dto.js +3 -0
- package/build/src/dto/platform/platform.jobSpec.dto.js.map +1 -0
- package/build/src/services/AmpSdk.d.ts +4 -0
- package/build/src/services/AmpSdk.js +2 -0
- package/build/src/services/AmpSdk.js.map +1 -1
- package/build/src/services/constants.d.ts +2 -0
- package/build/src/services/constants.js +2 -0
- package/build/src/services/constants.js.map +1 -1
- package/package.json +1 -1
- package/src/FilterCriteria.ts +2 -0
- package/src/dto/enums/index.ts +1 -0
- package/src/dto/enums/jobExecution.status.ts +8 -0
- package/src/dto/platform/index.ts +2 -0
- package/src/dto/platform/platform.jobExecutionState.dto.ts +29 -0
- package/src/dto/platform/platform.jobSpec.dto.ts +34 -0
- package/src/services/AmpSdk.ts +6 -0
- package/src/services/constants.ts +2 -0
|
@@ -18,4 +18,5 @@ __exportStar(require("./agent.status"), exports);
|
|
|
18
18
|
__exportStar(require("./connector.status"), exports);
|
|
19
19
|
__exportStar(require("./finding.severity"), exports);
|
|
20
20
|
__exportStar(require("./finding.status"), exports);
|
|
21
|
+
__exportStar(require("./jobExecution.status"), exports);
|
|
21
22
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/dto/enums/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAA+B;AAC/B,qDAAmC;AACnC,qDAAmC;AACnC,mDAAiC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/dto/enums/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAA+B;AAC/B,qDAAmC;AACnC,qDAAmC;AACnC,mDAAiC;AACjC,wDAAsC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.JobExecutionStatus = void 0;
|
|
4
|
+
/* eslint-disable no-unused-vars */
|
|
5
|
+
var JobExecutionStatus;
|
|
6
|
+
(function (JobExecutionStatus) {
|
|
7
|
+
JobExecutionStatus["SCHEDULED"] = "SCHEDULED";
|
|
8
|
+
JobExecutionStatus["PAUSED"] = "PAUSED";
|
|
9
|
+
JobExecutionStatus["RUNNING"] = "RUNNING";
|
|
10
|
+
JobExecutionStatus["FAILED"] = "FAILED";
|
|
11
|
+
JobExecutionStatus["SUCCEEDED"] = "SUCCEEDED";
|
|
12
|
+
})(JobExecutionStatus = exports.JobExecutionStatus || (exports.JobExecutionStatus = {}));
|
|
13
|
+
//# sourceMappingURL=jobExecution.status.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jobExecution.status.js","sourceRoot":"","sources":["../../../../src/dto/enums/jobExecution.status.ts"],"names":[],"mappings":";;;AAAA,mCAAmC;AACnC,IAAY,kBAMX;AAND,WAAY,kBAAkB;IAC5B,6CAAuB,CAAA;IACvB,uCAAiB,CAAA;IACjB,yCAAmB,CAAA;IACnB,uCAAiB,CAAA;IACjB,6CAAuB,CAAA;AACzB,CAAC,EANW,kBAAkB,GAAlB,0BAAkB,KAAlB,0BAAkB,QAM7B"}
|
|
@@ -2,6 +2,8 @@ export * from './platform.agents.dto';
|
|
|
2
2
|
export * from './platform.assets.dto';
|
|
3
3
|
export * from './platform.connectors.dto';
|
|
4
4
|
export * from './platform.findings.dto';
|
|
5
|
+
export * from './platform.jobExecutionState.dto';
|
|
6
|
+
export * from './platform.jobSpec.dto';
|
|
5
7
|
export * from './platform.providers.dto';
|
|
6
8
|
export * from './platform.reportResults.dto';
|
|
7
9
|
export * from './platform.saasAssets.dto';
|
|
@@ -18,6 +18,8 @@ __exportStar(require("./platform.agents.dto"), exports);
|
|
|
18
18
|
__exportStar(require("./platform.assets.dto"), exports);
|
|
19
19
|
__exportStar(require("./platform.connectors.dto"), exports);
|
|
20
20
|
__exportStar(require("./platform.findings.dto"), exports);
|
|
21
|
+
__exportStar(require("./platform.jobExecutionState.dto"), exports);
|
|
22
|
+
__exportStar(require("./platform.jobSpec.dto"), exports);
|
|
21
23
|
__exportStar(require("./platform.providers.dto"), exports);
|
|
22
24
|
__exportStar(require("./platform.reportResults.dto"), exports);
|
|
23
25
|
__exportStar(require("./platform.saasAssets.dto"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/dto/platform/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wDAAsC;AACtC,wDAAsC;AACtC,4DAA0C;AAC1C,0DAAwC;AACxC,2DAAyC;AACzC,+DAA6C;AAC7C,4DAA0C;AAC1C,gEAA8C;AAC9C,2DAAyC;AACzC,yDAAuC;AACvC,uDAAqC;AACrC,qDAAmC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/dto/platform/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wDAAsC;AACtC,wDAAsC;AACtC,4DAA0C;AAC1C,0DAAwC;AACxC,mEAAiD;AACjD,yDAAuC;AACvC,2DAAyC;AACzC,+DAA6C;AAC7C,4DAA0C;AAC1C,gEAA8C;AAC9C,2DAAyC;AACzC,yDAAuC;AACvC,uDAAqC;AACrC,qDAAmC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { BaseDto, BaseUpsertDto } from '../base.dto';
|
|
2
|
+
import { JobExecutionStatus } from '../enums/jobExecution.status';
|
|
3
|
+
import { TenantBased, UpsertTenantBased } from './tenant.based.dto';
|
|
4
|
+
export type JobExecutionPagination = {
|
|
5
|
+
/** Expected number of object to process for whole job. */
|
|
6
|
+
expected: number;
|
|
7
|
+
/** Total number of object that have already been processed. */
|
|
8
|
+
processed: number;
|
|
9
|
+
};
|
|
10
|
+
export type PlatformJobExecutionStateUpsertDto = BaseUpsertDto & {
|
|
11
|
+
/** `JobSpecification` ID */
|
|
12
|
+
specId: string;
|
|
13
|
+
/** Latest execution status */
|
|
14
|
+
status: JobExecutionStatus;
|
|
15
|
+
/** Date the job execution started */
|
|
16
|
+
startedAt: Date;
|
|
17
|
+
/** Optional date the job execution finished */
|
|
18
|
+
finishedAt: Date | null;
|
|
19
|
+
/** High level indication of progress */
|
|
20
|
+
pagination: JobExecutionPagination;
|
|
21
|
+
/** Optional error message. */
|
|
22
|
+
error: string | null;
|
|
23
|
+
/** Scratch space for job executors to maintain state incase of failure. */
|
|
24
|
+
scratch: unknown;
|
|
25
|
+
} & UpsertTenantBased;
|
|
26
|
+
export type PlatformJobExecutionStateDto = BaseDto & PlatformJobExecutionStateUpsertDto & TenantBased;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform.jobExecutionState.dto.js","sourceRoot":"","sources":["../../../../src/dto/platform/platform.jobExecutionState.dto.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { BaseDto, BaseUpsertDto } from '../base.dto';
|
|
2
|
+
import { JobExecutionStatus } from '../enums/jobExecution.status';
|
|
3
|
+
import { TenantBased, UpsertTenantBased } from './tenant.based.dto';
|
|
4
|
+
export type BasicJobSchedule = {
|
|
5
|
+
kind: 'basic';
|
|
6
|
+
offset: number;
|
|
7
|
+
interval: number;
|
|
8
|
+
};
|
|
9
|
+
export type IngestionPipelineContext = {
|
|
10
|
+
kind: 'INGESTION_PIPELINE_CONTEXT';
|
|
11
|
+
cid: string;
|
|
12
|
+
scratch: unknown;
|
|
13
|
+
};
|
|
14
|
+
export type PlatformJobSpecUpsertDto = BaseUpsertDto & {
|
|
15
|
+
/** Human readable name of the Job Specification */
|
|
16
|
+
displayValue: string;
|
|
17
|
+
/** Connector Id */
|
|
18
|
+
cid: string;
|
|
19
|
+
/** Schedule configuration for the job. */
|
|
20
|
+
schedule: BasicJobSchedule;
|
|
21
|
+
/** Context for the job execution, e.g. ingestion pipeline */
|
|
22
|
+
inputContext: IngestionPipelineContext;
|
|
23
|
+
/** Status of the current or latest job execution */
|
|
24
|
+
status: JobExecutionStatus;
|
|
25
|
+
/** Date of the next job execution */
|
|
26
|
+
nextExecutionAt: string;
|
|
27
|
+
/** Optional error message from the latest execution. Expected to be `null` if `status=JobExecutionStatus.SUCCEEDED */
|
|
28
|
+
error: string | null;
|
|
29
|
+
} & UpsertTenantBased;
|
|
30
|
+
export type PlatformJobSpecDto = BaseDto & PlatformJobSpecUpsertDto & TenantBased;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform.jobSpec.dto.js","sourceRoot":"","sources":["../../../../src/dto/platform/platform.jobSpec.dto.ts"],"names":[],"mappings":""}
|
|
@@ -2,6 +2,8 @@ import { PlatformAgentDto, PlatformAgentUpsertDto, PlatformAssetDto, PlatformAss
|
|
|
2
2
|
import { AmpEntityService, AmpGlobalEntityService, AmpSaaSEntityService } from './entity.service';
|
|
3
3
|
import { AmpDataService } from './data.service';
|
|
4
4
|
import { AmpRestClientOptions, RestClient } from './rest';
|
|
5
|
+
import { PlatformJobSpecDto, PlatformJobSpecUpsertDto } from '../dto/platform/platform.jobSpec.dto';
|
|
6
|
+
import { PlatformJobExecutionStateDto, PlatformJobExecutionStateUpsertDto } from '../dto/platform/platform.jobExecutionState.dto';
|
|
5
7
|
export type AmpSdkOptions = AmpRestClientOptions;
|
|
6
8
|
/**
|
|
7
9
|
* AMP API
|
|
@@ -19,6 +21,8 @@ export declare class AmpSdkServices {
|
|
|
19
21
|
readonly asset: AmpGlobalEntityService<PlatformAssetUpsertDto, PlatformAssetDto>;
|
|
20
22
|
readonly connectors: AmpEntityService<PlatformConnectorUpsertDto, PlatformConnectorDto>;
|
|
21
23
|
readonly findings: AmpSaaSEntityService<PlatformFindingUpsertDto, PlatformFindingDto>;
|
|
24
|
+
readonly jobExecutions: AmpEntityService<PlatformJobExecutionStateUpsertDto, PlatformJobExecutionStateDto>;
|
|
25
|
+
readonly jobs: AmpEntityService<PlatformJobSpecUpsertDto, PlatformJobSpecDto>;
|
|
22
26
|
readonly providers: AmpDataService<ProviderDto>;
|
|
23
27
|
readonly reportResults: AmpSaaSEntityService<PlatformReportResultUpsertDto, PlatformReportResultDto>;
|
|
24
28
|
readonly saasAssets: AmpSaaSEntityService<PlatformSaasAssetUpsertDto, PlatformSaasAssetDto>;
|
|
@@ -22,6 +22,8 @@ class AmpSdkServices {
|
|
|
22
22
|
this.asset = new entity_service_1.AmpGlobalEntityServiceImpl(rest, constants_1.KIND.ASSETS, constants_1.TARGET_API_PLATFORM);
|
|
23
23
|
this.connectors = new entity_service_1.AmpEntityServiceImpl(rest, constants_1.KIND.CONNECTORS, constants_1.TARGET_API_PLATFORM);
|
|
24
24
|
this.findings = new entity_service_1.AmpSaaSEntityServiceImpl(rest, constants_1.KIND.FINDINGS, constants_1.TARGET_API_PLATFORM);
|
|
25
|
+
this.jobExecutions = new entity_service_1.AmpEntityServiceImpl(rest, constants_1.KIND.JOB_EXECUTIONS, constants_1.TARGET_API_PLATFORM);
|
|
26
|
+
this.jobs = new entity_service_1.AmpEntityServiceImpl(rest, constants_1.KIND.JOB_SPEC, constants_1.TARGET_API_PLATFORM);
|
|
25
27
|
this.providers = new data_service_1.AmpDataServiceImpl(rest, constants_1.KIND.PROVIDERS, constants_1.TARGET_API_AGENT);
|
|
26
28
|
this.reportResults = new entity_service_1.AmpSaaSEntityServiceImpl(rest, constants_1.KIND.REPORT_RESULTS, constants_1.TARGET_API_PLATFORM);
|
|
27
29
|
this.saasAssets = new entity_service_1.AmpSaaSEntityServiceImpl(rest, constants_1.KIND.SAAS_ASSETS, constants_1.TARGET_API_PLATFORM);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AmpSdk.js","sourceRoot":"","sources":["../../../src/services/AmpSdk.ts"],"names":[],"mappings":";;;AAuBA,qDAA4K;AAC5K,iDAAkE;AAClE,iCAA0E;AAC1E,2CAAwE;
|
|
1
|
+
{"version":3,"file":"AmpSdk.js","sourceRoot":"","sources":["../../../src/services/AmpSdk.ts"],"names":[],"mappings":";;;AAuBA,qDAA4K;AAC5K,iDAAkE;AAClE,iCAA0E;AAC1E,2CAAwE;AAMxE;;;;;;;;;;GAUG;AACH,MAAa,cAAc;IAezB,YAAY,IAAgB;QAC1B,IAAI,CAAC,MAAM,GAAG,IAAI,qCAAoB,CAA2C,IAAI,EAAE,gBAAI,CAAC,MAAM,EAAE,+BAAmB,CAAC,CAAC;QACzH,IAAI,CAAC,KAAK,GAAG,IAAI,2CAA0B,CAA2C,IAAI,EAAE,gBAAI,CAAC,MAAM,EAAE,+BAAmB,CAAC,CAAC;QAC9H,IAAI,CAAC,UAAU,GAAG,IAAI,qCAAoB,CAAmD,IAAI,EAAE,gBAAI,CAAC,UAAU,EAAE,+BAAmB,CAAC,CAAC;QACzI,IAAI,CAAC,QAAQ,GAAG,IAAI,yCAAwB,CAA+C,IAAI,EAAE,gBAAI,CAAC,QAAQ,EAAE,+BAAmB,CAAC,CAAC;QACrI,IAAI,CAAC,aAAa,GAAG,IAAI,qCAAoB,CAAmE,IAAI,EAAE,gBAAI,CAAC,cAAc,EAAE,+BAA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K,EAAE,OAAO;CACf,CAAC;AAEW,QAAA,OAAO,GAAG;IACrB,YAAY,EAAE,cAAc;IAC5B,yBAAyB,EAAE,qCAAqC;IAChE,yBAAyB,EAAE,qCAAqC;IAChE,iBAAiB,EAAE,mBAAmB;IACtC,qBAAqB,EAAE,uBAAuB;IAC9C,YAAY,EAAE,0BAA0B;IACxC,qBAAqB,EAAE,uBAAuB;IAC9C,gBAAgB,EAAE,kBAAkB;IACpC,mBAAmB;IACnB,kBAAkB,EAAE,cAAc;CACnC,CAAC"}
|
package/package.json
CHANGED
package/src/FilterCriteria.ts
CHANGED
package/src/dto/enums/index.ts
CHANGED
|
@@ -2,6 +2,8 @@ export * from './platform.agents.dto';
|
|
|
2
2
|
export * from './platform.assets.dto';
|
|
3
3
|
export * from './platform.connectors.dto';
|
|
4
4
|
export * from './platform.findings.dto';
|
|
5
|
+
export * from './platform.jobExecutionState.dto';
|
|
6
|
+
export * from './platform.jobSpec.dto';
|
|
5
7
|
export * from './platform.providers.dto';
|
|
6
8
|
export * from './platform.reportResults.dto';
|
|
7
9
|
export * from './platform.saasAssets.dto';
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import {BaseDto, BaseUpsertDto} from '../base.dto';
|
|
2
|
+
import {JobExecutionStatus} from '../enums/jobExecution.status';
|
|
3
|
+
import {TenantBased, UpsertTenantBased} from './tenant.based.dto';
|
|
4
|
+
|
|
5
|
+
export type JobExecutionPagination = {
|
|
6
|
+
/** Expected number of object to process for whole job. */
|
|
7
|
+
expected: number;
|
|
8
|
+
/** Total number of object that have already been processed. */
|
|
9
|
+
processed: number;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export type PlatformJobExecutionStateUpsertDto = BaseUpsertDto & {
|
|
13
|
+
/** `JobSpecification` ID */
|
|
14
|
+
specId: string;
|
|
15
|
+
/** Latest execution status */
|
|
16
|
+
status: JobExecutionStatus;
|
|
17
|
+
/** Date the job execution started */
|
|
18
|
+
startedAt: Date;
|
|
19
|
+
/** Optional date the job execution finished */
|
|
20
|
+
finishedAt: Date | null;
|
|
21
|
+
/** High level indication of progress */
|
|
22
|
+
pagination: JobExecutionPagination;
|
|
23
|
+
/** Optional error message. */
|
|
24
|
+
error: string | null;
|
|
25
|
+
/** Scratch space for job executors to maintain state incase of failure. */
|
|
26
|
+
scratch: unknown;
|
|
27
|
+
} & UpsertTenantBased;
|
|
28
|
+
|
|
29
|
+
export type PlatformJobExecutionStateDto = BaseDto & PlatformJobExecutionStateUpsertDto & TenantBased;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import {BaseDto, BaseUpsertDto} from '../base.dto';
|
|
2
|
+
import {JobExecutionStatus} from '../enums/jobExecution.status';
|
|
3
|
+
import {TenantBased, UpsertTenantBased} from './tenant.based.dto';
|
|
4
|
+
|
|
5
|
+
export type BasicJobSchedule = {
|
|
6
|
+
kind: 'basic';
|
|
7
|
+
offset: number;
|
|
8
|
+
interval: number;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export type IngestionPipelineContext = {
|
|
12
|
+
kind: 'INGESTION_PIPELINE_CONTEXT';
|
|
13
|
+
cid: string;
|
|
14
|
+
scratch: unknown;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export type PlatformJobSpecUpsertDto = BaseUpsertDto & {
|
|
18
|
+
/** Human readable name of the Job Specification */
|
|
19
|
+
displayValue: string;
|
|
20
|
+
/** Connector Id */
|
|
21
|
+
cid: string;
|
|
22
|
+
/** Schedule configuration for the job. */
|
|
23
|
+
schedule: BasicJobSchedule;
|
|
24
|
+
/** Context for the job execution, e.g. ingestion pipeline */
|
|
25
|
+
inputContext: IngestionPipelineContext;
|
|
26
|
+
/** Status of the current or latest job execution */
|
|
27
|
+
status: JobExecutionStatus;
|
|
28
|
+
/** Date of the next job execution */
|
|
29
|
+
nextExecutionAt: string;
|
|
30
|
+
/** Optional error message from the latest execution. Expected to be `null` if `status=JobExecutionStatus.SUCCEEDED */
|
|
31
|
+
error: string | null;
|
|
32
|
+
} & UpsertTenantBased;
|
|
33
|
+
|
|
34
|
+
export type PlatformJobSpecDto = BaseDto & PlatformJobSpecUpsertDto & TenantBased;
|
package/src/services/AmpSdk.ts
CHANGED
|
@@ -25,6 +25,8 @@ import {AmpEntityService, AmpEntityServiceImpl, AmpGlobalEntityService, AmpGloba
|
|
|
25
25
|
import {AmpDataService, AmpDataServiceImpl} from './data.service';
|
|
26
26
|
import {AmpRestClientOptions, RestClient, getAmpRestClient} from './rest';
|
|
27
27
|
import {KIND, TARGET_API_AGENT, TARGET_API_PLATFORM} from './constants';
|
|
28
|
+
import {PlatformJobSpecDto, PlatformJobSpecUpsertDto} from '../dto/platform/platform.jobSpec.dto';
|
|
29
|
+
import {PlatformJobExecutionStateDto, PlatformJobExecutionStateUpsertDto} from '../dto/platform/platform.jobExecutionState.dto';
|
|
28
30
|
|
|
29
31
|
export type AmpSdkOptions = AmpRestClientOptions;
|
|
30
32
|
|
|
@@ -44,6 +46,8 @@ export class AmpSdkServices {
|
|
|
44
46
|
readonly asset: AmpGlobalEntityService<PlatformAssetUpsertDto, PlatformAssetDto>;
|
|
45
47
|
readonly connectors: AmpEntityService<PlatformConnectorUpsertDto, PlatformConnectorDto>;
|
|
46
48
|
readonly findings: AmpSaaSEntityService<PlatformFindingUpsertDto, PlatformFindingDto>;
|
|
49
|
+
readonly jobExecutions: AmpEntityService<PlatformJobExecutionStateUpsertDto, PlatformJobExecutionStateDto>;
|
|
50
|
+
readonly jobs: AmpEntityService<PlatformJobSpecUpsertDto, PlatformJobSpecDto>;
|
|
47
51
|
readonly providers: AmpDataService<ProviderDto>;
|
|
48
52
|
readonly reportResults: AmpSaaSEntityService<PlatformReportResultUpsertDto, PlatformReportResultDto>;
|
|
49
53
|
readonly saasAssets: AmpSaaSEntityService<PlatformSaasAssetUpsertDto, PlatformSaasAssetDto>;
|
|
@@ -57,6 +61,8 @@ export class AmpSdkServices {
|
|
|
57
61
|
this.asset = new AmpGlobalEntityServiceImpl<PlatformAssetUpsertDto, PlatformAssetDto>(rest, KIND.ASSETS, TARGET_API_PLATFORM);
|
|
58
62
|
this.connectors = new AmpEntityServiceImpl<PlatformConnectorUpsertDto, PlatformConnectorDto>(rest, KIND.CONNECTORS, TARGET_API_PLATFORM);
|
|
59
63
|
this.findings = new AmpSaaSEntityServiceImpl<PlatformFindingUpsertDto, PlatformFindingDto>(rest, KIND.FINDINGS, TARGET_API_PLATFORM);
|
|
64
|
+
this.jobExecutions = new AmpEntityServiceImpl<PlatformJobExecutionStateUpsertDto, PlatformJobExecutionStateDto>(rest, KIND.JOB_EXECUTIONS, TARGET_API_PLATFORM);
|
|
65
|
+
this.jobs = new AmpEntityServiceImpl<PlatformJobSpecUpsertDto, PlatformJobSpecDto>(rest, KIND.JOB_SPEC, TARGET_API_PLATFORM);
|
|
60
66
|
this.providers = new AmpDataServiceImpl<ProviderDto>(rest, KIND.PROVIDERS, TARGET_API_AGENT);
|
|
61
67
|
this.reportResults = new AmpSaaSEntityServiceImpl<PlatformReportResultUpsertDto, PlatformReportResultDto>(rest, KIND.REPORT_RESULTS, TARGET_API_PLATFORM);
|
|
62
68
|
this.saasAssets = new AmpSaaSEntityServiceImpl<PlatformSaasAssetUpsertDto, PlatformSaasAssetDto>(rest, KIND.SAAS_ASSETS, TARGET_API_PLATFORM);
|