Skip to content

refactor (sdk) change the output for the example scripts #56

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

Merged
merged 1 commit into from
Aug 4, 2020
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
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ Config.secret_key = os.getenv("STAX_SECRET_KEY")
# Read all accounts within your Stax Organisation
accounts = StaxClient("accounts")
response = accounts.ReadAccounts()
print(response)
print(response.json())

# Read all active accounts within your Stax Organisation and include tags in the response
accounts = StaxClient("accounts")
response = accounts.ReadAccounts(filter="ACTIVE", include_tags=True)
print(response)
print(response.json())
```

## Contributing
Expand Down
2 changes: 1 addition & 1 deletion examples/account_types/create_account_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
response = accounts.CreateAccountType(
Name=account_type_name
)
print(response)
print(response.json())
2 changes: 1 addition & 1 deletion examples/account_types/delete_account_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
response = accounts.DeleteAccountType(
account_type_id=account_type_id
)
print(response)
print(response.json())
2 changes: 1 addition & 1 deletion examples/account_types/read_account_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
# Read all account types within your Stax Organisation
accounts = StaxClient("accounts")
response = accounts.ReadAccountTypes()
print(response)
print(response.json())
2 changes: 1 addition & 1 deletion examples/account_types/update_account_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@
account_type_id = account_type_id,
Name = account_type_name
)
print(response)
print(response.json())
2 changes: 1 addition & 1 deletion examples/account_types/update_account_type_access.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@
AddRoles= access_roles_to_add,
RemoveRoles=access_roles_to_remove
)
print(response)
print(response.json())
2 changes: 1 addition & 1 deletion examples/account_types/update_account_type_members.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@
response = accounts.UpdateAccountTypeMembers(
Members=account_type_mappings
)
print(response)
print(response.json())
2 changes: 1 addition & 1 deletion examples/account_types/update_policies.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@
AddPolicies= policies_to_add,
RemovePolicies= policies_to_remove
)
print(response)
print(response.json())
2 changes: 1 addition & 1 deletion examples/accounts/create_accounts.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@
Name=account_name,
AccountType=account_type,
)
print(response)
print(response.json())
4 changes: 2 additions & 2 deletions examples/accounts/read_accounts.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
# Read all accounts within your Stax Organisation
accounts = StaxClient("accounts")
response = accounts.ReadAccounts()
print(response)
print(response.json())

# Read all active accounts within your Stax Organisation and include tags in the response
accounts = StaxClient("accounts")
response = accounts.ReadAccounts(filter="ACTIVE", include_tags=True)
print(response)
print(response.json())
2 changes: 1 addition & 1 deletion examples/accounts/update_account.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@
account_id=account_id,
**update_properties
)
print(response)
print(response.json())
2 changes: 1 addition & 1 deletion examples/api_tokens/create_api_token.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@
# Create an Api token with access to your Stax Organisation
teams = StaxClient("teams")
response = teams.CreateApiToken(Name=token_name, Role=token_role, StoreToken=store_token)
print(response)
print(response.json())
2 changes: 1 addition & 1 deletion examples/api_tokens/delete_api_token.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
teams = StaxClient("teams")
response = teams.DeleteApiToken(AccessKey=access_key)

print(response)
print(response.json())
2 changes: 1 addition & 1 deletion examples/api_tokens/read_api_tokens.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
# Read all API tokens within your Stax Organisation
teams = StaxClient("teams")
response = teams.ReadApiTokens()
print(response)
print(response.json())
2 changes: 1 addition & 1 deletion examples/groups/create_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
response = teams.CreateGroup(
Name=group_name
)
print(response)
print(response.json())
2 changes: 1 addition & 1 deletion examples/groups/delete_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
response = teams.DeleteGroup(
group_id=group_id
)
print(response)
print(response.json())
2 changes: 1 addition & 1 deletion examples/groups/read_groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
# Read all groups within your Stax Organisation
teams = StaxClient("teams")
response = teams.ReadGroups()
print(response)
print(response.json())
2 changes: 1 addition & 1 deletion examples/groups/update_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@
group_id=group_id,
Name=group_name
)
print(response)
print(response.json())
2 changes: 1 addition & 1 deletion examples/groups/update_group_members.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@
AddMembers = user_membership_to_add,
RemoveMembers = user_membership_to_remove
)
print(response)
print(response.json())
3 changes: 1 addition & 2 deletions examples/networking/create_hub.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import os
import json

from staxapp.config import Config
from staxapp.openapi import StaxClient
Expand All @@ -19,4 +18,4 @@
}
response = networks.CreateHub(**body)

print(json.dumps(response))
print(response.json())
3 changes: 1 addition & 2 deletions examples/networking/delete_dns_resolver.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import os
import json

from staxapp.config import Config
from staxapp.openapi import StaxClient
Expand All @@ -11,4 +10,4 @@

response = networks.DeleteDnsResolver(dns_resolver_id="<resolver_uuid>")

print(json.dumps(response))
print(response.json())
3 changes: 1 addition & 2 deletions examples/networking/delete_dns_rule.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import os
import json

from staxapp.config import Config
from staxapp.openapi import StaxClient
Expand All @@ -11,4 +10,4 @@

response = networks.DeleteDnsRule(dns_rule_id="<rule_uuid>")

print(json.dumps(response))
print(response.json())
3 changes: 1 addition & 2 deletions examples/networking/delete_exclusion.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import os
import json

from staxapp.config import Config
from staxapp.openapi import StaxClient
Expand All @@ -11,4 +10,4 @@

response = networks.DeleteCidrExclusion(exclusion_id="<exclusion_uuid>")

print(json.dumps(response))
print(response.json())
3 changes: 1 addition & 2 deletions examples/networking/delete_hub.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import os
import json

from staxapp.config import Config
from staxapp.openapi import StaxClient
Expand All @@ -11,4 +10,4 @@

response = networks.DeleteHub(hub_id="<hub_uuid>")

print(json.dumps(response))
print(response.json())
3 changes: 1 addition & 2 deletions examples/networking/delete_range.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import os
import json

from staxapp.config import Config
from staxapp.openapi import StaxClient
Expand All @@ -11,4 +10,4 @@

response = networks.DeleteCidrRange(range_id="<range_uuid>")

print(json.dumps(response))
print(response.json())
3 changes: 1 addition & 2 deletions examples/networking/delete_vpc.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import os
import json

from staxapp.config import Config
from staxapp.openapi import StaxClient
Expand All @@ -11,4 +10,4 @@

response = networks.DeleteVpc(vpc_id="<vpc_uuid>")

print(json.dumps(response))
print(response.json())
3 changes: 1 addition & 2 deletions examples/networking/read_dns_resolvers.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import os
import json

from staxapp.config import Config
from staxapp.openapi import StaxClient
Expand All @@ -12,4 +11,4 @@
# query all resolvers within your organisation, or provide a resolver id
response = networks.ReadDnsResolvers(dns_resolver_id="<resolver_uuid>")

print(json.dumps(response, indent=4, sort_keys=True))
print(response.json())
1 change: 0 additions & 1 deletion examples/networking/read_exclusions.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import os
import json

from staxapp.config import Config
from staxapp.openapi import StaxClient
Expand Down
3 changes: 1 addition & 2 deletions examples/networking/read_hubs.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import os
import json

from staxapp.config import Config
from staxapp.openapi import StaxClient
Expand All @@ -15,4 +14,4 @@

# read hubs by statuses
response = networks.ReadHubs(status="DELETED,ACTIVE")
print(json.dumps(response, indent=4, sort_keys=True))
print(response.json()))
3 changes: 1 addition & 2 deletions examples/networking/update_dns_resolver.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import os
import json

from staxapp.config import Config
from staxapp.openapi import StaxClient
Expand All @@ -15,4 +14,4 @@
}
response = networks.UpdateDnsResolver(dns_resolver_id="<resolver_uuid>", **body)

print(json.dumps(response))
print(response.json())
3 changes: 1 addition & 2 deletions examples/networking/update_dns_rule.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import os
import json

from staxapp.config import Config
from staxapp.openapi import StaxClient
Expand All @@ -15,4 +14,4 @@

response = networks.UpdateDnsRule(dns_rule_id="<dns_rule_uuid>", **body)

print(json.dumps(response))
print(response.json())
2 changes: 1 addition & 1 deletion examples/networking/update_exclusion.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
}
response = networks.UpdateCidrExclusion(exclusion_id="<exclusion_uuid>", **body)

print(json.dumps(response))
print(response.json())
2 changes: 1 addition & 1 deletion examples/networking/update_hub.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@
}
response = networks.UpdateHub(hub_id="<hub_uuid>", **body)

print(json.dumps(response))
print(response.json())
2 changes: 1 addition & 1 deletion examples/networking/update_range.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
}
response = networks.UpdateCidrRange(range_id="<range_uuid>", **body)

print(json.dumps(response))
print(response.json())
2 changes: 1 addition & 1 deletion examples/networking/update_vpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
}
response = networks.UpdateVpc(vpc_id="<vpc_id>", **body)

print(json.dumps(response))
print(response.json())
2 changes: 1 addition & 1 deletion examples/policy/create_policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@
Description=policy_description,
Policy=policy
)
print(response)
print(response.json())
2 changes: 1 addition & 1 deletion examples/policy/delete_policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
response = organisations.DeletePolicy(
policy_id = policy_id,
)
print(response)
print(response.json())
2 changes: 1 addition & 1 deletion examples/policy/read_policies.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
# Read all policies within your Stax Organisation
organisations = StaxClient("organisations")
response = organisations.ReadPolicies()
print(response)
print(response.json())
2 changes: 1 addition & 1 deletion examples/policy/update_policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@
Description=policy_description,
Policy=policy,
)
print(response)
print(response.json())
8 changes: 4 additions & 4 deletions examples/tasks/read_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@

# Read all tasks
task_client = StaxClient("tasks")
all_tasks = task_client.ReadTasks()
print(all_tasks)
response = task_client.ReadTasks()
print(response.json())

# Task Id in the response of a different StaxClient call
task_id = <Task Id>

# Get a specific task
task = task_client.ReadTask(task_id=task_id)
print(task)
response = task_client.ReadTask(task_id=task_id)
print(response.json())
2 changes: 1 addition & 1 deletion examples/users/create_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@
LastName = last_name,
Email = user_email
)
print(response)
print(response.json())
2 changes: 1 addition & 1 deletion examples/users/read_users.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
# Read all users within your Stax Organisation
teams = StaxClient("teams")
response = teams.ReadUsers()
print(response)
print(response.json())
2 changes: 1 addition & 1 deletion examples/users/reset_password.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
response = teams.UpdateUserPassword(
user_id=user_id
)
print(response)
print(response.json())
Loading