blob: 2a5298c3b050e83ef6799341d3704c9466cd7799 [file] [log] [blame]
Arielk802bd2a2018-04-16 15:37:39 +03001'use strict';
2
Arielkeaaf8012018-07-31 12:59:36 +03003export class OperationParameter {
4 name: string;
5 type: string;
6 property: string;
7 mandatory: boolean;
Arielk802bd2a2018-04-16 15:37:39 +03008
Arielkeaaf8012018-07-31 12:59:36 +03009 constructor(param?: OperationParameter) {
Arielk802bd2a2018-04-16 15:37:39 +030010 if (param) {
Arielkeaaf8012018-07-31 12:59:36 +030011 this.name = param.name;
12 this.type = param.type;
13 this.property = param.property;
14 this.mandatory = param.mandatory;
Arielk802bd2a2018-04-16 15:37:39 +030015 }
16 }
17}
18
19export interface IOperationParamsList {
Arielkeaaf8012018-07-31 12:59:36 +030020 listToscaDataDefinition: Array<OperationParameter>;
Arielk802bd2a2018-04-16 15:37:39 +030021}
22
23export class OperationModel {
Arielk802bd2a2018-04-16 15:37:39 +030024 operationType: string;
Arielkeaaf8012018-07-31 12:59:36 +030025 description: string;
Arielk802bd2a2018-04-16 15:37:39 +030026 uniqueId: string;
27
Arielkeaaf8012018-07-31 12:59:36 +030028 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
Arielk802bd2a2018-04-16 15:37:39 +030042 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;
Arielkeaaf8012018-07-31 12:59:36 +030049 this.workflowId = operation.workflowId;
50 this.workflowVersionId = operation.workflowVersionId;
Arielk802bd2a2018-04-16 15:37:39 +030051 }
52 }
53
Arielkeaaf8012018-07-31 12:59:36 +030054 public createInputParamsList(inputParams: Array<OperationParameter>): void {
Arielk802bd2a2018-04-16 15:37:39 +030055 this.inputParams = {
56 listToscaDataDefinition: inputParams
57 };
58 }
59
Arielkeaaf8012018-07-31 12:59:36 +030060 public createOutputParamsList(outputParams: Array<OperationParameter>): void {
Arielk802bd2a2018-04-16 15:37:39 +030061 this.outputParams = {
62 listToscaDataDefinition: outputParams
63 };
64 }
65}
66
67export interface CreateOperationResponse extends OperationModel {
68 artifactUUID: string;
69}