Skip to content
Merged
Show file tree
Hide file tree
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
17 changes: 17 additions & 0 deletions examples/groups/create_group.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import os

from staxapp.config import Config
from staxapp.openapi import StaxClient

Config.access_key = os.getenv("STAX_ACCESS_KEY")
Config.secret_key = os.getenv("STAX_SECRET_KEY")

# The name of the group you're creating
group_name = <Group Name>

# Create a Stax groups
teams = StaxClient("teams")
response = teams.CreateGroup(
Name=group_name
)
print(response)
17 changes: 17 additions & 0 deletions examples/groups/delete_group.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import os

from staxapp.config import Config
from staxapp.openapi import StaxClient

Config.access_key = os.getenv("STAX_ACCESS_KEY")
Config.secret_key = os.getenv("STAX_SECRET_KEY")

# Id of the group to delete
group_id = <Group Id>

# Create a Stax groups
teams = StaxClient("teams")
response = teams.DeleteGroup(
group_id=group_id
)
print(response)
21 changes: 21 additions & 0 deletions examples/groups/update_group.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import os

from staxapp.config import Config
from staxapp.openapi import StaxClient

Config.access_key = os.getenv("STAX_ACCESS_KEY")
Config.secret_key = os.getenv("STAX_SECRET_KEY")

# Id of the group to update
group_id = <Group Id>

# Name to rename the group
group_name = <Group Name>

# Create a Stax groups
teams = StaxClient("teams")
response = teams.UpdateGroup(
group_id=group_id,
Name=group_name
)
print(response)
22 changes: 22 additions & 0 deletions examples/groups/update_group_members.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import os

from staxapp.config import Config
from staxapp.openapi import StaxClient

Config.access_key = os.getenv("STAX_ACCESS_KEY")
Config.secret_key = os.getenv("STAX_SECRET_KEY")

# An array of user memberships dicts to enableor an empty array
# Properties: GroupId(string), UserId(string)
user_membership_to_add = <An array of User Membership?>

# An array of user memberships dicts to disable or an empty arry
user_membership_to_remove = <An array of User Membership?>

# Create a Stax groups
teams = StaxClient("teams")
response = teams.UpdateGroupMembers(
AddMembers = user_membership_to_add,
RemoveMembers = user_membership_to_remove
)
print(response)
22 changes: 22 additions & 0 deletions examples/policy/create_policy.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import os

from staxapp.config import Config
from staxapp.openapi import StaxClient

Config.access_key = os.getenv("STAX_ACCESS_KEY")
Config.secret_key = os.getenv("STAX_SECRET_KEY")

policy_name = <Policy Name>

policy_description = <Policy Description>

policy = <Policy Json>

# Create a policy
organisations = StaxClient("organisations")
response = organisations.CreatePolicy(
Name=policy_name,
Description=policy_description,
Policy=policy
)
print(response)
16 changes: 16 additions & 0 deletions examples/policy/delete_policy.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import os

from staxapp.config import Config
from staxapp.openapi import StaxClient

Config.access_key = os.getenv("STAX_ACCESS_KEY")
Config.secret_key = os.getenv("STAX_SECRET_KEY")

policy_id = <Policy Id>

# Delete a policy
organisations = StaxClient("organisations")
response = organisations.DeletePolicy(
policy_id = policy_id,
)
print(response)
23 changes: 23 additions & 0 deletions examples/policy/update_policy.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import os

from staxapp.config import Config
from staxapp.openapi import StaxClient

Config.access_key = os.getenv("STAX_ACCESS_KEY")
Config.secret_key = os.getenv("STAX_SECRET_KEY")

# The policy to be updated
policy_id = <Policy Id>

policy_description = <Policy Description>

policy = <Policy Json>

# Update a policy
organisations = StaxClient("organisations")
response = organisations.UpdatePolicy(
policy_id = policy_id,
Description=policy_description,
Policy=policy,
)
print(response)
25 changes: 25 additions & 0 deletions examples/users/create_user.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import os

from staxapp.config import Config
from staxapp.openapi import StaxClient

Config.access_key = os.getenv("STAX_ACCESS_KEY")
Config.secret_key = os.getenv("STAX_SECRET_KEY")

# The user's first name
first_name = <User's first Name>

# The user's second name
last_name = <User's last Name>

# The email for the user
user_email = <User's Email>

# Create a Stax User
teams = StaxClient("teams")
response = teams.CreateUser(
FirstName = first_name,
LastName = last_name,
Email = user_email
)
print(response)
16 changes: 16 additions & 0 deletions examples/users/reset_password.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import os

from staxapp.config import Config
from staxapp.openapi import StaxClient

Config.access_key = os.getenv("STAX_ACCESS_KEY")
Config.secret_key = os.getenv("STAX_SECRET_KEY")

# The user id that needs a reset
user_id = <User Id>

teams = StaxClient("teams")
response = teams.UpdateUserPassword(
user_id=user_id
)
print(response)
24 changes: 24 additions & 0 deletions examples/users/update_user.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import os

from staxapp.config import Config
from staxapp.openapi import StaxClient

Config.access_key = os.getenv("STAX_ACCESS_KEY")
Config.secret_key = os.getenv("STAX_SECRET_KEY")

# The user id to resend invite
user_id = <User Id>

# Not required just show how properties are changed
user_role = <New Role>
user_status = <New Status>


# Update a Stax User
teams = StaxClient("teams")
response = teams.UpdateUser(
user_id = user_id,
Role = user_role,
Status = user_status
)
print(response)
16 changes: 16 additions & 0 deletions examples/users/update_user_invite.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import os

from staxapp.config import Config
from staxapp.openapi import StaxClient

Config.access_key = os.getenv("STAX_ACCESS_KEY")
Config.secret_key = os.getenv("STAX_SECRET_KEY")

# The user id to resend invite
user_id = <User Id>

teams = StaxClient("teams")
response = teams.UpdateUserInvite(
user_id= user_id
)
print(response)