Skip to content

ResourceGroup (resource tagging) manager. #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions ovmclient/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ def server_networks(self, server_id):
def server_pools(self):
return ServerPoolManager(self._conn)

@property
def resource_groups(self):
return ResourceGroupManager(self._conn)

def server_repository_exports(self, server_id):
return RepositoryExportManager(self._conn, server_id)

Expand Down Expand Up @@ -196,6 +200,23 @@ def remove_server(self, id, server_id):
return self._action(id, "removeServer", data=server_id)


class ResourceGroupManager(base.BaseManager):
def __init__(self, conn):
super(ResourceGroupManager, self).__init__(conn, "ResourceGroup")

def get_resource_ids(self, id):
return self._conn.get("ResourceGroup/%s/resource/id" %
self._get_id_value(id))

def add_resource(self, id, resource_id):
# resource_id is in simpleId format
return self._action(id, "addResource", data=resource_id)

def remove_resource(self, id, resource_id):
# resource_id is in simpleId format
return self._action(id, "removeResource", data=resource_id)


class VirtualDiskManager(base.BaseManager):
def __init__(self, conn, repository_id=None):
if repository_id:
Expand Down