Skip to main content

etudatasphere: Simplifying Cloud Administration. Access Yandex.Cloud services with ease, automating routine tasks for resource management.

Project description

EtuDataSphere

PyPI Python 3.6, 3.7, 3.8 GitHub Pull Requests License

This is a Python library for interacting with Yandex DataSphere API. It provides functions to perform various operations such as getting organizations, billing accounts, projects, managing organization members, creating projects, checking operation status, and adding contributors to projects.

Installation

Install the current version with PyPI:

pip install etudatasphere

Or from GitHub:

pip install https://github.com/sesh00/etudatasphere/archive/main.zip

Usage

Importing the DataSphereManager

from etudatasphere import DataSphereManager

Initializing DataSphereManager

oauth token

oauth_token = ""
dataSphereManager = DataSphereManager(oauth_token)

Request for Organizations and Their Identifiers

Retrieves a list of organizations and their identifiers.

dataSphereManager.get_organizations()

Request for Role Identifiers in DataSphere

Retrieves a list of possible roles in DataSphere.

dataSphereManager.get_possible_ds_roles()

Request for Payment Accounts

Retrieves a list of billing accounts.

dataSphereManager.get_billing_accounts()

Request for Members of a Specific Organization

Retrieves members of a specific organization

org_id = "" # From the section with the request for organizations
dataSphereManager.get_organization_members(org_id)

Request for the List of Organization Communities

Retrieves communities of a specific organization.

org_id = "" # From the section with the request for organizations
dataSphereManager.get_organization_communities(org_id)

Project Creation, Participant Addition, Settings

Creates a project, adds contributors, and configures settings.

community_id = "" # From the section with the request for communities
name = "" # Project name
description = "" # Project description
vmInactivityTimeout = "100s" # Release resources in the specified format, where 300 is the number of seconds of inactivity

dataSphereManager.create_project(
                        community_id = community_id,
                        name = name,
                        description = description,
                        vmInactivityTimeout = vmInactivityTimeout)

Operation Status Check

Checks the status of a specific operation.

id_operation = "" # Operation identifier from the section with project creation
dataSphereManager.check_operation_status(id_operation)

community_id = "" # From the section with project creation
dataSphereManager.get_projects(community_id=community_id)

Project Request

Retrieves information about projects.

project_id = "" # Identifier of the created project from the section with checking operation status
dataSphereManager.get_projects(project_id=project_id)

Adding Participants to a Project

Adds contributors to a project.

project_id = "" # Identifier of an existing project
contributors = [
        {
        "id": "", # Identifier of an organization member from the section with requesting members of a specific organization
        "role":"datasphere.communities.admin" # Possible role of a member from the section with requesting role identifiers
        },
        {
        "id": "",
        "role": "datasphere.communities.admin"
        }
    ]

dataSphereManager.add_contributors(project_id=project_id, contributors=contributors)

Update all community projects

community_id = ""
vm_inactivity_timeout = "100s"
unit_balance = 100
dataSphereManager.update_all_community_projects(community_id, vm_inactivity_timeout, unit_balance)

Get & Update unit balance

project_id = ""
unit_balance = 100
print(dataSphereManager.get_unit_balance(project_id))
dataSphereManager.update_unit_balance(project_id, unit_balance)

Contributing

Contributions to EtuDataSphere are welcome! If you find any issues or have suggestions for improvements, please feel free to open an issue or submit a pull request on the GitHub repository

License

The module is available as open source under the terms of the MIT License

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

etudatasphere-0.1.3.tar.gz (9.8 kB view hashes)

Uploaded Source

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