Skip to main content

scaleway python client to interact with the scaleway API

Project description

Scaleway Python Client

prerequisites :

Set the environment variables SCW_API_KEY_ID & SCW_API_KEY.

Rdb :

  • list_instances
  • create_database
  • create_user
  • set_user_privileges
  • update_user
  • delete_user
  • delete_database
from scw_py_client.models.rdb import Privileges, User, Database
from scw_py_client.core import RdbClient

rdbClient = RdbClient()

instances = rdbClient.list_instances()
instance = instances[0]

test_database = rdbClient.create_database(instance=instance, database=Database(name="test_database"))
test_user = rdbClient.create_user(
    instance=instance, user=User(name="test_user"), password=User.Password("password1"))
rdbClient.set_user_privileges(instance=instance, privileges=Privileges(
    database_name=test_database.name, user_name=test_user.name, permission=Privileges.Permission.ReadWrite))
test_user = rdbClient.update_user(instance=instance, user=test_user, password=User.Password("password2"))
rdbClient.delete_user(instance=instances[0], user=test_user)
rdbClient.delete_database(instance=instance, database=test_database)

Registry :

  • list_images
  • get_image
  • update_image
  • delete_image
from scw_py_client.core import RegistryClient

registryClient = RegistryClient()
images = registryClient.list_images()

Functions :

  • list_containers
  • get_container
  • create_container
  • deploy_container
  • update_container
  • delete_container
  • list_namespaces
  • get_namespace
  • create_namespace
  • update_namespace
  • delete_namespace
  • list_functions
  • get_function
  • create_function
  • deploy_function
  • update_function
  • delete_function
  • list_crons
  • get_cron
  • create_cron
  • update_cron
  • delete_cron
  • list_logs
from scw_py_client.core import FunctionsClient

functions_client = FunctionsClient()
containers = functions.list_containers()

Object Storage :

  • list_buckets
  • create_bucket
  • enable_bucket_website
  • upload_file_to_bucket
from scw_py_client.core import ObjectStorageClient

object_storage_client = ObjectStorageClient.ObjectStorage()
buckets = object_storage_client.list_buckets()
object_storage_client.create_bucket("my_bucket_name")

K8s :

  • list_clusters
from src.scw_py_client.core import K8sClient

k8s_client = K8sClient()
clusters = k8s_client.list_clusters()

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

scw-py-client-0.1.2.tar.gz (8.2 kB view hashes)

Uploaded Source

Built Distribution

scw_py_client-0.1.2-py3-none-any.whl (9.8 kB view hashes)

Uploaded Python 3

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