Skip to content
This repository has been archived by the owner on Aug 20, 2024. It is now read-only.

Commit

Permalink
Black.
Browse files Browse the repository at this point in the history
  • Loading branch information
pschmitt committed May 16, 2020
1 parent 1409643 commit 12f0738
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 9 deletions.
32 changes: 24 additions & 8 deletions guacapy/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,9 @@ def get_connection_parameters(self, connection_id, datasource=None):

def get_connection_full(self, connection_id, datasource=None):
c = self.get_connection(connection_id, datasource)
c["parameters"] = self.get_connection_parameters(connection_id, datasource)
c["parameters"] = self.get_connection_parameters(
connection_id, datasource
)
return c

def __get_connection_by_name(self, cons, name, regex=False):
Expand Down Expand Up @@ -238,7 +240,9 @@ def add_connection(self, payload, datasource=None):
datasource = self.primary_datasource
return self.__auth_request(
method="POST",
url="{}/session/data/{}/connections".format(self.REST_API, datasource),
url="{}/session/data/{}/connections".format(
self.REST_API, datasource
),
payload=payload,
)

Expand Down Expand Up @@ -310,7 +314,9 @@ def get_history(self, datasource=None):
raise NotImplementedError()

def __get_connection_group_by_name(self, cons, name, regex=False):
if (regex and re.search(name, cons["name"])) or (not regex and cons["name"] == name):
if (regex and re.search(name, cons["name"])) or (
not regex and cons["name"] == name
):
return cons
if "childConnectionGroups" in cons:
children = cons["childConnectionGroups"]
Expand Down Expand Up @@ -358,11 +364,15 @@ def add_connection_group(self, payload, datasource=None):
datasource = self.primary_datasource
return self.__auth_request(
method="POST",
url="{}/session/data/{}/connectionGroups".format(self.REST_API, datasource),
url="{}/session/data/{}/connectionGroups".format(
self.REST_API, datasource
),
payload=payload,
)

def edit_connection_group(self, connection_group_id, payload, datasource=None):
def edit_connection_group(
self, connection_group_id, payload, datasource=None
):
"""
Edit an exiting connection group
Expand Down Expand Up @@ -452,7 +462,9 @@ def edit_user(self, username, payload, datasource=None):
datasource = self.primary_datasource
return self.__auth_request(
method="PUT",
url="{}/session/data/{}/users/{}".format(self.REST_API, datasource, username),
url="{}/session/data/{}/users/{}".format(
self.REST_API, datasource, username
),
payload=payload,
json_response=False,
)
Expand Down Expand Up @@ -527,7 +539,9 @@ def add_sharing_profile(self, payload, datasource=None):
datasource = self.primary_datasource
return self.__auth_request(
method="POST",
url="{}/session/data/{}/sharingProfiles".format(self.REST_API, datasource),
url="{}/session/data/{}/sharingProfiles".format(
self.REST_API, datasource
),
payload=payload,
)

Expand All @@ -539,7 +553,9 @@ def get_user_groups(self, datasource=None):
datasource = self.primary_datasource
return self.__auth_request(
method="GET",
url="{}/session/data/{}/userGroups".format(self.REST_API, datasource,),
url="{}/session/data/{}/userGroups".format(
self.REST_API, datasource,
),
)

def get_group(self, usergroup, datasource=None):
Expand Down
7 changes: 6 additions & 1 deletion guacapy/templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,12 @@
"attributes": {"max-connections": "", "max-connections-per-user": ""},
"identifier": "",
"name": "",
"parameters": {"hostname": "", "password": "", "port": "22", "username": ""},
"parameters": {
"hostname": "",
"password": "",
"port": "22",
"username": "",
},
"parentIdentifier": "ROOT",
"protocol": "ssh",
}
Expand Down

0 comments on commit 12f0738

Please sign in to comment.