Project module

Any rapyuta.io resource that you create, or allocate and use must belong to a project. You can think of a project as the organizational unit for what you are building. A project is made up of the settings, configuration, and other metadata that describe your applications. Resources within a single project can work together easily, for example, by communicating through an internal network. The resources that each project contains remain separate across project boundaries; you can only interconnect them through an external connection.

Each project has:

  • Auto-generated unique project ID

  • A project name, which you provide.

  • miscellaneous metadata: e.g., creator name, timestamp, etc.

  • You may create multiple projects and use them to organize rapyuta.io resources.

Client Module

class Client(auth_token, project=None)

Client class provides access to device, package, volume and deployment classes.

__init__(auth_token, project=None)

Get new client object

Parameters
  • auth_token (string) – Authentication token

  • project (string) – project_guid of the user

add_user_to_project(project_guid, user_guid)

Creator of a Project can add a User belonging to the same Organization into the Project.

Parameters
  • project_guid (str) – Project’s GUID

  • user_guid (str) – User’s GUID

Following example demonstrates how to add a User to a Project using this method.

>>> client = Client(auth_token='auth_token')
>>> client.add_user_to_project(project_guid='project_guid', user_guid='user_guid')
create_project(project)

Create a new Project

Parameters

project (Project) – Project object

Return type

Project

Following example demonstrates the use of this method for creating a new Project.

>>> from rapyuta_io.clients.project import Project
>>> client = Client(auth_token='auth_token')
>>> proj = Project('project-name')
>>> client.create_project(proj)

Following example demonstrates the use of this method for creating a new Project in a different organization. Please do note that the user should be a part of the organization where the project is to be created.

>>> from rapyuta_io.clients.project import Project
>>> client = Client(auth_token='auth_token')
>>> proj = Project('project-name', 'org-guid')
>>> client.create_project(proj)
delete_project(guid)

Delete a Project from the platform.

Parameters

guid (str) – Project’s GUID

Following example demonstrates how to delete a Project using this method.

>>> client = Client(auth_token='auth_token')
>>> client.delete_project('project-guid')
get_project(guid)

Get a Project from its GUID.

Parameters

guid (str) – Project’s GUID

Return type

Project

Following example demonstrates how a Project can be fetched using this method.

>>> client = Client(auth_token='auth_token')
>>> client.get_project('project-guid')
list_projects()

Get a list of all the Projects.

Returns

A list of all available Projects for the user.

Return type

list(Project)

Following example demonstrates how to fetch the list of all Projects.

>>> client = Client(auth_token='auth_token')
>>> client.list_projects()
remove_user_from_project(project_guid, user_guid)

Creator of a Project can remove a User from the Project.

Parameters
  • project_guid (str) – Project’s GUID

  • user_guid (str) – User’s GUID

Following example demonstrates how to remove a User from a Project using this method.

>>> client = Client(auth_token='auth_token')
>>> client.remove_user_from_project(project_guid='project_guid', user_guid='user_guid')
set_project(project_guid)

Sets the current Project for the Client.

Parameters

project_guid – GUID of the Project

Following example demonstrates how to set the Project for the Client.

>>> from rapyuta_io import Client
>>> from rapyuta_io.clients.project import Project
>>> client = Client(auth_token='auth_token', project='project_guid')
>>> project = client.create_project(Project('secret-guid'))
>>> client.set_project(project.guid)
>>> persistent_volume = client.get_persistent_volume()

Project Module

class Project(name, organization_guid=None)

Project is an organizational unit and all the resources must belong to a Project.

Variables
  • id (int) – id of the Project

  • guid (str) – guid of the Project

  • created_at (str) – creation time of the Project

  • updated_at (str) – updation time of the Project

  • deleted_at (str) – deletion time of the Project

  • creator (str) – GUID of the User that created the Project

  • users (list(User)) – Users that have access to the Project

  • organization (Organization) – Organization that the project belongs to

Parameters

name (str) – name of the Project

delete()

Delete the project using the project object.

Following example demonstrates how to delete a project using project object:

>>> from rapyuta_io import Client
>>> client = Client(auth_token='auth_token', project='project_guid')
>>> project = client.get_project(guid='project-id')
>>> project.delete()
class User

User is the representation of a Human user on the Platform. Users can be part of one of more Projects.

Variables
  • guid (str) – guid of the User

  • first_name (str) – First name of the User

  • last_name (str) – Last name of the User

  • email_id (str) – Email of the User

  • state (UserState) – The state of the User on the Platform

  • projects (list(Project)) – Projects to which the User Belongs

  • organization (Organization) – Primary organization that the user created or got invited to for the first time

  • organizations (list(Organization)) – List of organizations that the user is part of

class UserState(value)

Enumeration variables for UserState.

UserState can be any of the following types

UserState.REGISTERED (‘REGISTERED’)

UserState.ACTIVATED (‘ACTIVATED’)

UserState.DEACTIVATED (‘DEACTIVATED’)

UserState.SUSPENDED (‘SUSPENDED’)

UserState.INVITED (‘INVITED’)