Arielk | 802bd2a | 2018-04-16 15:37:39 +0300 | [diff] [blame] | 1 | 'use strict'; |
| 2 | |
Arielk | eaaf801 | 2018-07-31 12:59:36 +0300 | [diff] [blame] | 3 | export class OperationParameter { |
| 4 | name: string; |
| 5 | type: string; |
| 6 | property: string; |
| 7 | mandatory: boolean; |
Arielk | 802bd2a | 2018-04-16 15:37:39 +0300 | [diff] [blame] | 8 | |
Arielk | eaaf801 | 2018-07-31 12:59:36 +0300 | [diff] [blame] | 9 | constructor(param?: OperationParameter) { |
Arielk | 802bd2a | 2018-04-16 15:37:39 +0300 | [diff] [blame] | 10 | if (param) { |
Arielk | eaaf801 | 2018-07-31 12:59:36 +0300 | [diff] [blame] | 11 | this.name = param.name; |
| 12 | this.type = param.type; |
| 13 | this.property = param.property; |
| 14 | this.mandatory = param.mandatory; |
Arielk | 802bd2a | 2018-04-16 15:37:39 +0300 | [diff] [blame] | 15 | } |
| 16 | } |
| 17 | } |
| 18 | |
| 19 | export interface IOperationParamsList { |
Arielk | eaaf801 | 2018-07-31 12:59:36 +0300 | [diff] [blame] | 20 | listToscaDataDefinition: Array<OperationParameter>; |
Arielk | 802bd2a | 2018-04-16 15:37:39 +0300 | [diff] [blame] | 21 | } |
| 22 | |
| 23 | export class OperationModel { |
Arielk | 802bd2a | 2018-04-16 15:37:39 +0300 | [diff] [blame] | 24 | operationType: string; |
Arielk | eaaf801 | 2018-07-31 12:59:36 +0300 | [diff] [blame] | 25 | description: string; |
Arielk | 802bd2a | 2018-04-16 15:37:39 +0300 | [diff] [blame] | 26 | uniqueId: string; |
| 27 | |
Arielk | eaaf801 | 2018-07-31 12:59:36 +0300 | [diff] [blame] | 28 | inputParams: IOperationParamsList; |
| 29 | outputParams: IOperationParamsList; |
| 30 | |
| 31 | workflowId: string; |
| 32 | workflowVersionId: string; |
| 33 | |
| 34 | protected OperationTypeEnum: Array<String> = [ |
| 35 | 'Create', |
| 36 | 'Delete', |
| 37 | 'Instantiate', |
| 38 | 'Start', |
| 39 | 'Stop' |
| 40 | ]; |
| 41 | |
Arielk | 802bd2a | 2018-04-16 15:37:39 +0300 | [diff] [blame] | 42 | constructor(operation?: any) { |
| 43 | if (operation) { |
| 44 | this.description = operation.description; |
| 45 | this.inputParams = operation.inputParams; |
| 46 | this.operationType = operation.operationType; |
| 47 | this.outputParams = operation.outputParams; |
| 48 | this.uniqueId = operation.uniqueId; |
Arielk | eaaf801 | 2018-07-31 12:59:36 +0300 | [diff] [blame] | 49 | this.workflowId = operation.workflowId; |
| 50 | this.workflowVersionId = operation.workflowVersionId; |
Arielk | 802bd2a | 2018-04-16 15:37:39 +0300 | [diff] [blame] | 51 | } |
| 52 | } |
| 53 | |
Arielk | eaaf801 | 2018-07-31 12:59:36 +0300 | [diff] [blame] | 54 | public createInputParamsList(inputParams: Array<OperationParameter>): void { |
Arielk | 802bd2a | 2018-04-16 15:37:39 +0300 | [diff] [blame] | 55 | this.inputParams = { |
| 56 | listToscaDataDefinition: inputParams |
| 57 | }; |
| 58 | } |
| 59 | |
Arielk | eaaf801 | 2018-07-31 12:59:36 +0300 | [diff] [blame] | 60 | public createOutputParamsList(outputParams: Array<OperationParameter>): void { |
Arielk | 802bd2a | 2018-04-16 15:37:39 +0300 | [diff] [blame] | 61 | this.outputParams = { |
| 62 | listToscaDataDefinition: outputParams |
| 63 | }; |
| 64 | } |
| 65 | } |
| 66 | |
| 67 | export interface CreateOperationResponse extends OperationModel { |
| 68 | artifactUUID: string; |
| 69 | } |