File tree Expand file tree Collapse file tree 3 files changed +59
-0
lines changed Expand file tree Collapse file tree 3 files changed +59
-0
lines changed Original file line number Diff line number Diff line change
1
+ import os
2
+
3
+ from staxapp .config import Config
4
+ from staxapp .openapi import StaxClient
5
+ from staxapp .exceptions import ApiException
6
+
7
+ Config .access_key = os .getenv ("STAX_ACCESS_KEY" )
8
+ Config .secret_key = os .getenv ("STAX_SECRET_KEY" )
9
+
10
+ # Read all workload catalogue items within your Stax Organisation
11
+ workloads = StaxClient ("workloads" )
12
+ try :
13
+ response = workloads .ReadCatalogueItems ()
14
+ except ApiException as e :
15
+ print (e )
16
+ if e .status_code == 404 :
17
+ print ("No accounts exist" )
Original file line number Diff line number Diff line change
1
+ import os
2
+
3
+ from staxapp .config import Config
4
+ from staxapp .openapi import StaxClient
5
+ from staxapp .exceptions import InvalidCredentialsException
6
+
7
+ Config .access_key = os .getenv ("STAX_ACCESS_KEY" )
8
+ Config .secret_key = os .getenv ("STAX_SECRET_KEY" )
9
+
10
+ # Read all workload catalogue items within your Stax Organisation
11
+ try :
12
+ workloads = StaxClient ("workloads" )
13
+ except InvalidCredentialsException as e :
14
+ print (e )
15
+ # Try other credentials
Original file line number Diff line number Diff line change
1
+ import os
2
+
3
+ from staxapp .config import Config
4
+ from staxapp .openapi import StaxClient
5
+ from staxapp .exceptions import ValidationException
6
+
7
+ Config .access_key = os .getenv ("STAX_ACCESS_KEY" )
8
+ Config .secret_key = os .getenv ("STAX_SECRET_KEY" )
9
+
10
+ # The user's first name
11
+ first_name = < User 's first Name >
12
+ # The user's second name
13
+ last_name = < User 's last Name >
14
+ # The email for the user
15
+ user_email = < User 's Email >
16
+
17
+ try :
18
+ # Create a Stax User
19
+ teams = StaxClient ("teams" )
20
+ response = teams .CreateUser (
21
+ FirstName = first_name ,
22
+ LastName = last_name ,
23
+ Email = user_email
24
+ )
25
+ except InvalidCredentialsException as e :
26
+ print (e )
27
+ # Try adding a missing field or validating the params
You can’t perform that action at this time.
0 commit comments