summaryrefslogtreecommitdiffstats
path: root/ms/py-executor/resource_resolution/README
diff options
context:
space:
mode:
authorMarek Szwalkiewicz <marek.szwalkiewicz@external.t-mobile.pl>2020-01-23 15:27:26 +0000
committerKAPIL SINGAL <ks220y@att.com>2020-01-24 14:59:47 +0000
commit5064cb8bc7c7890283f810fbe27b284e5581c641 (patch)
treea9b5813c52e5797c08c3028ef3e7f3c936f6649e /ms/py-executor/resource_resolution/README
parent95000d792e2e5001c7f566b0dedff997dc649ab8 (diff)
Add resource resolution gRPC client.
Adds a python module that contains new resource resolution client that should replace previous helpers done in Jython. Issue-ID: CCSDK-1989 Signed-off-by: Marek Szwalkiewicz <marek.szwalkiewicz@external.t-mobile.pl> Change-Id: I48b22acdc7fec31f28de84232c5b6b37124a0c2a
Diffstat (limited to 'ms/py-executor/resource_resolution/README')
-rw-r--r--ms/py-executor/resource_resolution/README80
1 files changed, 80 insertions, 0 deletions
diff --git a/ms/py-executor/resource_resolution/README b/ms/py-executor/resource_resolution/README
new file mode 100644
index 000000000..a2d1542ab
--- /dev/null
+++ b/ms/py-executor/resource_resolution/README
@@ -0,0 +1,80 @@
+# Resource resolution client
+
+## How to use examples
+
+### Insecure channel
+
+```
+from blueprints_grpc.proto.BluePrintCommon_pb2_grpc import ActionIdentifiers, CommonHeader
+from blueprints_grpc.proto.BluePrintProcessing_pb2_grpc import ExecutionServiceInput
+from resource_resolution.client import Client as ResourceResolutionClient
+
+
+def generate_messages():
+ commonHeader = CommonHeader()
+ commonHeader.requestId = "1234"
+ commonHeader.subRequestId = "1234-1"
+ commonHeader.originatorId = "CDS"
+
+ actionIdentifiers = ActionIdentifiers()
+ actionIdentifiers.blueprintName = "sample-cba"
+ actionIdentifiers.blueprintVersion = "1.0.0"
+ actionIdentifiers.actionName = "SampleScript"
+
+ input = ExecutionServiceInput(commonHeader=commonHeader, actionIdentifiers=actionIdentifiers)
+
+ commonHeader2 = CommonHeader()
+ commonHeader2.requestId = "1235"
+ commonHeader2.subRequestId = "1234-2"
+ commonHeader2.originatorId = "CDS"
+
+ input2 = ExecutionServiceInput(commonHeader=commonHeader2, actionIdentifiers=actionIdentifiers)
+
+ yield from [input, input2]
+
+
+if __name__ == "__main__":
+ with ResourceResolutionClient("localhost:50052") as client:
+ for response in client.process(generate_messages()):
+ print(response)
+
+```
+
+### Secure channel
+
+```
+from blueprints_grpc.proto.BluePrintCommon_pb2_grpc import ActionIdentifiers, CommonHeader
+from blueprints_grpc.proto.BluePrintProcessing_pb2_grpc import ExecutionServiceInput
+from resource_resolution.client import Client as ResourceResolutionClient
+
+
+def generate_messages():
+ commonHeader = CommonHeader()
+ commonHeader.requestId = "1234"
+ commonHeader.subRequestId = "1234-1"
+ commonHeader.originatorId = "CDS"
+
+ actionIdentifiers = ActionIdentifiers()
+ actionIdentifiers.blueprintName = "sample-cba"
+ actionIdentifiers.blueprintVersion = "1.0.0"
+ actionIdentifiers.actionName = "SampleScript"
+
+ input = ExecutionServiceInput(commonHeader=commonHeader, actionIdentifiers=actionIdentifiers)
+
+ commonHeader2 = CommonHeader()
+ commonHeader2.requestId = "1235"
+ commonHeader2.subRequestId = "1234-2"
+ commonHeader2.originatorId = "CDS"
+
+ input2 = ExecutionServiceInput(commonHeader=commonHeader2, actionIdentifiers=actionIdentifiers)
+
+ yield from [input, input2]
+
+
+if __name__ == "__main__":
+ with open("certs/py-executor/py-executor-chain.pem", "rb") as f:
+ with ResourceResolutionClient("localhost:50052", use_ssl=True, root_certificates=f.read()) as client:
+ for response in client.process(generate_messages()):
+ print(response)
+
+``` \ No newline at end of file