752dd8031601bd49fd1607db4545e5bffd161c55
[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 // TODO: need to rething whether we want to include subrequest/correlationID/etc to be consistent
67 // or drop requestId as it would be returned back to the context where these values are already known.
68 // and we may just be concerned with the response/status
69 message ExecutionOutput {
70     string requestId = 1;
71     repeated string response = 2;
72     ResponseStatus status = 3;
73     google.protobuf.Timestamp timestamp = 4;
74     string payload = 5;
75 }
76
77 enum ResponseStatus {
78     SUCCESS = 0;
79     FAILURE = 1;
80 }
81
82 message Packages {
83     PackageType type = 1;
84     repeated string package = 2;
85 }
86
87 enum PackageType {
88     pip = 0;
89     ansible_galaxy = 1;
90     utilities = 2;
91 }
92
93 service CommandExecutorService {
94     // rpc to upload the CBA
95     rpc uploadBlueprint (UploadBlueprintInput) returns (UploadBlueprintOutput);
96     // prepare Python environment
97     rpc prepareEnv (PrepareEnvInput) returns (ExecutionOutput);
98     // execute the actual command.
99     rpc executeCommand (ExecutionInput) returns (ExecutionOutput);
100 }