summaryrefslogtreecommitdiffstats
path: root/cds-ui/server/src/clients
diff options
context:
space:
mode:
authorBrinda Santh Muthuramalingam <brindasanth@in.ibm.com>2019-10-30 16:28:19 +0000
committerGerrit Code Review <gerrit@onap.org>2019-10-30 16:28:19 +0000
commite2619d958f8237f00467da8cacb0fb9fd210a323 (patch)
tree97423e798a0dbf37e5d3e00a44fa6506b7d7e14a /cds-ui/server/src/clients
parentd15ca6469a83d37f1b71962cf32d1a5b74e7fe97 (diff)
parent515636e496d18b908f2abab90439b395a66f2087 (diff)
Merge "Loopback code for GRPC functionality"
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();