aboutsummaryrefslogtreecommitdiffstats
path: root/cds-ui/server/src/clients
diff options
context:
space:
mode:
authorEzhilarasi <ezhrajam@in.ibm.com>2019-10-17 15:58:08 +0530
committerEzhilarasi R <ezhrajam@in.ibm.com>2019-10-18 10:10:01 +0000
commit515636e496d18b908f2abab90439b395a66f2087 (patch)
tree02e536baa098b807cccb41860c4fb42a08f3371b /cds-ui/server/src/clients
parent626cce5c6921376fa0ad3d927cec391b19c45b3a (diff)
Loopback code for GRPC functionality
GRPC integration for Draft, Publish, Download Change-Id: I24e138fae766da7a112ac9f49a8ba036d81b5bb5 Issue-ID: CCSDK-1785 Signed-off-by: Ezhilarasi <ezhrajam@in.ibm.com>
Diffstat (limited to 'cds-ui/server/src/clients')
-rw-r--r--cds-ui/server/src/clients/blueprint-management-service-grpc-client.ts37
1 files changed, 35 insertions, 2 deletions
diff --git a/cds-ui/server/src/clients/blueprint-management-service-grpc-client.ts b/cds-ui/server/src/clients/blueprint-management-service-grpc-client.ts
index b66b2a771..8975f4501 100644
--- a/cds-ui/server/src/clients/blueprint-management-service-grpc-client.ts
+++ b/cds-ui/server/src/clients/blueprint-management-service-grpc-client.ts
@@ -17,7 +17,7 @@ import * as fs from 'fs';
import * as uuidv1 from 'uuid/v1';
const grpc = require('grpc');
import * as protoLoader from '@grpc/proto-loader';
-import {processorApiConfig} from '../config/app-config';
+import { processorApiConfig } from '../config/app-config';
const PROTO_PATH = processorApiConfig.grpc.bluePrintManagement.protoPath;
@@ -44,7 +44,7 @@ metadata.add('Authorization', processorApiConfig.grpc.authToken);
class BluePrintManagementServiceGrpcClient {
- async uploadBlueprint(filePath: string): Promise<any> {
+ async uploadBlueprint(filePath: string, actionName: string): Promise<any> {
let input = {
commonHeader: {
@@ -55,6 +55,11 @@ class BluePrintManagementServiceGrpcClient {
},
fileChunk: {
chunk: fs.readFileSync(filePath)
+ },
+ actionIdentifiers: {
+ mode: "sync",
+ blueprintName: "cds.zip",
+ actionName: actionName
}
}
@@ -80,6 +85,34 @@ class BluePrintManagementServiceGrpcClient {
});
}
+
+ async downloadBlueprint(blueprintName: string,blueprintVersion: string): Promise<any> {
+
+ let input = {
+ commonHeader: {
+ timestamp: new Date(),
+ originatorId: "cds-ui",
+ requestId: uuidv1(),
+ subRequestId: "1234-56",
+ },
+ actionIdentifiers: {
+ mode: "sync",
+ blueprintName: blueprintName,
+ blueprintVersion: blueprintVersion
+ }
+ }
+
+ return new Promise<any>((resolve, reject) => {
+ stub.downloadBlueprint(input, metadata, (err: any, output: any) => {
+ if (err) {
+ reject(err);
+ return;
+ }
+ resolve(output);
+ });
+ });
+
+ }
}
export const bluePrintManagementServiceGrpcClient = new BluePrintManagementServiceGrpcClient();