@@ -20,6 +20,7 @@ def __init__(self, endpoint, authtoken, headers, api_client, api_key):
2020 self .authtoken = authtoken
2121 self .headers = headers
2222 self .api_key = api_key
23+ self .headers ['authtoken' ] = self .authtoken
2324
2425 def fetch (self ):
2526 """
@@ -36,11 +37,10 @@ def fetch(self):
3637 -------------------------------
3738 """
3839 url = "stacks"
39- self .headers ['authtoken' ] = self .authtoken
4040 self .headers ['api_key' ] = self .api_key
4141 return self .api_client .get (url , headers = self .headers )
4242
43- def fetch_all (self ):
43+ def find (self ):
4444
4545 """
4646 Fetches the stacks entries
@@ -57,7 +57,6 @@ def fetch_all(self):
5757 """
5858
5959 url = "stacks"
60- self .headers ['authtoken' ] = self .authtoken
6160 return self .api_client .get (url , headers = self .headers )
6261
6362 def create (self , organization_uid , data ):
@@ -81,7 +80,7 @@ def create(self, organization_uid, data):
8180 -------------------------------
8281 """
8382 url = "stacks"
84- self . headers [ 'authtoken' ] = self . authtoken
83+
8584 self .headers ['organization_uid' ] = organization_uid
8685 data = json .dumps (data )
8786 return self .api_client .post (url , headers = self .headers , data = data )
@@ -107,7 +106,6 @@ def update(self, data):
107106 -------------------------------
108107 """
109108 url = "stacks"
110- self .headers ['authtoken' ] = self .authtoken
111109 self .headers ['api_key' ] = self .api_key
112110 data = json .dumps (data )
113111 return self .api_client .put (url , headers = self .headers , data = data )
@@ -129,11 +127,10 @@ def delete(self):
129127 """
130128
131129 url = "stacks"
132- self .headers ['authtoken' ] = self .authtoken
133130 self .headers ['api_key' ] = self .api_key
134131 return self .api_client .delete (url , headers = self .headers )
135132
136- def fetch_all_user (self ):
133+ def users (self ):
137134 """
138135 Fetches the all users of a stack
139136 :return: Json, with users of a stack details.
@@ -149,7 +146,6 @@ def fetch_all_user(self):
149146 """
150147
151148 url = "stacks/users"
152- self .headers ['authtoken' ] = self .authtoken
153149 self .headers ['api_key' ] = self .api_key
154150 return self .api_client .get (url , headers = self .headers )
155151
@@ -172,12 +168,11 @@ def update_user_role(self, data):
172168 -------------------------------
173169 """
174170 url = "stacks/users/roles"
175- self .headers ['authtoken' ] = self .authtoken
176171 self .headers ['api_key' ] = self .api_key
177172 data = json .dumps (data )
178173 return self .api_client .put (url , headers = self .headers , data = data )
179174
180- def stack_transfer_ownership (self , data ):
175+ def transfer_ownership (self , data ):
181176 """
182177 Transfer owership of the stacks
183178 :return: Json, with status code and message.
@@ -194,7 +189,6 @@ def stack_transfer_ownership(self, data):
194189 -------------------------------
195190 """
196191 url = "stacks/transfer_ownership"
197- self .headers ['authtoken' ] = self .authtoken
198192 self .headers ['api_key' ] = self .api_key
199193 data = json .dumps (data )
200194 return self .api_client .post (url , headers = self .headers , data = data )
@@ -214,11 +208,10 @@ def accept_ownership(self, user_id, ownership_token):
214208 -------------------------------
215209 """
216210 url = f"stacks/accept_ownership/{ ownership_token } "
217- self .headers ['authtoken' ] = self .authtoken
218211 params = {'api_key' : self .api_key , 'uid' : user_id }
219212 return self .api_client .get (url , headers = self .headers , params = params )
220213
221- def get_stack_settings (self ):
214+ def settings (self ):
222215 """
223216 Fetches the stack settings
224217 :return: Json, with stack settings details.
@@ -233,12 +226,11 @@ def get_stack_settings(self):
233226 -------------------------------
234227 """
235228 url = "stacks/settings"
236- self .headers ['authtoken' ] = self .authtoken
237229 self .headers ['api_key' ] = self .api_key
238230 return self .api_client .get (url , headers = self .headers )
239231
240232
241- def create_stack_settings (self , data ):
233+ def create_settings (self , data ):
242234 """
243235 Create the stack settings
244236 :return: Json, with stack setting details.
@@ -264,12 +256,11 @@ def create_stack_settings(self, data):
264256 -------------------------------
265257 """
266258 url = "stacks/settings"
267- self .headers ['authtoken' ] = self .authtoken
268259 self .headers ['api_key' ] = self .api_key
269260 data = json .dumps (data )
270261 return self .api_client .post (url , headers = self .headers , data = data )
271262
272- def reset_stack_settings (self , data ):
263+ def reset_settings (self , data ):
273264 """
274265 Reset the stack settings
275266 :return: Json, with stack setting details.
@@ -286,12 +277,11 @@ def reset_stack_settings(self, data):
286277 -------------------------------
287278 """
288279 url = "stacks/settings/reset"
289- self .headers ['authtoken' ] = self .authtoken
290280 self .headers ['api_key' ] = self .api_key
291281 data = json .dumps (data )
292282 return self .api_client .post (url , headers = self .headers , data = data )
293283
294- def share_stack (self , data ):
284+ def share (self , data ):
295285 """
296286 Share a stack to the users with user roles
297287 :return: Json, with status code and message
@@ -315,12 +305,11 @@ def share_stack(self, data):
315305 -------------------------------
316306 """
317307 url = "stacks/share"
318- self .headers ['authtoken' ] = self .authtoken
319308 self .headers ['api_key' ] = self .api_key
320309 data = json .dumps (data )
321310 return self .api_client .post (url , headers = self .headers , data = data )
322311
323- def unshare_stack (self , data ):
312+ def unshare (self , data ):
324313 """
325314 Unshare a stack to the users with user roles
326315 :return: Json, with status code and message
@@ -337,7 +326,6 @@ def unshare_stack(self, data):
337326 -------------------------------
338327 """
339328 url = "stacks/unshare"
340- self .headers ['authtoken' ] = self .authtoken
341329 self .headers ['api_key' ] = self .api_key
342330 data = json .dumps (data )
343331 return self .api_client .post (url , headers = self .headers , data = data )
0 commit comments