CCSDK-3531 improve cmd-exec returned err msg
[ccsdk/cds.git] / components / model-catalog / proto-definition / proto / CommandExecutor.proto
1 syntax = "proto3";
2 import "google/protobuf/struct.proto";
3 import "google/protobuf/timestamp.proto";
4 option java_multiple_files = true;
5 package org.onap.ccsdk.cds.controllerblueprints.command.api;
6
7 message ExecutionInput {
8     string requestId = 1;
9     // Optional Id used to correlate multiple requests so that it can identify previous request information.
10     string correlationId = 2;
11     // Optional Blueprint Information used to identify CBA content information in shared file structure environment.
12     Identifiers identifiers = 3;
13     // Actual Command to Execute in Scripting Environment
14     string command = 4;
15     int32 timeOut = 5;
16     // Extra Dynamic Properties for Command processing in JSON format
17     google.protobuf.Struct properties = 6;
18     // Request Time Stamp
19     google.protobuf.Timestamp timestamp = 7;
20     string subRequestId = 8;
21     string originatorId = 9;
22 }
23
24 // If a new version of blueprint (new UUID in DB) needs to be uploaded, then pass in the raw bytes data
25 // properties should specify 'file_format' as either 'gzip' or 'zip'
26 // TODO: archiveTYPE: should be enum {"CBA_ZIP", "CBA_GZIP"}
27 message UploadBlueprintInput {
28     Identifiers identifiers = 1;
29     string requestId = 2;
30     string subRequestId = 3;
31     string originatorId = 4;
32     string correlationId = 5;
33     int32 timeOut = 6;
34     string archiveType = 7;
35     google.protobuf.Timestamp timestamp = 8;
36     bytes binData = 9;
37 }
38
39 message UploadBlueprintOutput {
40    string requestId = 1;
41    string subRequestId = 2;
42    ResponseStatus status = 3;
43    google.protobuf.Timestamp timestamp = 4;
44    string payload = 5;
45 }
46
47 message PrepareEnvInput {
48     Identifiers identifiers = 1;
49     string requestId = 2;
50     // Optional Id used to correlate multiple requests so that it can identify previous request information.
51     string correlationId = 3;
52     repeated Packages packages = 4;
53     int32 timeOut = 5;
54     google.protobuf.Struct properties = 6;
55     google.protobuf.Timestamp timestamp = 7;
56     string subRequestId = 8;
57     string originatorId = 9;
58 }
59
60 message Identifiers {
61     string blueprintName = 1;
62     string blueprintVersion = 2;
63     string blueprintUUID = 3;
64 }
65
66 message ExecutionOutput {
67     string requestId = 1;
68     repeated string response = 2;
69     ResponseStatus status = 3;
70     google.protobuf.Timestamp timestamp = 4;
71     string payload = 5;
72     string errMsg = 6;
73 }
74
75 enum ResponseStatus {
76     SUCCESS = 0;
77     FAILURE = 1;
78 }
79
80 message Packages {
81     PackageType type = 1;
82     repeated string package = 2;
83 }
84
85 enum PackageType {
86     pip = 0;
87     ansible_galaxy = 1;
88     utilities = 2;
89 }
90
91 service CommandExecutorService {
92     // rpc to upload the CBA
93     rpc uploadBlueprint (UploadBlueprintInput) returns (UploadBlueprintOutput);
94     // prepare Python environment
95     rpc prepareEnv (PrepareEnvInput) returns (ExecutionOutput);
96     // execute the actual command.
97     rpc executeCommand (ExecutionInput) returns (ExecutionOutput);
98 }