Skip to content

Commit

Permalink
apply: add sample manifests for managedservices
Browse files Browse the repository at this point in the history
  • Loading branch information
pallabpain committed Dec 6, 2022
1 parent ff8b787 commit 3b0929e
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
4 changes: 4 additions & 0 deletions riocli/apply/manifests/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,7 @@ spec:
- depends:
kind: network
nameOrGUID: "routed"
managedServices:
- depends:
kind: managedservice
nameOrGUID: "test-service"
9 changes: 9 additions & 0 deletions riocli/apply/manifests/managedservice.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: "apiextensions.rapyuta.io/v1"
kind: ManagedService
metadata:
name: "elastic-test"
labels:
creator: riocli
spec:
provider: elasticsearch
config: {}
10 changes: 5 additions & 5 deletions riocli/managedservice/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def list_providers(self):
data = json.loads(response.text)
if not response.ok:
err_msg = data.get('error')
raise Exception(err_msg)
raise Exception("managedservice: {}".format(err_msg))
return data.get('items', [])

def list_instances(self):
Expand All @@ -52,7 +52,7 @@ def list_instances(self):
data = json.loads(response.text)
if not response.ok:
err_msg = data.get('error')
raise Exception(err_msg)
raise Exception("managedservice: {}".format(err_msg))
instances = data.get('items', [])
if not instances:
break
Expand All @@ -69,7 +69,7 @@ def get_instance(self, instance_name: str) -> typing.Dict:
data = json.loads(response.text)
if not response.ok:
err_msg = data.get('error')
raise Exception(err_msg)
raise Exception("managedservice: {}".format(err_msg))
return data

def create_instance(self, instance: typing.Any) -> typing.Dict:
Expand All @@ -92,7 +92,7 @@ def create_instance(self, instance: typing.Any) -> typing.Dict:
data = json.loads(response.text)
if not response.ok:
err_msg = data.get('error')
raise Exception(err_msg)
raise Exception("managedservice: {}".format(err_msg))
return data

def delete_instance(self, instance_name):
Expand All @@ -103,5 +103,5 @@ def delete_instance(self, instance_name):
data = json.loads(response.text)
if not response.ok:
err_msg = data.get('error')
raise Exception(err_msg)
raise Exception("managedservice: {}".format(err_msg))
return data

0 comments on commit 3b0929e

Please sign in to comment.