Add client methods for library policy CRUD
Not yet integrated into or tested with OSC CLI. Client methods put in place first to allow GUI dev to proceed. Partial-Bug: 1693623 Partially implements: blueprint policy-library Change-Id: Ib94dd4de6242faeb29756f43afaa05621b7df1ac
This commit is contained in:
parent
ec89672c4a
commit
4866a0efab
|
@ -43,6 +43,9 @@ class Client(object):
|
|||
policy_rows_trace = '/v1/policies/%s/tables/%s/rows?trace=True'
|
||||
policies = '/v1/policies'
|
||||
policy_action = '/v1/policies/%s?%s'
|
||||
library_policy = '/v1/librarypolicies'
|
||||
library_policy_path = '/v1/librarypolicies/%s'
|
||||
library_policies = '/v1/librarypolicies'
|
||||
datasources = '/v1/data-sources'
|
||||
datasource_path = '/v1/data-sources/%s'
|
||||
datasource_tables = '/v1/data-sources/%s/tables'
|
||||
|
@ -77,6 +80,21 @@ class Client(object):
|
|||
self.policy_path % policy)
|
||||
return body
|
||||
|
||||
def create_library_policy(self, body):
|
||||
resp, body = self.httpclient.post(
|
||||
self.library_policy, body=body)
|
||||
return body
|
||||
|
||||
def delete_library_policy(self, policy):
|
||||
resp, body = self.httpclient.delete(
|
||||
self.library_policy_path % policy)
|
||||
return body
|
||||
|
||||
def show_library_policy(self, policy):
|
||||
resp, body = self.httpclient.get(
|
||||
self.library_policy_path % policy)
|
||||
return body
|
||||
|
||||
def create_policy_rule(self, policy_name, body=None):
|
||||
resp, body = self.httpclient.post(
|
||||
self.policy_rules % policy_name, body=body)
|
||||
|
@ -108,6 +126,10 @@ class Client(object):
|
|||
resp, body = self.httpclient.get(self.policies)
|
||||
return body
|
||||
|
||||
def list_library_policy(self):
|
||||
resp, body = self.httpclient.get(self.library_policies)
|
||||
return body
|
||||
|
||||
def list_policy_tables(self, policy_name):
|
||||
resp, body = self.httpclient.get(self.policy_tables % (policy_name))
|
||||
return body
|
||||
|
|
Loading…
Reference in New Issue