Skip to main content

Client for the Vista API

Project description

Vista API for Python

Python implementation of the Vista API.

Reference

Prerequisites

You'll need to create a Vista API key from the Vista Dashboard.

Usage

Install the dependency:

pip install vista_api_client

Then in your Node application:

from vista_api_client import VistaClient

if __name__ == '__main__':
    client = VistaClient('z9Not6ZyDQn8YGw3GxHZx54k0U1qA_2KIL1HktuYPc5EKEfd', 'branch_name')
    roles = client.resources.list('test')
    print(roles)

After that you are good to go!

Please see the Vista API Documentation for documentation of the API. ://docs.govista.io/api/) for documentation of the API.

All Operator

You can use VistaClient.ALL in place where resource_id or resource_type is accepted to indicate all.

Usage

The following describes methods namespaced by Vista resources.

Admin

client.admin

method description
create_branch(branch : str) Creates new Branch
clone_branch(branch : str, new_branch: str) Clones templates in branch to newBranch
create_read_tokens() Creates a set of read-only tokens meant to be used by Vista React components

Resource Types

client.resource_types

method description
list() Lists all Resource Types
upsert(name : str, actions : str[], attributes: str[]) Upserts a Resource Type
add_relationship(from_id: str, from_resource_type: str, attribute: str, to_id: str, to_resource_type: str) Adds an attribute relationship between 2 resourceIds

Roles

client.roles

method description
list(org_id: str) Lists all Roles
upsert(role_id : str, resource_type_to_attribute_to_actions : { resource_type: { attribute: actions[] }}, parent_roles: str[], org_id: str) Upserts a Role
inherit(child_role_id: str, parent_role_id: str, org_id: str) Adds Role as child of parent role

Users

client.users

method description
create(user_id: str, org_id: str) Creates new User
list(org_id: str) Lists Users in org_id
assign_to_userset(user_id: str, userset_id: str) Adds User to a Userset
remove_from_userset(user_id: str, userset_id: str) Removes User from Userset
check(user_id: str, action: str, resource_type: str, resource_id: str, attribute?: str) Checks User access
expand(user_id: str) Lists all granted permissions for User.
grant_action(user_id: str, action: str, resource_type: str, resource_id: str, attribute?: str) Allows user to perform action on (resource_id, resource_type)
revoke_action(user_id: str, action: str, resource_type: str, resource_id: str, attribute?: str) Revokes action on (resource_id, resource_type) for User.
grant_role(user_id: str, role_id: str, resource_type: str, resource_id: str) Grants Role to User
revoke_role(user_id: str, role_id: str, resource_type: str, resource_id: str) Revokes Role from User

Usersets

client.usersets

method description
create(user_id: str, org_id: str) Creates Userset
grant_action(user_id: str, action: str, resource_type: str, resource_id: str, attribute?: str) Allows User to perform action on (resource_id, resource_type)
revoke_action(user_id: str, action: str, resource_type: str, resource_id: str, attribute?: str) Revokes action on (resource_id, resource_type) for Userset
grant_role(user_id: str, role_id: str, resource_type: str, resource_id: str) Grants Role to Userset
revoke_role(user_id: str, role_id: str, resource_type: str, resource_id: str) Revokes Role from Userset

Grants

client.grants

method description
list(user_id: str | None, action: str | None, resource_id: str | None, resource_type: str | None, attribute: str | None, org_id: str | None) List & filter grants by arguments
list_unflattened(org_id: str) Lists User or Userset grants

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vista_api_client-0.4.4.tar.gz (6.6 kB view details)

Uploaded Source

File details

Details for the file vista_api_client-0.4.4.tar.gz.

File metadata

  • Download URL: vista_api_client-0.4.4.tar.gz
  • Upload date:
  • Size: 6.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.1

File hashes

Hashes for vista_api_client-0.4.4.tar.gz
Algorithm Hash digest
SHA256 82bdd06875030b4952bc0d2d5ea38ec432991e34550dc4235bbf0abc02122488
MD5 9a6fdd0b033826531e37fe8913491bf9
BLAKE2b-256 f0fb0553c8b9a7ac2b3eb2678124b79ce30d159267468bd03967c30ace0821a1

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page